-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathplaywright.devhost.config.ts
More file actions
50 lines (44 loc) · 2.37 KB
/
playwright.devhost.config.ts
File metadata and controls
50 lines (44 loc) · 2.37 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
import { defineConfig } from "@playwright/test";
import { populateEnvironment } from "@dev/build-tools";
import { getDevHostTestsList } from "./packages/tools/tests/playwright.utils";
populateEnvironment();
const isCI = !!process.env.CI;
const browserType = process.env.BROWSER || (isCI ? "Firefox" : "Chrome");
const numberOfWorkers = process.env.CIWORKERS ? +process.env.CIWORKERS : process.env.CI ? 1 : browserType === "BrowserStack" ? 1 : undefined;
export default defineConfig({
// testDir: "./test/playwright",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI. */
workers: numberOfWorkers,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? [["line"], ["junit", { outputFile: "junit.xml" }], ["html", { open: "never" }]] : [["list"], ["html"]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
ignoreHTTPSErrors: true,
// Provide a baseURL so tests can use page.goto("/path") without hardcoding the host.
baseURL: process.env.BASE_URL || "http://localhost:1338",
},
globalSetup: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalSetup.ts") : undefined,
globalTeardown: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalTeardown.ts") : undefined,
/* Start the dev host automatically before the tests.
Playwright will wait until the URL responds (HTTP 200/302) before executing tests. */
webServer: {
command: process.env.PW_DEVHOST_CMD || "npm run serve -w @tools/dev-host",
url: process.env.BASE_URL || "http://localhost:1338",
reuseExistingServer: !isCI,
timeout: 90_000,
stdout: "pipe",
stderr: "pipe",
},
/* Project configuration */
projects: getDevHostTestsList(),
/* Snapshots */
snapshotPathTemplate: "packages/tools/tests/test/visualization/ReferenceImages/{arg}{ext}",
});