Skip to content

Commit 96b61fa

Browse files
author
DavidQ
committed
Ensure Playwright coverage aggregates across multiple tools including Palette Manager - PR_26126_059-playwright-coverage-multi-tool-verification
1 parent c112342 commit 96b61fa

3 files changed

Lines changed: 70 additions & 54 deletions

File tree

docs/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
Playwright V8 Coverage Report
22

3-
PR: PR_26126_058-playwright-coverage-include-palette-manager
3+
PR: PR_26126_059-playwright-coverage-multi-tool-verification
44
Coverage source: Playwright/Chromium built-in V8 coverage.
5-
Coverage scope: all collected runtime JavaScript under src/, tools/, and common/.
5+
Coverage scope: all repo-relative browser JavaScript collected by Playwright/Chromium V8 coverage.
66
Dependencies: no new npm packages.
77
Thresholds: none enforced.
88
Note: coverage is an advisory baseline only for this PR.
99
Note: line counts are V8 range-based and advisory; function counts show partial module exercise where available.
1010
Note: entry percentages use function coverage when available, otherwise line coverage.
11+
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
12+
13+
Exercised tool entry points detected:
14+
(84%) Preview Generator V2 - exercised 19 runtime JS files
15+
(49%) Palette Manager - exercised 12 runtime JS files
16+
(0%) Workspace V2 - not exercised by this Playwright run
17+
(0%) Workspace Manager - not exercised by this Playwright run
1118

1219
Changed runtime JS files covered:
1320
(100%) none changed - no changed runtime JS files
@@ -63,6 +70,7 @@ Files with executed line/function counts where available:
6370
(38%) src/engine/camera/Camera3D.js - executed lines 48/48; executed functions 3/8
6471
(38%) tools/palette-manager-v2/modules/PaletteValidationService.js - executed lines 88/88; executed functions 3/8
6572
(39%) tools/palette-manager-v2/modules/PaletteManagerApp.js - executed lines 934/934; executed functions 43/110
73+
(40%) samples/phase-01/0102/KeyboardMoveScene.js - executed lines 78/78; executed functions 2/5
6674
(40%) src/engine/scene/Scene.js - executed lines 12/12; executed functions 2/5
6775
(42%) tools/preview-generator-v2/PreviewGeneratorV2Capture.js - executed lines 477/477; executed functions 10/24
6876
(44%) tools/palette-manager-v2/controls/PaletteEditorControl.js - executed lines 225/225; executed functions 14/32
@@ -97,7 +105,10 @@ Files with executed line/function counts where available:
97105
(80%) src/engine/core/FrameClock.js - executed lines 32/32; executed functions 4/5
98106
(80%) src/engine/theme/accordionV2/accordionV2.js - executed lines 26/26; executed functions 4/5
99107
(81%) tools/preview-generator-v2/PreviewGeneratorV2App.js - executed lines 539/539; executed functions 47/58
108+
(82%) samples/shared/sampleDetailPageEnhancement.js - executed lines 471/471; executed functions 41/50
100109
(87%) tools/common/PaletteSortService.js - executed lines 103/103; executed functions 13/15
110+
(100%) samples/phase-01/0102/main.js - executed lines 23/23; executed functions 1/1
111+
(100%) samples/shared/numberUtils.js - executed lines 7/7; executed functions 1/1
101112
(100%) src/engine/audio/index.js - executed lines 15/15; executed functions 1/1
102113
(100%) src/engine/camera/index.js - executed lines 10/10; executed functions 1/1
103114
(100%) src/engine/config/index.js - executed lines 7/7; executed functions 1/1
@@ -136,4 +147,3 @@ Uncovered or low-coverage changed JS files:
136147

137148
Changed JS files considered:
138149
(0%) tests/helpers/playwrightV8CoverageReporter.mjs - changed JS file not collected as browser runtime coverage
139-
(0%) tests/playwright/PreviewGeneratorV2Baseline.spec.mjs - changed JS file not collected as browser runtime coverage
Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,28 @@
1-
# Preview Generator V2 Playwright Coverage - PR_26126_040
1+
PR_26126_059-preview-generator-v2-playwright-coverage
22

3-
Reviewed:
4-
- docs/dev/reports/preview_generator_v2_playwright_result.txt
5-
- tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
6-
- package.json
7-
8-
Coverage decision:
9-
- Preview Generator V2 is already explicitly covered by Playwright.
10-
- No duplicate Playwright test was added.
11-
12-
Existing Playwright coverage:
13-
- Launches tools/preview-generator-v2/index.html through the repo HTTP server.
14-
- Verifies the Preview Generator V2 app shell is visible.
15-
- Verifies tools/common/toolShellCommon.css is loaded.
16-
- Verifies the Preview Generator V2 heading is visible.
17-
- Verifies menuSample nav exists.
18-
- Verifies Generate Preview and Stop render and begin disabled.
19-
- Verifies Games is the default target source.
20-
- Verifies Paths or IDs input is visible.
21-
- Verifies Status block is visible.
22-
- Verifies common style declarations apply to header, accordion, app shell, and fullscreen layout targets.
23-
- Verifies Repo Destination accordion collapses and reopens with aria-expanded state changes.
24-
- Verifies no page errors during the launch/toggle path.
25-
26-
Broken hooks:
27-
- No broken Preview Generator V2 selectors, IDs, or Playwright hooks were found.
28-
- No UI behavior changes were made.
29-
30-
Validation gap fixed:
31-
- package.json did not define npm run test:workspace-v2.
32-
- Added test:workspace-v2 as the repository validation command for the existing Preview Generator V2 Playwright baseline.
33-
34-
Validation run:
35-
- node --check tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
36-
- npm run test:workspace-v2
3+
Playwright command:
4+
npm run test:workspace-v2
375

