Stabilize runtime auth and E2E coverage
This commit is contained in:
parent
6a3e3b541c
commit
188e899394
133 changed files with 55987 additions and 6775 deletions
89
apps/web/playwright.config.ts
Normal file
89
apps/web/playwright.config.ts
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
const host = process.env.PLAYWRIGHT_HOST ?? "localhost";
|
||||
const port = Number(process.env.PLAYWRIGHT_PORT ?? 5173);
|
||||
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `http://${host}:${port}`;
|
||||
const publicBaseURL = process.env.E2E_PUBLIC_BASE_URL ?? "https://vignette.chanpaca.net";
|
||||
const publicStorageState = process.env.E2E_PUBLIC_STORAGE_STATE;
|
||||
const includePublicAuth = process.env.E2E_PUBLIC_AUTH === "1";
|
||||
const shouldStartWebServer =
|
||||
!includePublicAuth && !process.env.PLAYWRIGHT_BASE_URL && !process.env.PLAYWRIGHT_SKIP_WEB_SERVER;
|
||||
const singleRunPattern = /@single-run/;
|
||||
const publicAuthPattern = /@public-auth/;
|
||||
const localProjectExclusions = /@single-run|@public-auth/;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: "./e2e",
|
||||
outputDir: "./node_modules/.tmp/playwright-results",
|
||||
timeout: 30_000,
|
||||
expect: {
|
||||
timeout: 5_000,
|
||||
},
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: process.env.CI
|
||||
? [
|
||||
["list"],
|
||||
["html", { open: "never", outputFolder: "node_modules/.tmp/playwright-report" }],
|
||||
]
|
||||
: "list",
|
||||
use: {
|
||||
baseURL,
|
||||
trace: "on-first-retry",
|
||||
screenshot: "only-on-failure",
|
||||
video: "retain-on-failure",
|
||||
},
|
||||
webServer: shouldStartWebServer
|
||||
? {
|
||||
command: `npm run dev -- --host ${host} --port ${port}`,
|
||||
url: baseURL,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120_000,
|
||||
env: {
|
||||
VITE_API_BASE: process.env.VITE_API_BASE ?? "/api",
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
projects: [
|
||||
{
|
||||
name: "chromium-desktop",
|
||||
grepInvert: localProjectExclusions,
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
viewport: { width: 1440, height: 900 },
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "chromium-mobile",
|
||||
grepInvert: localProjectExclusions,
|
||||
use: {
|
||||
...devices["Pixel 5"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "chromium-single-run",
|
||||
grep: singleRunPattern,
|
||||
grepInvert: publicAuthPattern,
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
viewport: { width: 1280, height: 800 },
|
||||
},
|
||||
},
|
||||
...(includePublicAuth
|
||||
? [
|
||||
{
|
||||
name: "chromium-public-auth",
|
||||
grep: publicAuthPattern,
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
baseURL: publicBaseURL,
|
||||
viewport: { width: 1440, height: 900 },
|
||||
storageState: publicStorageState,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue