Skip to content

fix(test): avoid dev matchers clobbering stable runner in reporter tests#40187

Open
yury-s wants to merge 1 commit intomicrosoft:mainfrom
yury-s:fix-reporter-html-toMatchAriaSnapshot
Open

fix(test): avoid dev matchers clobbering stable runner in reporter tests#40187
yury-s wants to merge 1 commit intomicrosoft:mainfrom
yury-s:fix-reporter-html-toMatchAriaSnapshot

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented Apr 13, 2026

Summary

  • After updating the stable test runner to 1.60.0-alpha-2026-04-13, all toMatchAriaSnapshot calls in reporter-html.spec.ts and reporter-blob.spec.ts fail with toMatchAriaSnapshot() must be called during the test.

Root cause: Both test files imported startHtmlReportServer from ../../packages/playwright/lib/runner. This transitively loaded the dev code's matchers/expect.js bundle (via runner → common → matchers/expect). Because jest-expect stores matchers on globalThis[Symbol.for("$$jest-matchers-object")], the dev matchers overwrote the stable test runner's matchers. When toMatchAriaSnapshot was later called, it executed the dev copy which references the dev code's expectConfig() — a module-level singleton where testInfo was never set (only the stable runner's worker sets it on its own copy). This was exposed by a120dec which changed toMatchAriaSnapshot from using globals.currentTestInfo() (a shared global) to expectConfig().testInfo (module-specific singleton).

Fix: Replace the runner import with a lightweight startHtmlReportServer helper in playwright-test-fixtures.ts that only depends on playwright-core's HttpServer — no matchers loaded.

Closes #40187

Stop importing startHtmlReportServer from packages/playwright/lib/runner
in reporter-html and reporter-blob tests. Instead, export a lightweight
copy from playwright-test-fixtures that only depends on playwright-core
HttpServer.
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

7 failed
❌ [chrome] › mcp/autowait.spec.ts:19 › racy navigation destroys context @mcp-windows-latest
❌ [firefox] › mcp/cli-config.spec.ts:80 › context options with UTF-8 BOM @mcp-windows-latest
❌ [firefox] › mcp/cli-core.spec.ts:123 › uncheck @mcp-windows-latest
❌ [firefox] › mcp/cli-core.spec.ts:267 › partial snapshot @mcp-windows-latest
❌ [firefox] › mcp/cli-core.spec.ts:283 › partial snapshot by ref @mcp-windows-latest
❌ [firefox] › mcp/cli-core.spec.ts:319 › eval --raw with error @mcp-windows-latest
❌ [firefox] › mcp/cli-core.spec.ts:326 › snapshot --raw @mcp-windows-latest

1 flaky ⚠️ [chrome] › mcp/cdp.spec.ts:24 › cdp server `@mcp-windows-latest`

6513 passed, 382 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › playwright.artifacts.spec.ts:232 › should work with screenshot: only-on-failure & fullPage @ubuntu-latest-node22

10 flaky ⚠️ [chromium-library] › library/video.spec.ts:724 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:724 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-set-input-files.spec.ts:38 › should upload a folder `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/browsertype-connect.spec.ts:776 › launchServer › should upload a folder `@webkit-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-attachments.spec.ts:176 › attachments from inside boxed fixture should be visible `@ubuntu-latest-node20`
⚠️ [playwright-test] › ui-mode-test-attachments.spec.ts:176 › attachments from inside boxed fixture should be visible `@macos-latest-node20`
⚠️ [playwright-test] › ui-mode-test-attachments.spec.ts:176 › attachments from inside boxed fixture should be visible `@ubuntu-latest-node24`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:160 › should format console messages in page `@ubuntu-latest-node22`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:160 › should format console messages in page `@windows-latest-node20`

39173 passed, 846 skipped


Merge workflow run.

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.

2 participants