fix: flaky download file manifest e2e — wait for nav (#4828)#4835
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a flaky Playwright e2e in the AnVIL CMG dataset export flow by explicitly waiting for client-side navigation after clicking an export-method card, before asserting destination-page UI. This aligns the test behavior with the actual SPA routing timing (particularly on Firefox) and prevents assertions from polling a page that has already unmounted.
Changes:
- Add
page.waitForURL(...)after clicking “Request File Manifest” to ensure the manifest download route is loaded before asserting the “Request Link” button. - Add the same navigation wait after clicking “Analyze in Terra” before asserting that the Terra form is visible.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NoopDog
approved these changes
May 14, 2026
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
Adds an explicit
waitForURLbetweenclickCardand the destination-page assertion in two Dataset e2e tests:displays download file manifest— the test cited in the CI failure. Click navigated to/datasets/{id}/export/download-manifest, but the assertion on.MuiButton-root:has-text("Request Link")polled an unmounted page and timed out with18 × locator resolved to 0 elements.displays analyze in Terra— same shape (clickCard → destination-page UI assertion, no wait), so applied the same defence preemptively.The other
clickCardsites in the spec (displays download file manifest selected data,displays analyze in Terra selected data) are already navigation-aware viaPromise.all([waitForRequest, clickCard]).Inline regex was avoided —
ROUTES.MANIFEST_DOWNLOADandROUTES.TERRAare already imported, so the wait uses a predicate (url.pathname.endsWith(ROUTES.X)) for clarity and DRY.Closes #4828.
Test plan
npx tsc --noEmit,npm run check-formatpassnpm run test:anvil-cmg— full anvil suite, 114/114 across chromium/firefox/webkit (2.6 min)Out of scope
A broader rewrite of
anvil-dataset.spec.ts(test-id-based locators, role-based queries,dispatchEventfor click-swallowing, helper layout convention fromanvil-filters.spec.ts) was considered and deferred — the spec is otherwise stable and the structure isn't itself flaky.🤖 Generated with Claude Code