Skip to content

[Feature]: Configurable default grouping for the HTML report ("Merge files" as a default) #41761

Description

@jonrohan

🚀 Feature Request

Let the HTML reporter's grouping default be set at report-generation time (via config, and/or a URL param), so a report can open already grouped by describe, i.e. the equivalent of the "Merge files" toggle being on, without each viewer flipping it by hand.

// playwright.config.ts
reporter: [['html', { groupBy: 'suite' }]]

Motivation

I have a monorepo where a lot of tests are generated inside a single shared spec file, and each unit is wrapped in test.describe('@scope/<package>'). In the merged HTML report every test collapses under that one file header, so I can't tell which package a failure belongs to at a glance.

The "Merge files" option (from #38870) already does exactly the grouping I want: it groups by describe, and the group header becomes my @scope/<package>. The catch is that it's a per-viewer setting stored in localStorage['mergeFiles'], so:

  • CI-published reports always open ungrouped, and every person has to know about and click "Merge files".
  • It can't be shared via a link (it's a stored setting, not a URL param).
  • There's no way to bake the default into the report we publish as an artifact.

What I'm asking for

A supported way to set the default grouping when the report is generated, e.g. an HtmlReporterOptions field (groupBy: 'file' | 'suite', defaulting to 'file' for back-compat), threaded into the report so it opens grouped. A URL param would be a nice bonus for sharing. The per-viewer toggle would still override it.

The plumbing looks mostly there already: createMergedFilesModel in reportView.tsx groups by test.path[0], gated behind useSetting('mergeFiles', ...). This would let the generated report seed that default.

(Note: #38870 was closed into #21202, which is broader metadata filtering/grouping. This is narrower, just making the existing "Merge files" grouping configurable as a default, so I'm filing separately. Happy to have it folded in if you'd prefer.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions