Skip to content

feat(junit): add addFileAttribute and fileRoot options - #44107

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-44099
Nov 13, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-44099

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • New JUnit reporter option addFileAttribute (env PLAYWRIGHT_JUNIT_ADD_FILE_ATTRIBUTE) writes a file attribute on each <testcase>, with forward slashes. Off by default, so existing output does not change.
  • New option fileRoot (env PLAYWRIGHT_JUNIT_FILE_ROOT) sets the directory that file is relative to, for example the repository root in a monorepo. The default is the config directory. The option resolves against the config directory, the env var wins and resolves against cwd.

Fixes #44099

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🔴 The PR causes two Windows test failures; the MCP failures are pre-existing

Hi, I'm the Playwright bot. I checked the failures for 5c530b62d747.

Details

Covers MCP run 43500065202 and tests 1 run 43500065266, both on this PR head.

Caused by this PR

  • reporter-junit.spec.ts:350, “should add file attribute relative to config directory”, in both created and merged on Windows: the new assertion at line 370 expects classname to be auth/a.test.js, but receives auth\a.test.js. The existing classname uses platform-specific separators; only the new file attribute is normalized. Change the classname expectation to path.join('auth', 'a.test.js'), using the existing import. Keep the file expectation as e2e/auth/a.test.js.

Pre-existing flake / infra

All three [chrome] failures below also occur on main at 5127ad8a9417 in run 43476340227, on the same mcp-ubuntu-latest-chrome bot, with the same errors:

  • mcp/crash.spec.ts:31, “reports the navigation error, then resets and logs the crash”: 30-second timeout while waiting for recovery.
  • mcp/crash.spec.ts:58, “lists only one tab”: 30-second timeout and Error: Not connected.
  • mcp/crash.spec.ts:79, “marks non-current crashed tab in the tab list”: 30-second timeout and Error: Not connected.

These are pre-existing Chrome crash-recovery failures, not caused by this PR. MCP uses dot, blob and parquet reporters, not the JUnit reporter changed here.

Checked the failures on Linux by the Playwright bot - agent run

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🔴 The PR causes both Windows failures

Hi, I'm the Playwright bot. I checked the tests 1 failures for 5c530b62d747; the earlier verdict is confirmed.

Details

Covers run 43500065266.

Caused by this PR

  • reporter-junit.spec.ts:350, “should add file attribute relative to config directory”, in both created and merged on Windows. The new assertion at line 370 expects classname="auth/a.test.js", but the failed job receives auth\a.test.js. The existing classname retains platform-specific separators; only the new file attribute is normalized. The logged XML already has the correct file="e2e/auth/a.test.js".

Use the existing path import to fix the expectation:

expect(testcase['$']['classname']).toBe(path.join('auth', 'a.test.js'));

Keep the file expectation unchanged. The MCP failures are in a separate run and already have a verdict above.

Checked the failures on Linux by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) marked this pull request as draft November 13, 2026 21:09
@yury-s Yury Semikhatsky (yury-s) changed the title feat(junit): add addFileAttribute option feat(junit): add addFileAttribute and fileRoot options Nov 13, 2026
@yury-s
Yury Semikhatsky (yury-s) marked this pull request as ready for review November 13, 2026 21:45
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5 failed
❌ [chrome] › mcp/crash.spec.ts:31 › crash recovery › reports the navigation error, then resets and logs the crash @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:58 › crash recovery › lists only one tab @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:79 › crash recovery › marks non-current crashed tab in the tab list @mcp-ubuntu-latest-chrome
❌ [chromium] › mcp/http.spec.ts:92 › http transport browser lifecycle (isolated) @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/sse.spec.ts:196 › sse transport browser lifecycle (persistent) @mcp-ubuntu-latest-chromium

5230 passed, 631 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 All five MCP failures are pre-existing

Hi, I'm the Playwright bot. I checked the MCP failures for acd3899a3837; none is caused by this PR.

Details

Covers MCP run 43512145123, reported in merge run 43516217330.

The changes are limited to the JUnit reporter, its types, documentation and tests. MCP uses dot, blob and parquet reporters, not JUnit.

Pre-existing flake / infra

  • [chrome] mcp/crash.spec.ts:31, :58, :79 — “reports the navigation error, then resets and logs the crash”, “lists only one tab”, and “marks non-current crashed tab in the tab list”. All three fail on Linux main at 0ad21f1d34e4 in job 132073184367, with the same 30-second recovery timeout and Not connected errors.
  • [chromium] mcp/http.spec.ts:92, “http transport browser lifecycle (isolated)” — the same 30-second timeout occurs on Linux main at 0921375af7db in job 130863675856.
  • [chromium] mcp/sse.spec.ts:196, “sse transport browser lifecycle (persistent)” — localStorage.a returns undefined instead of "42". The identical assertion fails on Linux main at 8534271f0413 in job 131631485067.

This verdict covers the MCP run only; the earlier Windows JUnit verdict concerns the previous PR head.

Checked the failures on Linux by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › reporter-junit.spec.ts:350 › created › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22
❌ [playwright-test] › reporter-junit.spec.ts:350 › merged › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22

23644 passed, 716 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🔴 The PR causes both Windows failures

Hi, I'm the Playwright bot. I checked the tests 1 failures for acd3899a3837; the path-separator assertion still fails.

Details

Covers run 43512145191.

Caused by this PR

  • reporter-junit.spec.ts:350, “should add file attribute relative to fileRoot”, in both created and merged on Windows. In the failed job, line 374 expects classname="auth/a.test.js" but receives auth\a.test.js. The existing classname keeps platform-specific separators; only the new file attribute is normalized. The logged file="src/auth/a.test.js" is correct.

Use the existing path import:

expect(byDefault['classname']).toBe(path.join('auth', 'a.test.js'));

Keep the file expectations unchanged. The MCP failures on this head already have a separate verdict above.

Checked the failures on Linux by the Playwright bot - agent 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.

[Feature]: JUnit reporter option to add a file attribute to <testcase>

3 participants