-
Notifications
You must be signed in to change notification settings - Fork 56
/
playwright.config.ts
66 lines (60 loc) · 1.51 KB
/
playwright.config.ts
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
import "./tests/e2e/__setup__/playwrightSetup";
import path from "path";
import { Project, defineConfig, devices } from "@playwright/test";
import { isTestsConfigWhitelistItemAllowed } from "./tests/__utils__/testsConfig";
import { hasGUI } from "./tests/e2e/__utils__/testHelpers";
if (hasGUI()) {
console.log(
"Running in UI mode - testing will only happen on Chrome, regardless of YAML configuration",
);
}
const allAvailableRunners: Project[] = [
{
name: "Chrome",
use: { ...devices["Desktop Chrome"], channel: "chrome" },
},
{
name: "Firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "Safari",
use: { ...devices["Desktop Safari"] },
},
{
name: "Microsoft Edge",
use: { ...devices["Desktop Edge"], channel: "msedge" },
},
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
{
name: "Mobile Safari",
use: { ...devices["iPhone 12"] },
},
];
export default defineConfig({
use: {
launchOptions: {
slowMo: hasGUI() ? 550 : undefined,
},
video: "retain-on-failure",
trace: "off",
},
workers: "50%",
maxFailures: process.env.ci ? undefined : 10,
retries: 2,
projects: allAvailableRunners.filter(({ name }) =>
isTestsConfigWhitelistItemAllowed("e2e", "whitelistedBrowsers", name!),
),
testMatch: path.join(path.dirname(__filename), "tests", "e2e", "*.spec.ts"),
globalSetup: path.join(
path.dirname(__filename),
"tests",
"e2e",
"__setup__",
"playwrightGlobalSetup.ts",
),
outputDir: path.join(path.dirname(__filename), "tests", "e2e", "__results__"),
});