Skip to content

fix: flaky download file manifest e2e — wait for nav (#4828)#4835

Merged
NoopDog merged 1 commit into
mainfrom
fran/4828-anvil-dataset-e2e-rewrite
May 14, 2026
Merged

fix: flaky download file manifest e2e — wait for nav (#4828)#4835
NoopDog merged 1 commit into
mainfrom
fran/4828-anvil-dataset-e2e-rewrite

Conversation

@frano-m
Copy link
Copy Markdown
Contributor

@frano-m frano-m commented May 14, 2026

Summary

Adds an explicit waitForURL between clickCard and 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 with 18 × 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 clickCard sites in the spec (displays download file manifest selected data, displays analyze in Terra selected data) are already navigation-aware via Promise.all([waitForRequest, clickCard]).

Inline regex was avoided — ROUTES.MANIFEST_DOWNLOAD and ROUTES.TERRA are 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-format pass
  • npm run test:anvil-cmg — full anvil suite, 114/114 across chromium/firefox/webkit (2.6 min)
  • Watch CI over the next several runs to confirm the Firefox flake is gone

Out of scope

A broader rewrite of anvil-dataset.spec.ts (test-id-based locators, role-based queries, dispatchEvent for click-swallowing, helper layout convention from anvil-filters.spec.ts) was considered and deferred — the spec is otherwise stable and the structure isn't itself flaky.

🤖 Generated with Claude Code

@frano-m frano-m requested a review from Copilot May 14, 2026 04:41
@frano-m frano-m marked this pull request as ready for review May 14, 2026 04:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 NoopDog merged commit 80deb3a into main May 14, 2026
7 checks passed
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.

fix: flaky 'displays download file manifest' e2e — wait for navigation before asserting button

3 participants