-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.shared.ts
More file actions
51 lines (46 loc) · 1.39 KB
/
playwright.shared.ts
File metadata and controls
51 lines (46 loc) · 1.39 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
import type { PlaywrightTestConfig } from "@playwright/test";
const playwrightHost = process.env.PLAYWRIGHT_HOST ?? "127.0.0.1";
const playwrightBaseURLHost =
process.env.PLAYWRIGHT_BASE_URL_HOST ?? "127.0.0.1";
const playwrightPort = process.env.PLAYWRIGHT_PORT ?? "3001";
const playwrightBaseURL = process.env.PLAYWRIGHT_BASE_URL;
const baseURL =
playwrightBaseURL ?? `http://${playwrightBaseURLHost}:${playwrightPort}`;
const shouldStartWebServer = !playwrightBaseURL;
const sharedPlaywrightUse: PlaywrightTestConfig["use"] = {
baseURL,
headless: true,
locale: "en-AU",
launchOptions:
process.platform === "darwin" ? { chromiumSandbox: true } : undefined,
extraHTTPHeaders: {
"Accept-Language": "en-AU,en;q=0.9",
},
trace: "retain-on-failure",
video: "retain-on-failure",
screenshot: "only-on-failure",
viewport: {
width: 1280,
height: 900,
},
};
const sharedPlaywrightConfig = {
testDir: "./e2e",
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
reporter: process.env.CI ? "github" : "list",
use: sharedPlaywrightUse,
projects: [
{
name: "chromium",
},
],
} satisfies Omit<PlaywrightTestConfig, "webServer">;
const sharedWebServer = {
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
};
export { sharedPlaywrightConfig, sharedWebServer, shouldStartWebServer };
export { playwrightHost, playwrightPort };