Skip to content

[AnVIL Catalog] Fix flaky e2e test: deselecting filters through Search all Filters textbox #4751

@frano-m

Description

@frano-m

Description

The e2e test Check that deselecting filters through the "Search all Filters" textbox works correctly on the Workspaces tab is flaky.

Test file: e2e/anvil-catalog/anvilcatalog-filters.spec.ts:66
Helper: e2e/testFunctions.ts:797 (testDeselectFiltersThroughSearchBar)

Failure

The test expects a checkbox to be checked after selecting a filter, but the checkbox is still unchecked when the assertion runs. This suggests a race condition — the filter selection hasn't completed before the assertion fires.

Error: expect(locator).toBeChecked() failed

Locator:  getByRole('button').filter({ hasText: /^Consortia Access Only\s*\d+\s*/ })
          .filter({ has: getByRole('checkbox') }).getByRole('checkbox')
Expected: checked
Received: unchecked
Timeout:  15000ms

The locator resolves 19 times during the timeout but the checkbox remains unchecked, indicating the prior click to check the box may not have registered or completed.

Possible fixes

  • Add a waitFor or stability check after clicking the checkbox before asserting toBeChecked()
  • Ensure the filter panel is fully loaded before interacting with checkboxes
  • Increase retry/timeout if the filter state update is async

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions