ci/woodpecker/pr/config Pipeline was successful
ci/woodpecker/pr/hledger Pipeline was successful
ci/woodpecker/pr/jobs Pipeline was successful
ci/woodpecker/pr/snapshots Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/pr/worker Pipeline was successful
ci/woodpecker/push/config Pipeline was successful
ci/woodpecker/push/hledger Pipeline was successful
ci/woodpecker/push/jobs Pipeline was successful
ci/woodpecker/push/snapshots Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/worker Pipeline was successful
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import { randomUUID } from 'node:crypto';
|
|
import { tmpdir } from 'node:os';
|
|
import { join, resolve } from 'node:path';
|
|
import { browserCredentials } from './e2e/auth-fixture.js';
|
|
|
|
// Compose tests its already-running services; direct/CI runs own an isolated
|
|
// temporary deployment via e2e/server.js. Neither uses personal configuration.
|
|
const externalServer = process.env.PLAYWRIGHT_BASE_URL;
|
|
// External deployments must explicitly provide their own fictional-test login.
|
|
browserCredentials();
|
|
// Propagated to workers; global setup exclusively creates this run's directory.
|
|
const authRun = (process.env.HLEDGER_TEST_AUTH_RUN_ID ??= randomUUID());
|
|
if (!/^[0-9a-f-]{36}$/.test(authRun)) throw new Error('Invalid browser authentication run ID.');
|
|
const storageState = resolve('.cache/test-results', `auth-${authRun}`, 'session.json');
|
|
// Shared only with the owned test server and Node test workers, never the browser.
|
|
if (!externalServer)
|
|
process.env.HLEDGER_TEST_DEPLOYMENT ??= join(tmpdir(), `hledger-browser-${randomUUID()}`);
|
|
|
|
export default defineConfig({
|
|
testDir: 'e2e',
|
|
globalSetup: './e2e/auth.setup.ts',
|
|
testMatch: '**/*.e2e.ts',
|
|
forbidOnly: !!process.env.CI,
|
|
workers: 1,
|
|
retries: process.env.CI ? 1 : 0,
|
|
timeout: 45_000,
|
|
expect: { timeout: 15_000 },
|
|
reporter: 'list',
|
|
use: {
|
|
baseURL: externalServer ?? 'http://127.0.0.1:3000',
|
|
timezoneId: 'UTC',
|
|
storageState
|
|
},
|
|
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
|
webServer: externalServer
|
|
? undefined
|
|
: {
|
|
command: 'node e2e/server.js',
|
|
url: 'http://127.0.0.1:3000/healthz',
|
|
reuseExistingServer: false,
|
|
timeout: 60_000
|
|
}
|
|
});
|