386
Result:
39-
- PASS: npm run test:workspace-v2 passed.
40-
- PASS: 1 Playwright test passed.
41-
42-
Scope guard:
43-
- No samples modified.
44-
- No schemas added or modified.
45-
- No start_of_day folders modified.
46-
- No duplicate Playwright tests added.
7+
PASS - 4 Playwright tests passed.
8+
9+
Coverage aggregation:
10+
- Coverage collection uses Playwright/Chromium V8 coverage.
11+
- Coverage is started and stopped for each page/tool loaded by the Playwright tests.
12+
- Coverage entries are merged into one report at docs/dev/reports/playwright_v8_coverage_report.txt.
13+
- The report is not limited to Preview Generator V2 and is not filtered to a specific folder.
14+
15+
Tool entry verification:
16+
- Preview Generator V2 runtime entries found: 19
17+
- Palette Manager runtime entries found: 12
18+
- Workspace V2 browser entry point was not exercised by this Playwright run; no tools/workspace-v2 index entry exists in the active tool surface.
19+
20+
Coverage report expectations:
21+
- Entries use the format `(xx%) <file-path> - <details>`.
22+
- Runtime rows are sorted by lowest coverage first.
23+
- The final report contains both Preview Generator V2 and Palette Manager runtime files, proving merged multi-tool coverage instead of last-page overwrite.
24+
25+
Manual test notes:
26+
- Open docs/dev/reports/playwright_v8_coverage_report.txt.
27+
- Confirm the Exercised tool entry points section lists Preview Generator V2 and Palette Manager as exercised.
28+
- Confirm the Files with executed line/function counts section contains both tools/preview-generator-v2/* and tools/palette-manager-v2/* entries.

tests/helpers/playwrightV8CoverageReporter.mjs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ export class PlaywrightV8CoverageReporter {
4646
const reportLines = [
4747
"Playwright V8 Coverage Report",
4848
"",
49-
"PR: PR_26126_058-playwright-coverage-include-palette-manager",
49+
"PR: PR_26126_059-playwright-coverage-multi-tool-verification",
5050
"Coverage source: Playwright/Chromium built-in V8 coverage.",
51-
"Coverage scope: all collected runtime JavaScript under src/, tools/, and common/.",
51+
"Coverage scope: all repo-relative browser JavaScript collected by Playwright/Chromium V8 coverage.",
5252
"Dependencies: no new npm packages.",
5353
"Thresholds: none enforced.",
5454
"Note: coverage is an advisory baseline only for this PR.",
5555
"Note: line counts are V8 range-based and advisory; function counts show partial module exercise where available.",
5656
"Note: entry percentages use function coverage when available, otherwise line coverage.",
57+
"Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.",
58+
"",
59+
"Exercised tool entry points detected:",
60+
...this.formatToolEntryPoints(coverageByPath),
5761
"",
5862
"Changed runtime JS files covered:",
5963
...this.formatChangedRuntimeCoverage(changedRuntimeJsFiles, coverageByPath),
@@ -105,7 +109,11 @@ export class PlaywrightV8CoverageReporter {
105109
}
106110
let pathname;
107111
try {
108-
pathname = new URL(url).pathname;
112+
const coverageUrl = new URL(url);
113+
if (coverageUrl.protocol.startsWith("http") && !["127.0.0.1", "localhost"].includes(coverageUrl.hostname)) {
114+
return null;
115+
}
116+
pathname = coverageUrl.pathname;
109117
} catch {
110118
return null;
111119
}
@@ -249,11 +257,6 @@ export class PlaywrightV8CoverageReporter {
249257

250258
formatCoverageTable(coverageByPath) {
251259
const records = [...coverageByPath.values()]
252-
.filter((record) => (
253-
record.repoPath.startsWith("tools/")
254-
|| record.repoPath.startsWith("src/")
255-
|| record.repoPath.startsWith("common/")
256-
))
257260
.sort((left, right) => this.compareCoverageEntries(
258261
{ filePath: left.repoPath, record: left },
259262
{ filePath: right.repoPath, record: right }
@@ -268,6 +271,27 @@ export class PlaywrightV8CoverageReporter {
268271
));
269272
}
270273

274+
formatToolEntryPoints(coverageByPath) {
275+
const toolEntryPoints = [
276+
{ name: "Preview Generator V2", prefix: "tools/preview-generator-v2/" },
277+
{ name: "Palette Manager", prefix: "tools/palette-manager-v2/" },
278+
{ name: "Workspace V2", prefix: "tools/workspace-v2/" },
279+
{ name: "Workspace Manager", prefix: "tools/workspace-manager/" }
280+
];
281+
return toolEntryPoints.map(({ name, prefix }) => {
282+
const records = [...coverageByPath.values()].filter((record) => record.repoPath.startsWith(prefix));
283+
if (!records.length) {
284+
return `(0%) ${name} - not exercised by this Playwright run`;
285+
}
286+
const executedFunctions = records.reduce((total, record) => total + record.executedFunctions.size, 0);
287+
const totalFunctions = records.reduce((total, record) => total + record.totalFunctions.size, 0);
288+
const percent = totalFunctions
289+
? Math.round((executedFunctions / totalFunctions) * 100)
290+
: 100;
291+
return `(${percent}%) ${name} - exercised ${records.length} runtime JS files`;
292+
});
293+
}
294+
271295
formatLowCoverageChangedFiles(changedRuntimeJsFiles, coverageByPath) {
272296
if (!changedRuntimeJsFiles.length) {
273297
return ["(100%) none changed - no changed runtime JS files"];

0 commit comments

Comments
 (0)