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

chore: make feature.spec and segements.spec more resilient #7289

Merged
merged 19 commits into from
Jun 7, 2024

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Jun 5, 2024

This PR attempts to make the feature.spec and segements.spec test suites more reliable. They have been flaking out a lot recently, and this will hopefully make them less flaky.

The way of handling it is a little different for each test suite.

feature.spec

Some of the failures we're seeing for the feature/feauture.spec test suite are due to uncaught resize observer issues (possibly triggered by the banners).

We can ignore these errors as they don't impact functionality, only rendering, and are likely to resolve themselves quickly in real-world scenarios.

On the other hand, it might also ignore actual errors, so I'm not a 100% on this. Would love some input.

However, MDN has some info on observation errors:

As long as the error event does not fire indefinitely, resize observer will settle and produce a stable, likely correct, layout. However, visitors may see a flash of broken layout, as a sequence of changes expected to happen in a single frame is instead happening over multiple frames.

Based on that, I think this is a pretty safe error to ignore.

I'm unsure whether catching this exception is only set in the after cleanup or whether it pollutes the cy object for all tests, but I think it's fine either way. But if you have ideas, I'd love to hear them.

segments.spec

The issue here appears to be that when we first input the segment's name in the form, it takes a little time for the UI to become ready, so the first characters of the string are cut off.

This is a known issue that the cypress team are aware, but that isn't likely to get fixed any time soon because no one can give them a reproducible example.

You can see the effect of this on segments that haven't been cleaned up in the preview:
image

To work around it, we add a 500ms wait before we start filling out the form. Yes, adding waits in your tests is an antipattern, but it's the easiest way around in this case.

We could investigate and find a way not to need that, but that would likely be a much larger project. This appears to mitigate the issue immediately, so is at least a pretty good temporary fix in my opinion. We also already do this in other tests, so there is a precedent for it.

Copy link

vercel bot commented Jun 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2024 0:47am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2024 0:47am

Copy link
Contributor

github-actions bot commented Jun 5, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

@thomasheartman thomasheartman changed the title chore: ignore resize observer issues in test teardown chore: ignore resize observer issues in cypress Jun 6, 2024
@thomasheartman thomasheartman changed the title chore: ignore resize observer issues in cypress chore: make feature.spec and segements.spec more resilient Jun 6, 2024
Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

If this allows me to not have to repeatedly run the action to make it go green. I'm all for it.

@thomasheartman
Copy link
Contributor Author

thomasheartman commented Jun 7, 2024

Appears to at least mitigate some of the issues. There's still errors that can pop up, but I ran it four times in a row without getting any errors. Got an error on the fifth run, but that was a new error, so that's progress for sure. Also, four successful runs in a row vs 24 runs to make everything pass sounds like a net improvement to me.

@thomasheartman thomasheartman merged commit 215608c into main Jun 7, 2024
10 of 11 checks passed
@thomasheartman thomasheartman deleted the chore/feature-e2e-test-issues branch June 7, 2024 06:37
thomasheartman added a commit that referenced this pull request Jun 12, 2024
…messages

This change adds a wait statement before entering the name of the
segment when checking for error messages that this segment name
already exists.

This is the same workaround that we did in
#7289, which seems to have
worked.

Like in that PR, using waits is still an antipattern, but it appears
to be working.
thomasheartman added a commit that referenced this pull request Jun 12, 2024
…messages (#7377)

This change adds a wait statement before entering the name of the
segment when checking for error messages that this segment name
already exists.

This is the same workaround that we did in
#7289, which seems to have
worked.

Like in that PR, using waits is still an antipattern, but it appears
to be working.

Maybe it’s time to look more deeply at why it happens? Why isn’t the
field ready to receive input even though it’s on the page? Is it mui’s
fault or ours?
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