diff --git a/assets/playwright-ct.config.js b/assets/playwright-ct.config.js index 881142e..f6fd510 100644 --- a/assets/playwright-ct.config.js +++ b/assets/playwright-ct.config.js @@ -17,7 +17,7 @@ module.exports = defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: process.env.CI ? [['list', { printOnlyFailures: true }], ['html']] : 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ diff --git a/assets/playwright-ct.config.ts b/assets/playwright-ct.config.ts index b89cefa..d6d5757 100644 --- a/assets/playwright-ct.config.ts +++ b/assets/playwright-ct.config.ts @@ -16,7 +16,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: process.env.CI ? [['list', { printOnlyFailures: true }], ['html']] : 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ diff --git a/assets/playwright.config.js b/assets/playwright.config.js index 3e2be33..89ac209 100644 --- a/assets/playwright.config.js +++ b/assets/playwright.config.js @@ -21,7 +21,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: process.env.CI ? [['list', { printOnlyFailures: true }], ['html']] : 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('')`. */ diff --git a/assets/playwright.config.ts b/assets/playwright.config.ts index 1977879..b0f8eb3 100644 --- a/assets/playwright.config.ts +++ b/assets/playwright.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: process.env.CI ? [['list', { printOnlyFailures: true }], ['html']] : 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('')`. */ diff --git a/tests/integration.spec.ts b/tests/integration.spec.ts index ff0843d..9783371 100644 --- a/tests/integration.spec.ts +++ b/tests/integration.spec.ts @@ -27,6 +27,25 @@ const validGitignore = [ '/playwright/.auth/' ].join('\n'); +for (const language of ['TypeScript', 'JavaScript'] as const) { + for (const componentTesting of [false, true]) { + test(`should configure failures-only CI reporting for ${language} ${componentTesting ? 'component' : 'end-to-end'} tests`, async ({ run, dir }) => { + await run(componentTesting ? ['--ct'] : [], { + language, + testDir: 'tests', + installGitHubActions: false, + installPlaywrightDependencies: false, + installPlaywrightBrowsers: false, + framework: componentTesting ? 'react' : undefined, + }); + const extension = language === 'TypeScript' ? 'ts' : 'js'; + const file = componentTesting ? `playwright-ct.config.${extension}` : `playwright.config.${extension}`; + const config = fs.readFileSync(path.join(dir, file), 'utf8'); + expect(config).toContain("reporter: process.env.CI ? [['list', { printOnlyFailures: true }], ['html']] : 'html',"); + }); + } +} + test('should generate a project in the current directory', async ({ run, dir, packageManager }) => { test.skip(packageManager === 'yarn-classic' || packageManager === 'yarn-berry'); test.slow();