Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
44 lines (42 loc) · 1.6 KB
/
Copy pathplaywright.config.ts
File metadata and controls
44 lines (42 loc) · 1.6 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
import { defineConfig, devices } from "@playwright/test";
// E2E against a production build (docs/QUALITY.md §1). CI runs this inside `firebase emulators:exec`
// with demo env values; locally, `pnpm test:e2e` reuses a running `next start` or starts one.
// Set PLAYWRIGHT_CHANNEL=chrome to use an installed Chrome when the browser download is unavailable.
const port = Number(process.env.PLAYWRIGHT_PORT ?? 3000);
const baseURL = `http://localhost:${port}`;
const channel = process.env.PLAYWRIGHT_CHANNEL;
const base = { ...devices["Desktop Chrome"], ...(channel ? { channel } : {}) };
export default defineConfig({
testDir: "tests/e2e",
fullyParallel: true,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : [["list"]],
use: {
baseURL,
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
// The three widths every screen must pass (docs/RESPONSIVE.md §5), emulated in Chromium.
// WebKit/iOS Safari and Firefox are covered by the manual device-matrix pass.
{
name: "mobile-375",
use: { ...base, viewport: { width: 375, height: 667 }, isMobile: true, hasTouch: true },
},
{
name: "tablet-768",
use: { ...base, viewport: { width: 768, height: 1024 }, hasTouch: true },
},
{
name: "desktop-1280",
use: { ...base, viewport: { width: 1280, height: 720 } },
},
],
webServer: {
command: `pnpm exec next start -p ${port}`,
url: `${baseURL}/sign-in`,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});