The blocking carpenter smoke test (introduced in this branch) exposed a pre-existing gap: playwright.config.js hardcoded executablePath: '/snap/bin/chromium' plus channel: 'chromium' for the maintainer's local CachyOS machine. CI has no /snap/bin/chromium (it installs its own Chromium via `playwright install --with-deps chromium`), so every CI run was silently failing to launch the browser - previously masked because the whole E2E step had continue-on-error: true. Gate both overrides behind `!process.env.CI` so local runs keep using system Chromium and CI falls back to its own installed browser. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
87 lines
2.8 KiB
JavaScript
87 lines
2.8 KiB
JavaScript
// @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
|
|
}); |