[Feature]: Top level HTML report metadata
🚀 Feature Request
I'd like to request a method to be able to add metadata to the top level html report page.
We currently add data into tests using testInfo.annotations.push() for test level html reports, but we'd like to add some data into the top level html report.
I've looked at testProject.metadata but this only seems to be for third party reporters and doesn't have a way to display it on the Playwright report itself.
Potential idea:
If there was something like testProject.reportData, data could be passed from a project to an area in the html report.
Example
No response
Motivation
Being able to add extra data to a test report would be very powerful for anyone reading it.
It would be very useful to have the ability to add metadata to the top-level HTML report page.
As an example, it would be beneficial to be able to include details about the system under test, such as version, configuration, and other relevant context. This would provide a clear overview for anyone reading the report, allowing them to understand the context before diving into specific test results.
Only certain fields are allowed in the metadata object.
The working example:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: 'html',
metadata: {
'revision.id': 'adcb0c51debdbe96a6a836e2ead9d40a859f6438',
'revision.author': 'John Smith',
'revision.email': '[email protected]',
'revision.subject': 'Acceptance tests',
'revision.timestamp': Date.now(),
'revision.link': 'https://github.com/microsoft/playwright/pull/12734',
'ci.link': 'https://github.com/microsoft/playwright/actions/workflows/tests_primary.yml',
'timestamp': Date.now(),
},
});
I've made a deeper research here.
Resolved by #34517.