mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 01:10:02 +02:00
- Configure Playwright to use 50% workers in CI for better resource utilization - Limit CI browser testing to Firefox only for faster execution - Implement 4-way test sharding in GitHub Actions for parallel execution - Add comprehensive caching for Playwright browsers and artifacts - Set 10-minute timeout for Playwright test jobs - Maintain full browser coverage (Chrome, Firefox, Safari) for local development
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
|
|
/**
|
|
* Read environment variables from file.
|
|
* https://github.com/motdotla/dotenv
|
|
*/
|
|
// import dotenv from 'dotenv';
|
|
// import path from 'path';
|
|
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
|
|
/**
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './src/tests',
|
|
testIgnore: ['**.test.ts'],
|
|
fullyParallel: true,
|
|
forbidOnly: Boolean(process.env.CI),
|
|
retries: process.env.CI ? 2 : 0,
|
|
/* Remove worker limitation in CI for better sharding performance */
|
|
workers: process.env.CI ? '50%' : undefined,
|
|
reporter: process.env.CI ? [['github'], ['html']] : 'html',
|
|
use: {
|
|
baseURL: 'http://localhost:3000',
|
|
trace: 'on-first-retry',
|
|
},
|
|
|
|
/* Configure projects for major browsers */
|
|
projects: [
|
|
...(process.env.CI
|
|
? [
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
]
|
|
: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
{
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
]),
|
|
],
|
|
|
|
/* Run your local dev server before starting the tests */
|
|
webServer: {
|
|
command: process.env.CI ? 'pnpm run start' : 'pnpm run dev',
|
|
url: 'http://localhost:3000',
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
})
|