2026-07-27 15:37:30 +08:00
|
|
|
import path from "node:path";
|
2026-04-27 21:51:56 +08:00
|
|
|
import { defineConfig, devices } from "@playwright/test";
|
2026-07-27 15:37:30 +08:00
|
|
|
import { resolvePlaywrightEndpoint, resolvePlaywrightRun } from "./tests/playwright-run.js";
|
2026-04-27 21:51:56 +08:00
|
|
|
|
2026-07-27 15:37:30 +08:00
|
|
|
const { runRoot } = resolvePlaywrightRun(__dirname, "docs");
|
|
|
|
|
const endpoint = resolvePlaywrightEndpoint("PLAYWRIGHT_DOCS_PORT", "PLAYWRIGHT_DOCS_URL", 40_000);
|
2026-04-27 21:51:56 +08:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: "./tests/e2e-docs",
|
|
|
|
|
timeout: 30_000,
|
|
|
|
|
expect: { timeout: 10_000 },
|
|
|
|
|
fullyParallel: true,
|
|
|
|
|
retries: 0,
|
|
|
|
|
workers: 1,
|
2026-07-27 15:37:30 +08:00
|
|
|
outputDir: path.join(runRoot, "playwright-output"),
|
|
|
|
|
reporter: [["html", { open: "never", outputFolder: path.join(runRoot, "playwright-report") }]],
|
2026-04-27 21:51:56 +08:00
|
|
|
use: {
|
2026-07-27 15:37:30 +08:00
|
|
|
baseURL: endpoint.url,
|
2026-04-27 21:51:56 +08:00
|
|
|
screenshot: "only-on-failure",
|
|
|
|
|
trace: "retain-on-failure",
|
|
|
|
|
},
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: "chromium",
|
|
|
|
|
use: { ...devices["Desktop Chrome"] },
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
webServer: {
|
2026-07-27 15:37:30 +08:00
|
|
|
command: `cd apps/docs && pnpm docs:build && exec pnpm exec vitepress preview . --host ${endpoint.host} --port ${endpoint.port}`,
|
|
|
|
|
url: endpoint.url,
|
|
|
|
|
reuseExistingServer: false,
|
|
|
|
|
// `vitepress build` renders ~3,800 pages and then runs Pagefind over them,
|
|
|
|
|
// which is about two minutes warm and longer on a loaded machine. At 120s the
|
|
|
|
|
// whole suite died on webServer startup before a single test ran.
|
|
|
|
|
timeout: 600_000,
|
2026-04-27 21:51:56 +08:00
|
|
|
},
|
|
|
|
|
});
|