refactor(e2e): Replace arbitrary waits with state-based waiting in flag tests#6829
Closed
talissoncosta wants to merge 1 commit intomainfrom
Closed
refactor(e2e): Replace arbitrary waits with state-based waiting in flag tests#6829talissoncosta wants to merge 1 commit intomainfrom
talissoncosta wants to merge 1 commit intomainfrom
Conversation
…ag tests
Replace fixed 500ms timeouts with `waitForElementVisible('#try-it-results')`
to wait for the actual loading state to complete. This approach:
- Eliminates race conditions on slow CI runners
- Runs faster when API responds quickly (no artificial 500ms delays)
- More semantically correct (waits for the element we actually need)
- Consistent with E2E best practices already used elsewhere
The #try-it-results element only receives its ID when the TryIt component
finishes loading (isLoading: false), making it the perfect indicator to
wait for rather than guessing arbitrary timeout values.
Related: #6827 (increased timeouts from 500ms to 2000ms/1500ms)
This PR provides a better alternative to arbitrary timeout increases.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Docker builds report
|
Contributor
|
@talissoncosta I don't think this will work. The issue is that the tests will also need to wait for the feature change to propagate from the Core API, to dynamodb (London), and then get replicated to the dynamodb table in the US. That can take a second or 2 some times. If we want to make this more robust, we'd need to have it keep trying the try it button until it gets the result it's expecting. Until then, I suggest we go with the longer static timeouts. |
Contributor
|
Closing based on the above comment. We can perhaps revisit replacing at least the first wait once we merge the playwright changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves E2E test reliability and speed by replacing arbitrary timeout waits with proper state-based waiting in flag-tests.
Changes
Replace fixed
t.wait(500)timeouts withwaitForElementVisible('#try-it-results')in three locations within flag-tests.ts.Why This Approach is Better
Fixed timeouts:
State-based waiting:
Technical Details
The
#try-it-resultselement only receives its ID when!this.state.isLoading(TryIt.js:82), guaranteeing:This is the standard pattern already used throughout our E2E test suite.
Test Plan
make test