-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
121 lines (115 loc) · 5.35 KB
/
Copy pathplaywright.config.ts
File metadata and controls
121 lines (115 loc) · 5.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { defineConfig, devices } from "@playwright/test";
/**
* Playwright E2E configuration for Kora Protocol frontend.
*
* Runs against the local Next.js dev server (or a pre-built production server
* in CI). All tests use mock data — no live Stellar RPC calls are made.
*
* Projects:
* - chromium : Full E2E flows (e2e/*.spec.ts)
* - components : Browser-level component tests (e2e/components/*.spec.ts)
* These cover interactions that are hard to test in jsdom,
* such as drag-and-drop, native range inputs, and Radix
* portalled popovers.
*
* CI usage:
* npx playwright test --reporter=html
*/
export default defineConfig({
testDir: "./e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI */
workers: process.env.CI ? 1 : undefined,
/* Reporter: HTML for CI artifact, list for local dev */
reporter: process.env.CI
? [["html", { outputFolder: "playwright-report", open: "never" }]]
: [["list"], ["html", { outputFolder: "playwright-report", open: "never" }]],
use: {
/* Base URL so tests can use relative paths like page.goto('/') */
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? "http://localhost:3000",
/* Collect trace on first retry for debugging */
trace: "on-first-retry",
/* Screenshot on failure */
screenshot: "only-on-failure",
/* Video on first retry */
video: "on-first-retry",
/* Viewport */
viewport: { width: 1280, height: 800 },
},
projects: [
/* ── Full E2E flows ─────────────────────────────────────────────────── */
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
testMatch: /(?<!components\/).*\.spec\.ts/,
},
/* ── Component-level browser tests ───────────────────────────────────
* Isolated to e2e/components/ so they never accidentally run as part
* of the full E2E suite (and vice-versa).
* ─────────────────────────────────────────────────────────────────── */
{
name: "components",
use: { ...devices["Desktop Chrome"] },
testMatch: /components\/.*\.spec\.ts/,
},
/* ── Mobile E2E (Issue #471) ──────────────────────────────────────────
* Runs only the mobile marketplace spec against a Pixel 5 viewport so
* touch events, bottom-sheet layout, and single-column grid are all
* exercised with the real mobile user-agent and touch capabilities.
*
* Scoped to marketplace-mobile.spec.ts — add further mobile-focused
* spec files to the pattern as the suite grows.
* ─────────────────────────────────────────────────────────────────── */
{
name: "mobile-chrome",
use: {
...devices["Pixel 5"],
// Ensure touch is enabled (Pixel 5 device preset includes this, but
// be explicit for clarity and future-proofing).
hasTouch: true,
isMobile: true,
},
testMatch: /marketplace-mobile\.spec\.ts/,
},
],
/* Start Next.js before tests. Prefer production server in CI (after npm run build). */
webServer: {
command: process.env.CI ? "npm run start" : "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: false,
timeout: 180_000,
stdout: "pipe",
stderr: "pipe",
env: {
...process.env,
NEXT_PUBLIC_ENABLE_MOCK_DATA: process.env.NEXT_PUBLIC_ENABLE_MOCK_DATA ?? "true",
NEXT_PUBLIC_ENABLE_ONBOARDING_TOUR:
process.env.NEXT_PUBLIC_ENABLE_ONBOARDING_TOUR ?? "true",
NEXT_PUBLIC_STELLAR_NETWORK: process.env.NEXT_PUBLIC_STELLAR_NETWORK ?? "testnet",
NEXT_PUBLIC_STELLAR_RPC_URL:
process.env.NEXT_PUBLIC_STELLAR_RPC_URL ?? "https://soroban-testnet.stellar.org",
NEXT_PUBLIC_STELLAR_HORIZON_URL:
process.env.NEXT_PUBLIC_STELLAR_HORIZON_URL ?? "https://horizon-testnet.stellar.org",
NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE:
process.env.NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE ??
"Test SDF Network ; September 2015",
NEXT_PUBLIC_INVOICE_CONTRACT_ID:
process.env.NEXT_PUBLIC_INVOICE_CONTRACT_ID ??
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4",
NEXT_PUBLIC_MARKETPLACE_CONTRACT_ID:
process.env.NEXT_PUBLIC_MARKETPLACE_CONTRACT_ID ??
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4",
NEXT_PUBLIC_TOKEN_CONTRACT_ID:
process.env.NEXT_PUBLIC_TOKEN_CONTRACT_ID ??
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4",
NEXT_PUBLIC_IPFS_GATEWAY:
process.env.NEXT_PUBLIC_IPFS_GATEWAY ?? "https://gateway.pinata.cloud/ipfs",
PINATA_JWT: process.env.PINATA_JWT ?? "ci_dummy_pinata_jwt",
},
},
});