fix: rewrite flaky anvil pagination e2e to test-id locators (#4830)#4836
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR rewrites the AnVIL CMG pagination E2E spec to use more focused, test-id-based Playwright assertions and removes obsolete shared pagination helpers that were only used by the old spec.
Changes:
- Replaces 3 broad pagination tests with smaller behavior-specific pagination tests.
- Adds local helpers for pagination parsing, navigation polling, and dynamic filter selection.
- Removes unused legacy pagination helpers/constants from
e2e/testFunctions.ts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
e2e/anvil/anvil-pagination.spec.ts |
Rewrites pagination coverage around test-id locators, content-change polling, and per-behavior assertions. |
e2e/testFunctions.ts |
Removes obsolete shared pagination helpers and related unused imports/constants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ad8e96e to
a6a3d9c
Compare
NoopDog
approved these changes
May 15, 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
Rewrites
e2e/anvil/anvil-pagination.spec.tsend-to-end and removes the three obsolete shared helpers it was the last consumer of. Brings the spec in line with the locator and layout conventions established inanvil-filters.spec.ts.Spec changes:
getByTestId(TEST_IDS.TABLE_PAGINATION,TABLE_PAGINATION_RESULTS,TABLE_FIRST_CELL,FILTER_ITEM,FILTER_COUNT,SEARCH_ALL_FILTERS) — no.Mui*class top-level locators, no xpath ancestor traversal.triggerActionAndWaitForUpdate(target, action)content-poll primitive: capture the anchor'stextContent, run the action,expect.polluntil it differs. ReplaceswaitForLoadState(which doesn't track post-fetch row swap).dispatchEvent("click")per the webkit-overlay workaround already adopted ine2e/features/common/filters.ts.closeAutocompletePopperfrome2e/features/common/filters.tsinstead of a raw ESC keypress.test.fail()removed (every test now asserts deterministic outcomes).PAGE_SIZE,PAGES_TO_NAVIGATE,SAMPLE_NAVIGATIONS,FILTER_COUNT_MIN/MAX,ENTITY_URL,ENTITY_URL_WITH_FIRST_CELL) replaces inline magic numbers./* ——— helpers ——— */divider, non-exported.Why two entity URLs:
ENTITY_URL = "/files"is used for 8 of 9 tests (and for the filter-count-in-range search). The "shows different table content on every page" test overrides to"/biosamples"because Files' first cell renders only an icon download button —textContent()returns""and can't anchor a per-row diff.Helper cleanup in
e2e/testFunctions.ts:testFirstPagePagination,filterAndTestLastPagePagination,testPaginationContent(the spec was their only caller).PAGE_COUNT_REGEX,MAX_PAGINATIONS,MAX_FILTER_LENGTH.KEYBOARD_KEYSimport.TabDescription,getFirstRowNthColumnCellLocator,filterRegexare retained — used elsewhere.Closes #4830.
Test plan
npx tsc --noEmit,npm run lint,npm run check-formatpassnpx playwright test -c playwright_anvil.config.ts e2e/anvil/anvil-pagination.spec.ts— 27/27 across chromium/firefox/webkit (1.1 min)npm run test:anvil-cmg— full anvil suite, 132/132 across all three browsers (7.9 min)Out of scope (potential follow-up)
triggerActionAndWaitForUpdateis a general "perform action, wait for in-place data update" primitive. Other specs (sort, filter-apply) would benefit from sharing it. Hoist toe2e/features/common/utils.tsin a follow-up — deferred to keep this PR scoped.🤖 Generated with Claude Code