diff --git a/tests/playwright-test/ui-mode-metadata.spec.ts b/tests/playwright-test/ui-mode-metadata.spec.ts index 085655ba87..25211f62e8 100644 --- a/tests/playwright-test/ui-mode-metadata.spec.ts +++ b/tests/playwright-test/ui-mode-metadata.spec.ts @@ -14,22 +14,43 @@ * limitations under the License. */ -import { test } from './ui-mode-fixtures'; +import { test, expect } from './ui-mode-fixtures'; -test('should display git info metadata', async ({ runUITest }) => { - const { page } = await runUITest({ +const reporter = ` + class Reporter { + onBegin(config, suite) { + console.log(JSON.stringify(config.metadata, null, 2)); + } + + printsToStdio() { + return true; + } + } + module.exports = Reporter; +`; + +test('should render html report git info metadata', async ({ runUITest }) => { + const { page, testProcess } = await runUITest({ + 'reporter.ts': reporter, 'playwright.config.ts': ` import { defineConfig } from '@playwright/test'; export default defineConfig({ populateGitInfo: true, + reporter: './reporter.ts', }); `, 'a.test.js': ` import { test, expect } from '@playwright/test'; test('should work', async ({}) => {}); ` + }, { + BUILD_URL: 'https://playwright.dev', }); - await page.getByTitle('Run all').click(); - // todo: what to check? + await page.getByTitle('Run all').click(); + await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)'); + + // 1. testProcess.output is not populated with console.log from reporter + // 2. even with PWTEST_DEBUG=1 output contains unpopulated metadata: { actualWorkers: 1 } + expect(testProcess.output).toContain(`"ci.link": "https://playwright.dev"`); });