diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 5b89e62b88..5515252b39 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -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. +On Github Actions, this feature is enabled by default. + **Usage** ```js title="playwright.config.ts" diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index ab23b480b2..a31bb858d5 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1367,6 +1367,8 @@ interface TestConfig { * * 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** * * ```js diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts index d30d7f3e9d..acfd4cd187 100644 --- a/tests/playwright-test/reporter-html.spec.ts +++ b/tests/playwright-test/reporter-html.spec.ts @@ -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 }) => { const result = await runInlineTest({ 'playwright.config.ts': `