44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
import { loadTestEnv } from './tests/helpers/env'
|
|
|
|
loadTestEnv()
|
|
|
|
const baseURL = process.env.TEST_BASE_URL || 'http://localhost:4175'
|
|
const authStatePath = 'tests/.auth/staff.json'
|
|
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
// Long, dependent workflows run sequentially in a single worker.
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 1 : 0,
|
|
// Generous budget for multi-step admin workflows.
|
|
timeout: 120_000,
|
|
expect: { timeout: 15_000 },
|
|
reporter: [['list'], ['html', { open: 'never' }]],
|
|
use: {
|
|
baseURL,
|
|
// Show the browser by default so runs are watchable; CI stays headless.
|
|
// Override with `HEADED=0` to force headless, or `HEADED=1` to force headed.
|
|
headless: process.env.HEADED === '1' ? false : process.env.HEADED === '0' ? true : !!process.env.CI,
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
actionTimeout: 20_000,
|
|
navigationTimeout: 45_000,
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'setup',
|
|
testMatch: /auth\.setup\.ts/,
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
{
|
|
name: 'chromium',
|
|
testMatch: /.*\.spec\.ts/,
|
|
dependencies: ['setup'],
|
|
use: { ...devices['Desktop Chrome'], storageState: authStatePath },
|
|
},
|
|
],
|
|
})
|