Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: list fields allowed in metadata #34095

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vitalets
Copy link
Contributor

@vitalets vitalets commented Dec 19, 2024

Fixes #34094, #33831


Metadata that will be put directly to the test report serialized as JSON.
- type: ?<[Object]>
- `revision.id` ?<[string]> The unique identifier (e.g., hash or GUID) for the revision or commit that triggered the test run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not actually populated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavelfeldman could you elaborate more, what do you mean under "not actually populated"?
I've tried with the latest Playwright - all these fields are shown in the report:
image

@pavelfeldman
Copy link
Member

Are you using gitCommitInfo plugin? It is internal and can go away at any moment...

@vitalets
Copy link
Contributor Author

vitalets commented Dec 20, 2024

Are you using gitCommitInfo plugin? It is internal and can go away at any moment...

No. Just provided metadata explicitly in the config:

export default defineConfig({
  reporter: 'html',
  metadata: {
    'revision.id': 'adcb0c51debdbe96a6a836e2ead9d40a859f6438',
    'revision.author': 'Your Name',
    'revision.email': '[email protected]',
    'revision.subject': 'Acceptance tests',
    'revision.timestamp': Date.now(),
    'revision.link': 'https://github.com/microsoft/playwright',
    'ci.link': 'https://github.com/microsoft/playwright/actions/workflows/tests_primary.yml',
    'timestamp': Date.now(),
  }
});

@pavelfeldman
Copy link
Member

Ah, I see. Users won't know they need to do it, the actual type for the Metadata is Record<string, any> so that everyone could provide what they want. So these properties are a subject to change and the way they are rendered in html report should be based on reflection.

@vitalets
Copy link
Contributor Author

vitalets commented Dec 21, 2024

the actual type for the Metadata is Record<string, any> so that everyone could provide what they want.

Yeah, that's why I've decided to clarify the docs. Because when I provide custom properties to metadata, they do not appear in the HTML report, that is confusing (#31415, #33831). Also the provided example does not pass the TypeScript check. What can be improved as of now?

I can set more accurate type for Metadata here and use it in MetadataView instead of Metainfo type.
Or just add a note that Metadata is a subject to change, please don't use it now.

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.

[Docs]: Improve documentation for metadata
2 participants