chore: do not show other metadata in html report (#35001)
This commit is contained in:
parent
85c6405093
commit
ee2a5264ad
|
@ -71,8 +71,6 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
* HTML reporter now shows the contents of [`property: TestConfig.metadata`].
|
|
||||||
|
|
||||||
### Miscellaneous
|
### Miscellaneous
|
||||||
|
|
||||||
* New option `contrast` for methods [`method: Page.emulateMedia`] and [`method: Browser.newContext`] allows to emulate the `prefers-contrast` media feature.
|
* New option `contrast` for methods [`method: Page.emulateMedia`] and [`method: Browser.newContext`] allows to emulate the `prefers-contrast` media feature.
|
||||||
|
|
|
@ -23,6 +23,7 @@ import type { Metadata } from '@playwright/test';
|
||||||
import type { CIInfo, GitCommitInfo, MetadataWithCommitInfo } from '@testIsomorphic/types';
|
import type { CIInfo, GitCommitInfo, MetadataWithCommitInfo } from '@testIsomorphic/types';
|
||||||
import { CopyToClipboardContainer } from './copyToClipboard';
|
import { CopyToClipboardContainer } from './copyToClipboard';
|
||||||
import { linkifyText } from '@web/renderUtils';
|
import { linkifyText } from '@web/renderUtils';
|
||||||
|
import { SearchParamsContext } from './links';
|
||||||
|
|
||||||
class ErrorBoundary extends React.Component<React.PropsWithChildren<{}>, { error: Error | null, errorInfo: React.ErrorInfo | null }> {
|
class ErrorBoundary extends React.Component<React.PropsWithChildren<{}>, { error: Error | null, errorInfo: React.ErrorInfo | null }> {
|
||||||
override state: { error: Error | null, errorInfo: React.ErrorInfo | null } = {
|
override state: { error: Error | null, errorInfo: React.ErrorInfo | null } = {
|
||||||
|
@ -55,8 +56,9 @@ export const MetadataView: React.FC<{ metadata: Metadata }> = params => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const InnerMetadataView: React.FC<{ metadata: Metadata }> = params => {
|
const InnerMetadataView: React.FC<{ metadata: Metadata }> = params => {
|
||||||
|
const searchParams = React.useContext(SearchParamsContext);
|
||||||
const commitInfo = params.metadata as MetadataWithCommitInfo;
|
const commitInfo = params.metadata as MetadataWithCommitInfo;
|
||||||
const otherEntries = Object.entries(params.metadata).filter(([key]) => !ignoreKeys.has(key));
|
const otherEntries = searchParams.has('show-metadata-other') ? Object.entries(params.metadata).filter(([key]) => !ignoreKeys.has(key)) : [];
|
||||||
const hasMetadata = commitInfo.ci || commitInfo.gitCommit || otherEntries.length > 0;
|
const hasMetadata = commitInfo.ci || commitInfo.gitCommit || otherEntries.length > 0;
|
||||||
if (!hasMetadata)
|
if (!hasMetadata)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1193,7 +1193,6 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `
|
||||||
export default {
|
export default {
|
||||||
captureGitInfo: { commit: true },
|
captureGitInfo: { commit: true },
|
||||||
metadata: { foo: 'value1', bar: { prop: 'value2' }, baz: ['value3', 123] }
|
|
||||||
};
|
};
|
||||||
`,
|
`,
|
||||||
'example.spec.ts': `
|
'example.spec.ts': `
|
||||||
|
@ -1216,21 +1215,13 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
- list:
|
- list:
|
||||||
- listitem: "chore(html): make this test look nice"
|
- listitem: "chore(html): make this test look nice"
|
||||||
- listitem: /William <shakespeare@example\\.local>/
|
- listitem: /William <shakespeare@example\\.local>/
|
||||||
- list:
|
|
||||||
- listitem: "foo : value1"
|
|
||||||
- listitem: "bar : {\\"prop\\":\\"value2\\"}"
|
|
||||||
- listitem: "baz : [\\"value3\\",123]"
|
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should include commit metadata w/ CI', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
test('should include commit metadata w/ CI', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
||||||
const files = {
|
const files = {
|
||||||
'uncommitted.txt': `uncommitted file`,
|
'uncommitted.txt': `uncommitted file`,
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `export default {}`,
|
||||||
export default {
|
|
||||||
metadata: { foo: 'value1', bar: { prop: 'value2' }, baz: ['value3', 123] }
|
|
||||||
};
|
|
||||||
`,
|
|
||||||
'example.spec.ts': `
|
'example.spec.ts': `
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('sample', async ({}) => { expect(2).toBe(2); });
|
test('sample', async ({}) => { expect(2).toBe(2); });
|
||||||
|
@ -1256,21 +1247,13 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
- listitem:
|
- listitem:
|
||||||
- 'link "chore(html): make this test look nice"'
|
- 'link "chore(html): make this test look nice"'
|
||||||
- listitem: /William <shakespeare@example\\.local>/
|
- listitem: /William <shakespeare@example\\.local>/
|
||||||
- list:
|
|
||||||
- listitem: "foo : value1"
|
|
||||||
- listitem: "bar : {\\"prop\\":\\"value2\\"}"
|
|
||||||
- listitem: "baz : [\\"value3\\",123]"
|
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should include PR metadata on GHA', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
test('should include PR metadata on GHA', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
||||||
const files = {
|
const files = {
|
||||||
'uncommitted.txt': `uncommitted file`,
|
'uncommitted.txt': `uncommitted file`,
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `export default {}`,
|
||||||
export default {
|
|
||||||
metadata: { foo: 'value1', bar: { prop: 'value2' }, baz: ['value3', 123] }
|
|
||||||
};
|
|
||||||
`,
|
|
||||||
'example.spec.ts': `
|
'example.spec.ts': `
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('sample', async ({}) => { expect(2).toBe(2); });
|
test('sample', async ({}) => { expect(2).toBe(2); });
|
||||||
|
@ -1307,10 +1290,6 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
- listitem:
|
- listitem:
|
||||||
- link "My PR"
|
- link "My PR"
|
||||||
- listitem: /William <shakespeare@example.local>/
|
- listitem: /William <shakespeare@example.local>/
|
||||||
- list:
|
|
||||||
- listitem: "foo : value1"
|
|
||||||
- listitem: "bar : {\\"prop\\":\\"value2\\"}"
|
|
||||||
- listitem: "baz : [\\"value3\\",123]"
|
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2770,15 +2749,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
test('should show AI prompt', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
test('should show AI prompt', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
||||||
const files = {
|
const files = {
|
||||||
'uncommitted.txt': `uncommitted file`,
|
'uncommitted.txt': `uncommitted file`,
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `export default {}`,
|
||||||
export default {
|
|
||||||
metadata: {
|
|
||||||
foo: 'value1',
|
|
||||||
bar: { prop: 'value2' },
|
|
||||||
baz: ['value3', 123]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
`,
|
|
||||||
'example.spec.ts': `
|
'example.spec.ts': `
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('sample', async ({ page }) => {
|
test('sample', async ({ page }) => {
|
||||||
|
|
Loading…
Reference in New Issue