Skip to content

test: stabilize and rewrite anvil-cmg filter e2e suite (#4800)#4801

Merged
NoopDog merged 2 commits intomainfrom
fran/4800-flaky-anvil-cmg-filter-test
May 5, 2026
Merged

test: stabilize and rewrite anvil-cmg filter e2e suite (#4800)#4801
NoopDog merged 2 commits intomainfrom
fran/4800-flaky-anvil-cmg-filter-test

Conversation

@frano-m
Copy link
Copy Markdown
Contributor

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

Summary

  • Rewrites e2e/anvil/anvil-filters.spec.ts in the style of the anvil-catalog filter spec to fix the flaky BioSamples chip-click test and reduce overall flake surface.
  • Test-id locators throughout (filter-popover, filter-item, filter-term, filter-count, table-first-cell, clear-all-filters, filters) replace positional and text-only matches.
  • Shared filter helpers extracted to e2e/features/common/filters.ts so both anvil-cmg and anvil-catalog specs use the same primitives. Generic helpers (escapeRegExp) live in e2e/features/common/utils.ts.
  • Option clicks use dispatchEvent("click") (matches the existing sidebar-button pattern; avoids WebKit click swallowing).
  • Cross-facet popover assertions re-locate by name (counts can change → list re-sorts); within a single facet popover, positional locators are kept since the list doesn't reorder on selection.
  • Filter chip lookups scoped to .MuiChip-root inside the filters container, replacing brittle #sidebar-positioner text matches.
  • Consolidated 10 per-entity filter-presence/open tests into 2 (Files + Donors representatives) covering both strict-list match and per-filter open/close.

Cleanup in e2e/testFunctions.ts

  • Removed testFilterPresence, testFilterPersistence, testFilterCounts, testFilterTags, testClearAll and their now-orphaned private helpers (getNamedFilterOptionLocator, getFirstFilterOptionLocator, getNthFilterOptionLocator, getFirstNonEmptyFilterOptionInfo, MAX_FILTER_OPTIONS_TO_CHECK, FilterOptionNameAndLocator).
  • Demoted getMthRowNthColumnCellLocator and getFirstRowNthColumnCellLocator from export to internal const (still used internally by other helpers, no external callers).
  • Removed unused ANVIL_FILES_SELECTABLE_COLUMNS_BY_NAME from e2e/anvil/constants.ts.

Test plan

  • Type-check (npx tsc --noEmit) clean.
  • Prettier clean.
  • Lint clean (only pre-existing TODO warnings).
  • Local e2e: BioSamples filter-tag test passes on chromium, firefox, and webkit.
  • Local e2e: Clear All passes after switching to file-level facets (File Format + Dataset).
  • CI runs full e2e suite across browsers — verify no regressions in the other anvil-cmg specs and the refactored anvil-catalog spec.

Closes #4800

@frano-m frano-m requested a review from Copilot May 5, 2026 12:09
@frano-m frano-m marked this pull request as ready for review May 5, 2026 12:09
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 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.ts around shared filter helpers and more stable locators.
  • Extracts reusable filter and regex helpers into e2e/features/common/filters.ts and e2e/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.

Comment thread e2e/anvil/anvil-filters.spec.ts Outdated
Comment thread e2e/anvil/anvil-filters.spec.ts Outdated
Comment thread e2e/anvil/anvil-filters.spec.ts
Comment thread e2e/testFunctions.ts
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>
frano-m and others added 2 commits May 5, 2026 09:20
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>
@NoopDog NoopDog force-pushed the fran/4800-flaky-anvil-cmg-filter-test branch from f39d399 to e2395cc Compare May 5, 2026 13:20
@NoopDog NoopDog merged commit c09bb88 into main May 5, 2026
3 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 anvil-cmg biosamples filter-tag e2e test

3 participants