playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Top level HTML report metadata

Open cctui-dev opened this issue 1 year ago • 1 comments

🚀 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.

cctui-dev avatar Jun 24 '24 09:06 cctui-dev

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.

awha86 avatar Jun 28 '24 08:06 awha86

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.

vitalets avatar Dec 19 '24 18:12 vitalets

Resolved by #34517.

dgozman avatar Feb 23 '25 07:02 dgozman

Resolved by #34517.

Custom fields in metadata ❤️

vitalets avatar Feb 23 '25 10:02 vitalets