Skip to content

Tests: Fix server-rendered HTML in the router context fixture - #86513

Closed
ciampo wants to merge 1 commit into
trunkfrom
codex/router-html-server-fixture
Closed

ciampo wants to merge 1 commit into
trunkfrom
codex/router-html-server-fixture

Conversation

@ciampo

@ciampo ciampo commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #86416.

What?

Fix the router fixture so its context-sync test receives server-rendered HTML on the destination page.

Why?

Trunk CI fails because context JSON carries only the { "wpServerHtml": true } marker. It is not a server HTML token, so WordPress removes the element's content during directive processing.

How?

Use a derived state getter whose PHP implementation returns the trusted HTML token and whose JavaScript implementation reads the context value copied by callbacks.syncContext. Keep all existing test assertions unchanged.

Testing Instructions

  1. With the WordPress test environment running, run npm run test:e2e -- router-html-server.spec.ts --project=chromium --repeat-each=3.
  2. Confirm all nine checks pass. Before this change, the context-sync test receives an empty string instead of <p>Two</p> for the context element.

Testing Instructions for Keyboard

No interface changes. The existing tests exercise router navigation through the fixture's Next link.

Use of AI Tools

Codex authored this fixture fix and PR description and ran the verification. No human review is claimed.

@github-actions github-actions Bot added the [Package] E2E Tests /packages/e2e-tests label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

📦 Bundle size

Size Change: -66 B (0%)

Total Size: 8.63 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 545 kB -14 B (0%)
build/scripts/block-library/index.min.js 425 kB -19 B (0%)
build/scripts/customize-widgets/index.min.js 22.8 kB -4 B (-0.02%)
build/scripts/edit-site/index.min.js 378 kB -7 B (0%)
build/scripts/edit-widgets/index.min.js 29.1 kB +2 B (+0.01%)
build/scripts/editor/index.min.js 568 kB -10 B (0%)
build/scripts/media-utils/index.min.js 233 kB -9 B (0%)
build/scripts/notices/index.min.js 45.8 kB -5 B (-0.01%)

c2807e3 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f3963db trunk % Change
timeToFirstByte 48.95 ms +4.29% -1.53% 49.1 ms +3.67% -3.16% -0.31%
largestContentfulPaint 86 ms +6.98% -2.33% 84 ms +7.14% -4.76% 2.38%
lcpMinusTtfb 34.8 ms +21.7% -4.6% 33.3 ms +13.06% -5.26% 4.5%
wpBeforeTemplate 25 ms +6.24% -4.44% 24.76 ms +2.5% -2.42% 0.97%
wpTemplate 20.17 ms +4.71% -4.86% 20.44 ms +4.99% -6.02% -1.32%
wpTotal 45.03 ms +4.15% -1.55% 45.35 ms +3.88% -3.15% -0.71%
wpMemoryUsage 7.72 MB +0% -0% 7.69 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f3963db trunk % Change
timeToFirstByte 41.9 ms +2.39% -3.94% 40.65 ms +2.95% -2.58% 3.08%
largestContentfulPaint 96 ms +0% -4.17% 92 ms +0% -0% 4.35%
lcpMinusTtfb 52.8 ms +1.89% -1.99% 51.35 ms +1.46% -2.34% 2.82%
wpBeforeTemplate 22.06 ms +0.82% -2.72% 21.49 ms +4.61% -2.28% 2.65%
wpTemplate 16.17 ms +5.38% -6.62% 15.31 ms +6.99% -3.53% 5.62%
wpTotal 38.37 ms +3.18% -3.41% 37.49 ms +3.23% -2.8% 2.35%
wpMemoryUsage 6.41 MB +0% -0% 6.38 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f3963db trunk % Change
mediaProcessingJpeg 397.37 ms +1.37% -0.78% 389.43 ms +1.85% -1% 2.04%
mediaProcessingAvif 5770.09 ms +0.17% -0.13% 5743.71 ms +0.22% -0.38% 0.46%
mediaProcessingJpegToAvif 3926.43 ms +0.18% -0.46% 3926.02 ms +0.16% -0.23% 0.01%

media-upload

Metric f3963db trunk % Change
jpegUploadProcessing 1482.79 ms +33.2% -0.63% 1476.16 ms +1.95% -0.93% 0.45%
pngUploadProcessing 243.32 ms +1.93% -21.28% 240.04 ms +3.13% -1.77% 1.37%
largeJpegUploadProcessing 1465.02 ms +0.12% -1.39% 1456.34 ms +0.69% -0.21% 0.6%
multipleImageUploadProcessing 2078.24 ms +0.76% -1.48% 1592.26 ms +8.27% -0.42% 30.52%

post-editor

