playwright-test-workflow
Version:
Global test workflow package for Playwright with custom reporters
46 lines (41 loc) • 1.17 kB
JavaScript
// @ts-check
const { defineConfig, devices } = require('@playwright/test');
module.exports = defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html'],
['list'],
['json', { outputFile: 'test-results/test-results.json' }],
['junit', { outputFile: 'test-results/test-results.xml' }],
['playwright-test-workflow/reporters/text-reporter.js', { outputFile: 'test-results/test-results.txt' }],
['playwright-test-workflow/reporters/html-reporter.js', { outputDir: 'test-results' }],
['line']
],
use: {
baseURL: 'http://localhost:3000', // Change as needed
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
webServer: {
command: 'npm start', // Change as needed
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});