-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
52 lines (46 loc) · 2.43 KB
/
playwright.config.ts
File metadata and controls
52 lines (46 loc) · 2.43 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
import { defineConfig } from "@playwright/test";
import { populateEnvironment } from "@dev/build-tools";
import { getBabylonServerTestsList } 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 : 4;
// Include the performance summary reporter only when running performance tests
const isPerformanceRun = (() => {
const argv = process.argv;
for (let i = 0; i < argv.length; i++) {
if (argv[i] === "--project=performance" || argv[i] === "-p=performance") return true;
if ((argv[i] === "--project" || argv[i] === "-p") && argv[i + 1] === "performance") return true;
if (argv[i].includes("/test/performance/") || argv[i].includes("\\test\\performance\\")) return true;
}
return false;
})();
const baseReporters: any[] = isCI ? [["line"], ["junit", { outputFile: "junit.xml" }], ["html", { open: "never" }]] : [["list"], ["html"]];
if (isPerformanceRun) {
baseReporters.push(["./packages/tools/tests/performanceSummaryReporter.ts"]);
}
export default defineConfig({
// testDir: "./test/playwright",
/* Run tests in files not in parallel or half are skipped */
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: baseReporters,
/* 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,
},
globalSetup: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalSetup.ts") : undefined,
globalTeardown: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalTeardown.ts") : undefined,
/* Project configuration */
projects: getBabylonServerTestsList(),
/* Snapshots */
snapshotPathTemplate: "packages/tools/tests/test/visualization/ReferenceImages/{arg}{ext}",
});