62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright config for running E2E tests against the Docker compose stack.
|
|
* The stack must be running before executing these tests.
|
|
*
|
|
* Usage: npx playwright test --config playwright.e2e.config.ts
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
timeout: 60_000,
|
|
expect: { timeout: 10_000 },
|
|
fullyParallel: false,
|
|
retries: 1,
|
|
workers: 1,
|
|
reporter: [['list'], ['html', { open: 'never' }]],
|
|
|
|
// Default targets Docker stack, but allow local source-served runs for debugging/unblock.
|
|
// Example:
|
|
// PLAYWRIGHT_LOCAL_SOURCE=1 PLAYWRIGHT_BASE_URL=https://127.0.0.1:4400
|
|
// npx playwright test --config playwright.e2e.config.ts ...
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...(function (): any {
|
|
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? 'https://stella-ops.local';
|
|
const localSource = process.env.PLAYWRIGHT_LOCAL_SOURCE === '1';
|
|
return {
|
|
...(localSource
|
|
? {
|
|
webServer: {
|
|
command: 'npm run serve:test',
|
|
reuseExistingServer: !process.env.CI,
|
|
url: baseURL,
|
|
ignoreHTTPSErrors: true,
|
|
timeout: 120_000,
|
|
stdout: 'ignore',
|
|
stderr: 'ignore',
|
|
},
|
|
}
|
|
: {}),
|
|
use: {
|
|
baseURL,
|
|
ignoreHTTPSErrors: true,
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
},
|
|
};
|
|
})(),
|
|
|
|
projects: [
|
|
{
|
|
name: 'setup',
|
|
testMatch: /global\.setup\.ts/,
|
|
},
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
dependencies: ['setup'],
|
|
},
|
|
],
|
|
});
|