Skip to content

test(e2e): fix the named-element, script-order and i18n tests in Firefox and WebKit - #847

Merged
JuroOravec merged 2 commits into
mainfrom
fix/cross-browser-e2e
Nov 23, 2026
Merged

JuroOravec merged 2 commits into
mainfrom
fix/cross-browser-e2e

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Fixes groups 2 and 3 of #843: the weekly Cross-browser e2e run fails in WebKit and Firefox on three test problems. Group 1 (Firefox page crashes) is handled separately.

What failed and why

WebKit: test_vue_named_elements_e2e::test_data_chosen_ids_and_names_leave_the_runtime_working (all six variants). The page holds forms and other elements whose name hides document members such as querySelectorAll and dispatchEvent. Citry's runtime still started (wait_for_citry_ready passed), but in WebKit Playwright's own click code runs in the page and calls those document members, so page.click threw before the click was sent. The test now reads the button's position through Element.prototype and sends a plain page.mouse.click there. The click still reaches the button as a real mouse click, and the test still requires the Events call to finish and Citry's globals to be intact. With this change the test passes in WebKit, which shows Citry's runtime is not affected.

Firefox and WebKit: test_script_order_e2e::test_failed_other_origin_file_listed_twice_in_a_server_render_is_requested_once. On a server render the runtime adds a <link rel="preload"> hint for each script and then one <script> tag. Chromium hands the hint's failed result to the tag. Firefox and WebKit reuse a hint only while it is still loading, so when the hint has already failed they ask for the file again: locally WebKit always made 2 requests and Firefox 1 or 2 depending on timing. The runtime added only one tag, so the test was counting the hint. The test now records the script tags and preload hints the runtime adds and requires exactly one of each, keeps requests == 1 in Chromium, and allows 1 or 2 requests in Firefox and WebKit.

Firefox: test_i18n_vue_plugin_e2e::test_null_values_keep_the_server_text_through_runtime_transitions (both variants). The test served a page with non-ASCII text through route.fulfill(content_type="text/html"), with no charset, and Firefox logged "The character encoding of the document was not declared", which the test's console check counts. Citry's own responses already name the charset (RouteResponse adds ; charset=utf-8 to a text body), so only the test page was affected. Every route.fulfill in packages/py/citry/tests/e2e now sends text/html; charset=utf-8.

Checks

  • An independent reviewer checked that each test still proves what it was written to prove. With the runtime's duplicate-file check removed, the new script-order assertions fail in all three browsers.

  • Locally (Python 3.14, Playwright 1.65.0): all 13 changed files pass in Chromium, Firefox and WebKit (253 tests each). The fixed script-order test passed 5 runs in a row in each browser. The original i18n test reproduces the Firefox failure; the changed one passes.

  • ruff format and ruff check pass on the changed files.

  • Cross-browser e2e on this branch, first commit (the second commit changes only comments and a failure message): https://github.com/citry-dev/citry/actions/runs/45250350510. WebKit and Chromium pass. Firefox passes every test this PR fixes; its 6 remaining failures are the group 1 page crashes and the split-button timeout from the same group, which this PR leaves alone.

Versioning and changelog

Test-only change. Nothing the 1.x promise covers changes, and no changelog entry is needed.

Refs #843

🤖 Generated with Claude Code

JuroOravec and others added 2 commits November 23, 2026 20:34
…s pass in Firefox and WebKit

- The named-element test clicks the button with a plain mouse click at its
  position. In WebKit, Playwright's own click code runs in the page and calls
  `document.querySelectorAll` and `document.dispatchEvent`, which the test's
  data-chosen names hide. Citry's runtime still starts and finishes the Events
  call in WebKit.
- The script-order test counts the preload hint the runtime adds before the
  script tag. Firefox and WebKit ask again for the tag when the hint has
  already failed; the test now checks that the runtime adds one tag and one
  hint, and that the browser asks at most once for each.
- Browser tests that serve a page through `route.fulfill` send
  `text/html; charset=utf-8`, so Firefox does not log that the page's encoding
  was not declared.

Refs #843

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…me the click in the failure message

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit e68170d into main Nov 23, 2026
31 checks passed
@JuroOravec
JuroOravec deleted the fix/cross-browser-e2e 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