forked from veridatum-labs/earnproof-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
64 lines (61 loc) · 2.28 KB
/
Copy pathplaywright.config.ts
File metadata and controls
64 lines (61 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { defineConfig, devices } from "@playwright/test";
const PORT = process.env.PLAYWRIGHT_PORT ?? "3100";
const BASE_URL = `http://127.0.0.1:${PORT}`;
/**
* The API base is intentionally unreachable (a synthetic loopback port with
* no server behind it). Every spec installs `apiMock` before navigating, so
* every request to this origin is answered by Playwright's route
* interception rather than a live network call — this constant only needs
* to be a stable, unique origin for the fixtures to key off.
*/
const MOCK_API_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://127.0.0.1:4010/api/v1";
export default defineConfig({
testDir: "./e2e",
// The accessibility suite lives under e2e/accessibility and the visual
// regression suite lives under e2e/visual, each with its own dedicated
// config (playwright.a11y.config.ts / playwright.visual.config.ts) using
// different projects, worker counts, and thresholds — exclude both here
// so they aren't also picked up (and run under the wrong settings) by
// this general functional e2e config.
testIgnore: ["**/visual/**", "**/accessibility/**"],
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 2 : undefined,
reporter: process.env.CI ? [["html", { open: "never" }], ["list"]] : "list",
timeout: 30_000,
expect: {
timeout: 10_000,
},
use: {
baseURL: BASE_URL,
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "off",
actionTimeout: 15_000,
},
projects: [
{
name: "desktop-chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "mobile-chromium",
use: { ...devices["Pixel 5"] },
},
],
webServer: {
// A production build + `next start` is used instead of `next dev` so
// Fast Refresh / on-demand Turbopack compilation never interrupts a
// spec mid-interaction (dev-mode HMR can remount client components
// while a test is mid-click, producing flaky "session vanished"
// failures that have nothing to do with the app or the test).
command: `npm run build && npm run start -- -p ${PORT} -H 127.0.0.1`,
url: BASE_URL,
reuseExistingServer: !process.env.CI,
timeout: 180_000,
env: {
NEXT_PUBLIC_API_URL: MOCK_API_URL,
},
},
});