apply
This commit is contained in:
parent
42fa35a545
commit
a1854cb97b
|
|
@ -334,6 +334,8 @@ Whether to populate `'git.commit.info'` field of the [`property: TestConfig.meta
|
||||||
|
|
||||||
This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
||||||
|
|
||||||
|
On Github Actions, this feature is enabled by default.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
```js title="playwright.config.ts"
|
```js title="playwright.config.ts"
|
||||||
|
|
|
||||||
2
packages/playwright/types/test.d.ts
vendored
2
packages/playwright/types/test.d.ts
vendored
|
|
@ -1367,6 +1367,8 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
||||||
*
|
*
|
||||||
* This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
* This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
||||||
*
|
*
|
||||||
|
* On Github Actions, this feature is enabled by default.
|
||||||
|
*
|
||||||
* **Usage**
|
* **Usage**
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
|
|
|
||||||
|
|
@ -1242,42 +1242,6 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should include metadata on GH Actions', async ({ runInlineTest, writeFiles, showReport, page }) => {
|
|
||||||
const files = {
|
|
||||||
'example.spec.ts': `
|
|
||||||
import { test, expect } from '@playwright/test';
|
|
||||||
test('sample', async ({}) => { expect(2).toBe(2); });
|
|
||||||
`,
|
|
||||||
};
|
|
||||||
const baseDir = await writeFiles(files);
|
|
||||||
|
|
||||||
const execGit = async (args: string[]) => {
|
|
||||||
const { code, stdout, stderr } = await spawnAsync('git', args, { stdio: 'pipe', cwd: baseDir });
|
|
||||||
if (!!code)
|
|
||||||
throw new Error(`Non-zero exit of:\n$ git ${args.join(' ')}\nConsole:\nstdout:\n${stdout}\n\nstderr:\n${stderr}\n\n`);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
await execGit(['init']);
|
|
||||||
await execGit(['config', '--local', 'user.email', 'shakespeare@example.local']);
|
|
||||||
await execGit(['config', '--local', 'user.name', 'William']);
|
|
||||||
await execGit(['add', '*']);
|
|
||||||
await execGit(['commit', '-m', 'chore(html): make this test look nice']);
|
|
||||||
|
|
||||||
const result = await runInlineTest(files, { reporter: 'dot,html' }, {
|
|
||||||
GITHUB_ACTIONS: 'true',
|
|
||||||
PLAYWRIGHT_HTML_OPEN: 'never',
|
|
||||||
});
|
|
||||||
|
|
||||||
await showReport();
|
|
||||||
|
|
||||||
expect(result.exitCode).toBe(0);
|
|
||||||
await page.getByRole('button', { name: 'Metadata' }).click();
|
|
||||||
await expect(page.locator('.metadata-view')).toMatchAriaSnapshot(`
|
|
||||||
- text: /make this test look nice/
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should not include git metadata with populateGitInfo = false', async ({ runInlineTest, showReport, page }) => {
|
test('should not include git metadata with populateGitInfo = false', async ({ runInlineTest, showReport, page }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue