Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make E2E tests more robust #1127

Merged
merged 1 commit into from
Jun 9, 2022
Merged

Make E2E tests more robust #1127

merged 1 commit into from
Jun 9, 2022

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jun 8, 2022

After working on the feature tests in #1119, it's clear that React Testing Library is much better than Cypress Testing Library at waiting for React to finish rendering. That's why we have a lot of workarounds in the E2E specs, waiting for unrelated things to appear, and why we get a lot of retry attempts in the CI.

In this PR, I'm introducing a query called cy.waitForStableDom() found here: https://github.com/narinluangrath/cypress-wait-for-stable-dom/, which seems to perfectly solve all our problems. It tells Cypress to wait until there are no more mutations in the DOM over a given period of time. By calling it after every user action (click, type, etc.), all the tests pass on their first attempts.

The polling interval is currently set to 300ms, a bit more than the slicing slider, just to be safe for the screenshots. In #1119, I'm introducing a way to detect when a slice selection is actually applied to the visualization, so once it is merged, I will try to refactor to reduce the delay.

image

cypress/specs/app.spec.ts Show resolved Hide resolved
cypress/specs/app.spec.ts Show resolved Hide resolved
@axelboc axelboc requested a review from loichuder June 8, 2022 14:20
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 👍

@axelboc axelboc merged commit beb0349 into main Jun 9, 2022
@axelboc axelboc deleted the improve-e2e branch June 9, 2022 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants