Skip to content

feat(html): add configurable groupBy for the HTML report#41762

Open
jonrohan wants to merge 1 commit into
microsoft:mainfrom
jonrohan:fix-41761
Open

feat(html): add configurable groupBy for the HTML report#41762
jonrohan wants to merge 1 commit into
microsoft:mainfrom
jonrohan:fix-41761

Conversation

@jonrohan

Copy link
Copy Markdown

In a monorepo we generate hundreds of tests inside one shared spec file, each wrapped in test.describe('@scope/<package>'). In the merged HTML report every test collapses under that single file header, so you can't tell which package a failure belongs to. The grouping I want already exists — it's the hidden mergeFiles localStorage toggle from #38870 — but it's per-viewer, can't be shared via link, and can't be baked into a CI-published report.

This promotes that capability to a supported, configurable feature.

What

  • New groupBy option on the html reporter: 'file' (default), 'suite', 'project', 'tag'. Threaded into the report JSON via HTMLReportOptions (plus a PLAYWRIGHT_HTML_GROUP_BY env override).
  • Visible "Group by" control in the report header, replacing the hidden mergeFiles setting.
  • Precedence: ?groupBy= URL param > per-viewer setting > config default > 'file'.
  • Generalized the old createMergedFilesModel into one groupBy-driven grouping function.

Why

CI-published reports can now open already grouped by describe/project/tag, and a grouping can be deep-linked. Default stays 'file', so existing reports and blob merge-reports render exactly as before.

Closes #41761

The report could already regroup tests by their top-level describe, but
it was gated behind the hidden localStorage 'mergeFiles' setting with no
way to reach it from config, URL, or a visible control.

Promote it to a supported feature: a 'groupBy' HtmlReporterOptions default
threaded into the report JSON, a visible 'Group by' control in the report
header, and a ?groupBy= URL param. Supports 'file' (default), 'suite',
'project', and 'tag'. Default stays 'file', so existing reports render
unchanged.

Fixes microsoft#41761
@jonrohan

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="GitHub"

@jonrohan jonrohan marked this pull request as ready for review July 14, 2026 02:32
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]: Configurable default grouping for the HTML report ("Merge files" as a default)

1 participant