Skip to content

test(e2e): keep axe from crashing Playwright's Firefox build - #845

Merged
JuroOravec merged 2 commits into
mainfrom
fix/firefox-e2e-crashes
Nov 23, 2026
Merged

JuroOravec merged 2 commits into
mainfrom
fix/firefox-e2e-crashes

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Refs #843 (group 1: the Firefox page crashes). The other groups in the issue are handled separately.

What crashed

Playwright 1.65 ships Firefox 159 (build 1572). That build crashes the page's content process (signal 11) when both the page's own scripts and Playwright read the same element's ARIA reference properties, such as ariaLabelledByElements. The order of the two reads does not matter.

  • axe-core 4.13 reads these properties in the page.
  • Playwright reads them when a test calls get_by_role(..., name=...) or get_by_label.

So every Firefox test that ran axe and then found an element by name, or the other way round, crashed the page. The smallest reproduction is a <div role="dialog" aria-labelledby="t">: call page.get_by_role("dialog", name=...), then evaluate el.ariaLabelledByElements in the page.

Evidence

  • The Firefox crashes began when uv.lock moved Playwright from 1.64.1 to 1.65.0 (cd45608). The 2026-11-09 weekly run, on Firefox build 1555, had no crashes. The 2026-11-16 and 2026-11-23 runs, on build 1572, crashed in the same five tests each time. So the crash happens on every run, not now and then.
  • The crash reproduces locally every time, on macOS with build 1572. Bisecting axe's rules, then tracing DOM calls, pointed to the ariaLabelledByElements read.
  • Playwright 1.65.2, the latest release, still ships build 1572, so upgrading does not help yet.
  • The causes listed in the issue, runner memory, /dev/shm and too many open pages, are ruled out: the examples job crashed with a single page in a single browser.

Fix

The axe helpers now delete every aria*Element(s) property from the page's Element.prototype before axe runs, in Firefox only. Axe then falls back to the aria-* attributes, which give the same answer because Citry UI never sets these references from JavaScript. Playwright works in its own copy of the DOM classes, so its role queries are not affected.

  • citry_ui/quality/accessibility.py: the guard runs inside axe_rule_exclusions_script(), which every Citry UI axe test already runs before axe.run.
  • examples/_internal/qualify.py: the examples axe helper gets the same guard. That tool environment does not install citry_ui, so the script is copied there.
  • A new e2e test checks two things: after the guard, axe still follows aria-labelledby, and the page survives a name query by role. In Firefox the test fails without the guard.

The comments say to remove the guard once Playwright's Firefox build no longer crashes.

Verification

  • Cross-browser e2e on this branch, run https://github.com/citry-dev/citry/actions/runs/45249547095, job e2e (firefox): 0 page crashes. Result: 4 failed, 1838 passed. The 2026-11-23 run had 5 crashes: 10 failed, 1831 passed.
  • The 4 remaining Firefox failures have other causes:
  • Locally, in Firefox: the alert dialog, context menu, command palette and scenario catalog tests pass. examples._internal.qualify --project demo-project-board --browser firefox crashes without the change and passes with it. CI cannot check that path in Firefox before the next scheduled run, because a manual run of the examples workflow uses Chromium only.
  • ruff check, ruff format --check, and mypy pass on the changed files.

Not fixed here

test_csplitbutton_examples_e2e.py::test_layers_example_logs_menu_actions_and_opens_the_dialog_for_provenance[firefox] is listed under group 1 in the issue, but it is a Locator.click timeout, not a crash. It also failed on 2026-11-09, before the Playwright upgrade. In Firefox the CMenu submenu picks data-citry-menu-side="inline-start" and opens at x = -618, outside the viewport. In Chromium it opens on the inline-end side at x = 418. The side comes from choosePlacement in cmenu.py. This is a component placement bug and needs its own change.

Versioning

Test tooling only. citry_ui.quality is excluded from the published wheel and examples/_internal is not published, so this needs no changelog entry and touches nothing the 1.x promise covers.

🤖 Generated with Claude Code

JuroOravec and others added 2 commits November 23, 2026 20:29
Playwright 1.65 ships Firefox 159 (build 1572), which crashes the page
when both the page's own scripts and Playwright read an element's ARIA
reference properties, such as `ariaLabelledByElements`. Axe 4.13 reads
them in the page, and Playwright reads them for `get_by_role(name=...)`
and `get_by_label`, so the Firefox tests that ran axe and then found an
element by name lost the page.

The axe helpers now remove those properties from the page's
`Element.prototype` in Firefox before axe runs. Axe then reads the
`aria-*` attributes, which give the same answer because Citry UI sets no
references from JavaScript. A new test checks that axe still follows
`aria-labelledby` after the guard and that the page survives.

Refs #843

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit 51bf459 into main Nov 23, 2026
34 checks passed
@JuroOravec
JuroOravec deleted the fix/firefox-e2e-crashes branch November 23, 2026 20:47
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.

1 participant