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, "landing");
|
|
|
|
|
const endpoint = resolvePlaywrightEndpoint(
|
|
|
|
|
"PLAYWRIGHT_LANDING_PORT",
|
|
|
|
|
"PLAYWRIGHT_LANDING_URL",
|
|
|
|
|
40_000,
|
|
|
|
|
);
|
2026-04-27 21:51:56 +08:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: "./tests/e2e-landing",
|
|
|
|
|
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/landing && PLAYWRIGHT=1 pnpm build && exec pnpm exec astro preview --host ${endpoint.host} --port ${endpoint.port}`,
|
|
|
|
|
url: endpoint.url,
|
|
|
|
|
reuseExistingServer: false,
|
|
|
|
|
timeout: 120_000,
|
2026-04-27 21:51:56 +08:00
|
|
|
},
|
|
|
|
|
});
|