test: stabilize and rewrite anvil-cmg filter e2e suite (#4800)#4801
Merged
test: stabilize and rewrite anvil-cmg filter e2e suite (#4800)#4801
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the AnVIL CMG filter e2e coverage to use shared test-id-driven helpers, aligning the CMG suite more closely with the newer catalog filter tests and aiming to reduce filter-related flake.
Changes:
- Rewrites
e2e/anvil/anvil-filters.spec.tsaround shared filter helpers and more stable locators. - Extracts reusable filter and regex helpers into
e2e/features/common/filters.tsande2e/features/common/utils.ts. - Cleans up obsolete filter-test helpers and unused constants from older CMG test utilities.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
e2e/testFunctions.ts |
Removes old shared filter-test helpers and keeps remaining table/test utilities. |
e2e/features/common/utils.ts |
Adds shared escapeRegExp helper. |
e2e/features/common/filters.ts |
Adds reusable filter-popover, option-selection, and filter-tag helpers for Playwright tests. |
e2e/anvil/constants.ts |
Adds CMG facet-name constants and removes an unused selectable-columns constant. |
e2e/anvil/anvil-filters.spec.ts |
Rewrites CMG filter e2e coverage to use the new shared helpers and more targeted assertions. |
e2e/anvil-catalog/anvilcatalog-filters.spec.ts |
Switches catalog filter tests to the new shared helper module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frano-m
added a commit
that referenced
this pull request
May 5, 2026
per copilot review on #4801: the multi-select and count tests still used regular click() on popover items, which can be swallowed by the popover overlay on webkit (the same failure mode the selectFirstOption helper guards against). switch both to dispatchevent("click") for consistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rewrites e2e/anvil/anvil-filters.spec.ts in the style of the anvil-catalog filter spec to fix a flaky biosamples chip-click test and reduce overall flake surface. key changes: - replaced positional/text-based locators with test-id locators (filter-popover, filter-item, filter-term, filter-count, table-first-cell, clear-all-filters, filters) - extracted shared filter helpers to e2e/features/common/filters.ts so both anvil-cmg and anvil-catalog specs use the same primitives; generic helpers to e2e/features/common/utils.ts (escapeRegExp) - option clicks via dispatchevent (matches existing sidebar-button pattern, avoids webkit click swallowing) - popover assertions re-locate by name across facets (filter list re-sorts when count changes); within a single facet popover, positional locators are kept since the list does not reorder on selection - filter tag chips matched via mui-chip-root scoped to the filters container, replacing brittle #sidebar-positioner text lookups - consolidated 10 per-entity filter-presence/open tests into 2 (files + donors representatives) covering both strict-list match and per-filter open/close cleanup: - removed testfilterpersistence, testfiltercounts, testfiltertags, testclearall, testfilterpresence and their now-orphaned helpers from e2e/testFunctions.ts - demoted getmthrowncthcolumncelllocator and getfirstrownthcolumncelllocator from export to internal const - removed unused anvil_files_selectable_columns_by_name from e2e/anvil/constants.ts Closes #4800 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
per copilot review on #4801: the multi-select and count tests still used regular click() on popover items, which can be swallowed by the popover overlay on webkit (the same failure mode the selectFirstOption helper guards against). switch both to dispatchevent("click") for consistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
f39d399 to
e2395cc
Compare
NoopDog
approved these changes
May 5, 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
e2e/anvil/anvil-filters.spec.tsin the style of the anvil-catalog filter spec to fix the flaky BioSamples chip-click test and reduce overall flake surface.filter-popover,filter-item,filter-term,filter-count,table-first-cell,clear-all-filters,filters) replace positional and text-only matches.e2e/features/common/filters.tsso both anvil-cmg and anvil-catalog specs use the same primitives. Generic helpers (escapeRegExp) live ine2e/features/common/utils.ts.dispatchEvent("click")(matches the existing sidebar-button pattern; avoids WebKit click swallowing)..MuiChip-rootinside the filters container, replacing brittle#sidebar-positionertext matches.Cleanup in
e2e/testFunctions.tstestFilterPresence,testFilterPersistence,testFilterCounts,testFilterTags,testClearAlland their now-orphaned private helpers (getNamedFilterOptionLocator,getFirstFilterOptionLocator,getNthFilterOptionLocator,getFirstNonEmptyFilterOptionInfo,MAX_FILTER_OPTIONS_TO_CHECK,FilterOptionNameAndLocator).getMthRowNthColumnCellLocatorandgetFirstRowNthColumnCellLocatorfromexportto internalconst(still used internally by other helpers, no external callers).ANVIL_FILES_SELECTABLE_COLUMNS_BY_NAMEfrome2e/anvil/constants.ts.Test plan
npx tsc --noEmit) clean.Closes #4800