test: add Playwright configs for landing and docs e2e tests

This commit is contained in:
SnapOtter
2026-04-27 21:51:56 +08:00
parent fb249faeb2
commit 7abcd5e26a
5 changed files with 62 additions and 0 deletions
+2
View File
@@ -20,6 +20,8 @@
"test:all": "vitest run --coverage && playwright test",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:landing": "playwright test --config playwright.landing.config.ts",
"test:e2e:docs": "playwright test --config playwright.docs.config.ts",
"test:docker": "docker compose -f docker/docker-compose.test.yml up --build --abort-on-container-exit",
"version:sync": "./scripts/sync-version.sh",
"release": "semantic-release",
+30
View File
@@ -0,0 +1,30 @@
import { defineConfig, devices } from "@playwright/test";
const DOCS_PORT = 5173;
export default defineConfig({
testDir: "./tests/e2e-docs",
timeout: 30_000,
expect: { timeout: 10_000 },
fullyParallel: true,
retries: 0,
workers: 1,
reporter: "html",
use: {
baseURL: `http://localhost:${DOCS_PORT}`,
screenshot: "only-on-failure",
trace: "retain-on-failure",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command: "pnpm --filter @snapotter/docs docs:dev",
port: DOCS_PORT,
reuseExistingServer: !process.env.CI,
timeout: 60_000,
},
});
+30
View File
@@ -0,0 +1,30 @@
import { defineConfig, devices } from "@playwright/test";
const LANDING_PORT = 1350;
export default defineConfig({
testDir: "./tests/e2e-landing",
timeout: 30_000,
expect: { timeout: 10_000 },
fullyParallel: true,
retries: 0,
workers: 1,
reporter: "html",
use: {
baseURL: `http://localhost:${LANDING_PORT}`,
screenshot: "only-on-failure",
trace: "retain-on-failure",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command: "pnpm --filter @snapotter/landing dev",
port: LANDING_PORT,
reuseExistingServer: !process.env.CI,
timeout: 60_000,
},
});
View File
View File