50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import * as path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { playwrightArtifactDirNames } from './src/lib/playwrightPhaseArtifacts';
|
|
|
|
/**
|
|
* Ubuntu Server headless UI acceptance config (DOCREV runtime).
|
|
* Enable only when RUN_UI_ACCEPTANCE=1 against a real dev stack — no mocks.
|
|
* Script never touches docker; UI_PHASE=post-restart is a second run after host restart.
|
|
* outputDir / HTML report are split by UI_PHASE so post-restart cannot wipe main traces.
|
|
*/
|
|
const runAcceptance = process.env.RUN_UI_ACCEPTANCE === '1';
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const evidenceRoot = process.env.UI_ACCEPTANCE_ASSETS_DIR
|
|
? path.resolve(process.env.UI_ACCEPTANCE_ASSETS_DIR)
|
|
: path.resolve(
|
|
__dirname,
|
|
'../.doc/test-reports/assets/2026-09-14-controlled-content-ui-acceptance',
|
|
);
|
|
const phaseDirs = playwrightArtifactDirNames(process.env.UI_PHASE);
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
fullyParallel: false,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
workers: 1,
|
|
timeout: 600_000,
|
|
outputDir: path.join(evidenceRoot, phaseDirs.outputDirName),
|
|
reporter: [
|
|
['list'],
|
|
['html', { open: 'never', outputFolder: path.join(evidenceRoot, phaseDirs.reportDirName) }],
|
|
],
|
|
use: {
|
|
baseURL: process.env.BASE_URL || 'http://127.0.0.1:8080',
|
|
headless: true,
|
|
actionTimeout: 30_000,
|
|
locale: 'zh-CN',
|
|
trace: runAcceptance ? 'on' : 'off',
|
|
screenshot: runAcceptance ? 'on' : 'off',
|
|
video: runAcceptance ? 'on' : 'off',
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
],
|
|
});
|