107 lines
2.4 KiB
JavaScript
107 lines
2.4 KiB
JavaScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright configuration for testing
|
|
* @see https://playwright.dev/docs/test-configuration
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
|
|
// Maximum time one test can run
|
|
timeout: 60 * 1000,
|
|
|
|
// Test execution settings
|
|
fullyParallel: false, // Run tests sequentially to avoid rate limiting
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: 1, // Single worker to avoid parallel requests
|
|
|
|
// Reporter configuration
|
|
reporter: [
|
|
['html'],
|
|
['list']
|
|
],
|
|
|
|
// Shared settings for all projects
|
|
use: {
|
|
// Base URL for tests
|
|
baseURL: 'https://www.google.com',
|
|
|
|
// Collect trace on first retry
|
|
trace: 'on-first-retry',
|
|
|
|
// Screenshot on failure
|
|
screenshot: 'only-on-failure',
|
|
|
|
// Video on failure
|
|
video: 'retain-on-failure',
|
|
|
|
// Timeout for actions (click, fill, etc)
|
|
actionTimeout: 10000,
|
|
|
|
// Navigation timeout
|
|
navigationTimeout: 30000,
|
|
|
|
// Locale and timezone
|
|
locale: 'en-CA',
|
|
timezoneId: 'America/Toronto',
|
|
|
|
// Geolocation (Toronto)
|
|
geolocation: { latitude: 43.6532, longitude: -79.3832 },
|
|
permissions: [],
|
|
|
|
// Color scheme
|
|
colorScheme: 'light',
|
|
|
|
// Extra HTTP headers
|
|
extraHTTPHeaders: {
|
|
'Accept-Language': 'en-CA,en-US;q=0.9,en;q=0.8',
|
|
},
|
|
},
|
|
|
|
// Configure projects for major browsers
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Disable some automation detection
|
|
launchOptions: {
|
|
args: [
|
|
'--disable-blink-features=AutomationControlled',
|
|
'--disable-features=IsolateOrigins,site-per-process',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
|
|
{
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
|
|
// Test against mobile viewports (optional)
|
|
// {
|
|
// name: 'Mobile Chrome',
|
|
// use: { ...devices['Pixel 5'] },
|
|
// },
|
|
// {
|
|
// name: 'Mobile Safari',
|
|
// use: { ...devices['iPhone 12'] },
|
|
// },
|
|
],
|
|
|
|
// Run local dev server before starting tests (if needed)
|
|
// webServer: {
|
|
// command: 'npm run start',
|
|
// url: 'http://localhost:3000',
|
|
// reuseExistingServer: !process.env.CI,
|
|
// },
|
|
});
|
|
|