41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
|
|
import { defineConfig, devices } from "@playwright/test";
|
||
|
|
|
||
|
|
const localBaseUrl = "http://127.0.0.1:5173";
|
||
|
|
const baseURL = process.env.E2E_BASE_URL ?? localBaseUrl;
|
||
|
|
const startLocalStack = !process.env.E2E_BASE_URL;
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
testDir: "./tests/e2e",
|
||
|
|
timeout: 30_000,
|
||
|
|
expect: { timeout: 5_000 },
|
||
|
|
fullyParallel: true,
|
||
|
|
forbidOnly: !!process.env.CI,
|
||
|
|
retries: process.env.CI ? 2 : 0,
|
||
|
|
reporter: [["html", { open: "never" }]],
|
||
|
|
use: {
|
||
|
|
baseURL,
|
||
|
|
testIdAttribute: "data-testid",
|
||
|
|
trace: "on-first-retry",
|
||
|
|
screenshot: "only-on-failure",
|
||
|
|
video: "retain-on-failure",
|
||
|
|
},
|
||
|
|
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
|
||
|
|
webServer: startLocalStack
|
||
|
|
? [
|
||
|
|
{
|
||
|
|
command:
|
||
|
|
"node tests/e2e/support/ensure-e2e-database.mjs && cd apps/server && node --env-file=.env.e2e --import=tsx src/index.ts",
|
||
|
|
url: "http://127.0.0.1:3002/api/v1/__ready",
|
||
|
|
timeout: 120_000,
|
||
|
|
reuseExistingServer: !process.env.CI,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
command: "cd apps/web && pnpm dev -- --mode e2e --port 5173",
|
||
|
|
url: localBaseUrl,
|
||
|
|
timeout: 120_000,
|
||
|
|
reuseExistingServer: !process.env.CI,
|
||
|
|
},
|
||
|
|
]
|
||
|
|
: undefined,
|
||
|
|
});
|