2026-03-22 19:28:57 +08:00
|
|
|
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
|
import path from "node:path";
|
|
|
|
|
|
|
|
|
|
const authFile = path.join(__dirname, "test-results", ".auth", "user.json");
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: "./tests/e2e",
|
|
|
|
|
timeout: 30_000,
|
|
|
|
|
expect: {
|
|
|
|
|
timeout: 10_000,
|
2026-03-23 11:46:45 +08:00
|
|
|
toHaveScreenshot: {
|
|
|
|
|
maxDiffPixelRatio: 0.01,
|
|
|
|
|
animations: "disabled",
|
|
|
|
|
caret: "hide",
|
|
|
|
|
},
|
2026-03-22 19:28:57 +08:00
|
|
|
},
|
2026-03-23 11:46:45 +08:00
|
|
|
snapshotPathTemplate:
|
|
|
|
|
"{testDir}/__screenshots__/{testFilePath}/{arg}{ext}",
|
2026-03-22 19:28:57 +08:00
|
|
|
fullyParallel: false,
|
|
|
|
|
retries: 0,
|
|
|
|
|
workers: 1,
|
|
|
|
|
reporter: "html",
|
|
|
|
|
use: {
|
|
|
|
|
baseURL: "http://localhost:1349",
|
|
|
|
|
screenshot: "only-on-failure",
|
|
|
|
|
trace: "retain-on-failure",
|
|
|
|
|
},
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: "setup",
|
|
|
|
|
testMatch: /auth\.setup\.ts/,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "chromium",
|
|
|
|
|
use: {
|
|
|
|
|
...devices["Desktop Chrome"],
|
|
|
|
|
storageState: authFile,
|
|
|
|
|
},
|
|
|
|
|
dependencies: ["setup"],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
webServer: [
|
|
|
|
|
{
|
|
|
|
|
command: "pnpm --filter @stirling-image/api dev",
|
|
|
|
|
port: 1350,
|
|
|
|
|
reuseExistingServer: !process.env.CI,
|
|
|
|
|
env: {
|
|
|
|
|
AUTH_ENABLED: "true",
|
|
|
|
|
DEFAULT_USERNAME: "admin",
|
|
|
|
|
DEFAULT_PASSWORD: "admin",
|
2026-03-23 11:46:45 +08:00
|
|
|
RATE_LIMIT_PER_MIN: "50000",
|
2026-03-22 19:28:57 +08:00
|
|
|
},
|
|
|
|
|
timeout: 30_000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
command: "pnpm --filter @stirling-image/web dev",
|
|
|
|
|
port: 1349,
|
|
|
|
|
reuseExistingServer: !process.env.CI,
|
|
|
|
|
timeout: 30_000,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export { authFile };
|