Metric f3963db trunk % Change
serverResponse 331.98 ms +6.75% -9.05% 312.15 ms +8.82% -5.36% 6.35%
firstPaint 298.04 ms +33.96% -7.37% 292.13 ms +30.54% -4.12% 2.02%
domContentLoaded 695.15 ms +10.06% -1.63% 690.48 ms +1.59% -1.1% 0.68%
loaded 695.97 ms +10.07% -1.62% 691.47 ms +1.57% -1.1% 0.65%
firstContentfulPaint 406.52 ms +16.26% -1.79% 406.61 ms +1.23% -1.95% -0.02%
firstBlock 1811.78 ms +4.16% -1.77% 1798.99 ms +0.39% -0.72% 0.71%
type 15.46 ms +12.87% -14.23% 15.87 ms +7.5% -10.46% -2.58%
typeWithoutInspector 16.61 ms +4.64% -9.03% 15.2 ms +4.28% -10.26% 9.28%
typeWithTopToolbar 21.21 ms +6.22% -4.62% 20.4 ms +6.42% -3.92% 3.97%
typeContainer 7.27 ms +10.32% -4.81% 7.51 ms +6.52% -5.19% -3.2%
focus 103.96 ms +3.91% -3.29% 95.67 ms +9.99% -2.74% 8.67%
firstFocus 236.91 ms +0% -0% 209.98 ms +0% -0% 12.83%
selectAll 345.54 ms +1.11% -3.83% 323.13 ms +0.34% -0.5% 6.94%
undo 25.45 ms +13.12% -5.19% 25.93 ms +6.94% -6.52% -1.85%
listViewOpen 63.58 ms +12.03% -3.93% 59.72 ms +15.09% -4.97% 6.46%
inserterOpen 34.96 ms +4.83% -4.12% 34.2 ms +8.77% -3.07% 2.22%
inserterHover 10.25 ms +7.8% -10.93% 9.39 ms +8.2% -8.84% 9.16%
inserterSearch 7.16 ms +13.41% -4.19% 7.46 ms +6.43% -8.18% -4.02%
loadPatterns 525.34 ms +4.88% -2.12% 505.67 ms +3.56% -2.83% 3.89%
wpTotal 323.06 ms +6.4% -9.35% 303.05 ms +8.76% -5.46% 6.6%
wpMemoryUsage 14.77 MB +0% -0% 14.74 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f3963db trunk % Change
serverResponse 453.04 ms +5.11% -4.97% 480.87 ms +0.74% -8.04% -5.79%
firstPaint 384.55 ms +1.23% -7.85% 378.63 ms +5.14% -11.93% 1.56%
domContentLoaded 863.92 ms +3.53% -0.84% 879.76 ms +3.65% -1.22% -1.8%
loaded 864.95 ms +3.55% -0.84% 881.04 ms +3.64% -1.22% -1.83%
firstContentfulPaint 499.05 ms +5.36% -1.78% 507.01 ms +1.31% -2.04% -1.57%
firstBlock 2630.39 ms +1.16% -1.32% 2654.23 ms +1.13% -0.31% -0.9%
type 19.73 ms +6.13% -5.68% 20.18 ms +4.66% -9.71% -2.23%
navigate 108.64 ms +3.99% -6.04% 109.44 ms +9.99% -1.39% -0.73%
loadPatterns 1394.3 ms +6.64% -19.18% 1240 ms +5.69% -13.47% 12.44%
loadPages 1022.68 ms +2.08% -3.28% 993.28 ms +5.34% -3.76% 2.96%
wpTotal 443.37 ms +5.23% -5.08% 471.2 ms +0.74% -8.36% -5.91%
wpMemoryUsage 12.79 MB +0% -0% 12.75 MB +0% -0% 0.27%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

c2807e3 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Navigates the items list via UP/DOWN arrow keys in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page Two')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByLabel('Page Two') with timeout 5000ms
  - waiting for getByLabel('Page Two')
    14 × locator resolved to <button type="button" tabindex="-1" aria-pressed="false" id="view-list-0-181-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-181-label" aria-describedby="view-list-0-181-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:146:49
Page List converts to Navigation Links with entity bindings in /test/e2e/specs/editor/blocks/navigation.spec.js, passed after 1 failed attempt.
Error: expect(locator).toContainText(expected) failed

Locator: getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ })
Expected substring: "test-page-1"
Received string:    "Link to:Cat/catPagePublished"
Timeout: 5000ms

Call log:
  - Expect "toContainText" getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ }) with timeout 5000ms
  - waiting for getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ })
    14 × locator resolved to <button type="button" aria-expanded="false" aria-haspopup="dialog" class="components-button link-preview-button is-next-40px-default-size is-secondary">…</button>
       - unexpected value "Link to:Cat/catPagePublished"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:1949:31
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
should place the caret at the click position when clicking a block that is not selected in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "First!",
+       "content": "First",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:952:41

c2807e3 Run

@ciampo ciampo self-assigned this Nov 9, 2026
@Mamaduka

Mamaduka commented Nov 9, 2026

Copy link
Copy Markdown
Member

Also trying to fix the same issue in #86511.

@ciampo ciampo added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Nov 9, 2026
@ciampo

ciampo commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Nice! I'll close this PR, and review yours

@ciampo ciampo closed this Nov 9, 2026
@Mamaduka
Mamaduka deleted the codex/router-html-server-fixture branch November 9, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] E2E Tests /packages/e2e-tests [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants