Windows CI: JUnit fileRoot tests expect POSIX separators in classname
Two cases in reporter-junit.spec.ts fail in the Windows test-runner job on main after #44107. The same failure also shows up on unrelated PRs such as #44220.
Reproduce
Check out 28c4b2e0ad892723c17c0b8d280207c1da670998 (Playwright 1.66.0-next) on Windows. After the repository's normal install and build, run:
npm run ttest -- reporter-junit.spec.ts -g "should add file attribute relative to fileRoot"
This test builds its own inline fixture. In both the direct and merged-report cases, the assertion at line 374 expects auth/a.test.js as the classname. The reporter supplies the native Windows path auth\a.test.js. The new file attribute is normalized separately.
I checked the most recent six Windows jobs on main and found the same two failures in each: latest, previous, earlier.
The existing triage on #44220 suggests a test-only fix. Use the existing path import to assert path.join('auth', 'a.test.js') for classname and keep the POSIX expectations for the new file attribute.
I can take this if it is open for a community contribution.
Hi, I'm the Playwright bot. I started triaging this issue on Windows: agent run
Hi, I'm the Playwright bot. I reproduced both failures on Windows.
This is a test-only path mismatch. On 1.66.0-next (ff7cf8ebdb38ed656559c41a4f1b82e5427921db), both direct and merged reports use auth\a.test.js for classname; only the new file attribute uses forward slashes. The proposed fix uses path.join('auth', 'a.test.js') in the existing assertion and keeps all file expectations unchanged.
Reproduction and checks
The existing should add file attribute relative to fileRoot test creates an inline test at packages/foo/src/auth/a.test.js with testDir: './src' and addFileAttribute: true. Its default report contains:
<testcase name="one" classname="auth\a.test.js" file="src/auth/a.test.js" time="0.004">
- Before the fix:
npm run ttest -- reporter-junit.spec.ts -g "should add file attribute relative to fileRoot" --workers=2 --reporter=line— both cases failed at theclassnameassertion. - After the fix:
npm run ttest -- reporter-junit.spec.ts reporter-json.spec.ts --workers=2 --reporter=line— 75 passed, 3 skipped, including both fileRoot cases and their option/environment checks. npm run buildandnpm run flintpassed. The first lint attempt needed Firefox and WebKit installed for documentation checks; it passed after installing them.
The failing cases do not use a browser. The reporter suites' browser-based attachment checks used Chromium on Windows. Linux and macOS were not run here. Reporter behavior is unchanged.
Draft PR: https://github.com/microsoft/playwright/pull/44232
Triaged on Windows by the Playwright bot - agent run