Skip to content

Fix flaky anvil-catalog filter deselection test#4771

Merged
NoopDog merged 2 commits intomainfrom
copilot/fix-anvil-filters-flakey-test
Apr 15, 2026
Merged

Fix flaky anvil-catalog filter deselection test#4771
NoopDog merged 2 commits intomainfrom
copilot/fix-anvil-filters-flakey-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

The "deselects filters through search bar" test was flaky because selectFirstOption used a positional .first() locator to assert selection state after clicking. When MUI re-sorts the filter list (selected items move position), .first() resolves to a different, unselected element — causing the assertion to fail intermittently.

Changes

  • Added namedPopoverFilterItem helper that locates a filter item in the open popover by display name (mirrors the existing namedFilterItem for the autocomplete popper)
  • Modified selectFirstOption to use namedPopoverFilterItem for the post-click selection assertion instead of the stale positional locator
// Before: positional locator re-evaluates to wrong element after list re-sort
await option.click();
await expectFilterItemSelected(option); // .first() may now point to a different item

// After: name-based locator is stable regardless of list ordering
await option.click();
await expectFilterItemSelected(namedPopoverFilterItem(page, name));

Known Issues

None.

Copilot AI linked an issue Apr 15, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix flakey test in anvil filters Fix flaky anvil-catalog filter deselection test Apr 15, 2026
Copilot AI requested a review from frano-m April 15, 2026 02:12
Copy link
Copy Markdown
Contributor

@frano-m frano-m left a comment

Choose a reason for hiding this comment

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

LGTM thanks @copilot.

@frano-m frano-m marked this pull request as ready for review April 15, 2026 02:25
@NoopDog NoopDog merged commit 7abc432 into main Apr 15, 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 anvil-filters flakey test

3 participants