// @ts-check const { defineConfig, devices } = require('@playwright/test'); /** * @see https://playwright.dev/docs/test-configuration */ module.exports = defineConfig({ testDir: './', testMatch: /.*\.spec\.(js|ts)$/, testIgnore: ['**/selenium-ui.test.js', '**/selenium/**'], /* Run tests in files in parallel */ fullyParallel: false, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [ ['html'], ['list'] ], /* 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('/')`. */ baseURL: process.env.PLAYWRIGHT_BASE_URL || 'https://tilbudsgiveren.alw.dk', /* Run in headless mode */ headless: true, /* Use system Chrome/Chromium for CachyOS compatibility (local runs only - CI uses its own Playwright-installed Chromium, see the chromium project below) */ ...(process.env.CI ? {} : { channel: 'chromium' }), /* Extra headers to send with requests */ extraHTTPHeaders: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' }, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', /* Take screenshot on failure */ screenshot: 'only-on-failure', /* Capture video on failure */ video: 'retain-on-failure', /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 30000, /* Maximum time each assertion such as `expect(locator).toBeVisible()` can take. */ expect: { timeout: 15000 } }, /* Configure projects for major browsers */ projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'], // Use system Chromium on CachyOS for local runs. CI installs its own // Chromium via `playwright install` and has no /snap/bin/chromium, so // this override must not apply there. ...(process.env.CI ? {} : { launchOptions: { executablePath: '/snap/bin/chromium' } }) }, } ], /* Run your local dev server before starting the tests */ // webServer: { // command: 'npm run start', // url: 'http://127.0.0.1:4031', // reuseExistingServer: !process.env.CI, // }, /* Global setup and teardown */ globalTimeout: 300000, // 5 minutes for all tests timeout: 60000 // 1 minute per test });