-
Notifications
You must be signed in to change notification settings - Fork 8
/
jest.integration.config.js
65 lines (58 loc) · 1.63 KB
/
jest.integration.config.js
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
import { devices } from "playwright"
const projects = [
{
name: "Desktop Chrome",
...devices["Desktop Chrome"]
},
{
name: "Desktop Firefox",
...devices["Desktop Firefox"]
},
{
name: "Desktop Safari",
...devices["Desktop Safari"]
},
{
name: "Tablet Chrome",
...devices["Galaxy Tab S4 landscape"]
},
{
name: "Tablet Safari",
...devices["iPad Mini landscape"],
},
]
const testEnvironmentOptions = {
"jest-playwright": {
contextOptions: {
baseURL: process.env.BASE_URL || "http://localhost:8000",
ignoreHTTPSErrors: true,
},
exitOnPageError: true,
useDefaultBrowserType: true,
launchOptions: {
headless: process.env.HEADLESS === "false" ? false : true,
},
},
}
if (process.env.DEVICE) {
testEnvironmentOptions["jest-playwright"].devices = [process.env.DEVICE]
}
if (process.env.BROWSER) {
testEnvironmentOptions["jest-playwright"].browsers = [process.env.BROWSER]
}
if (process.env.PROJECT) {
const proj = projects.find(p => process.env.PROJECT === p.name)
testEnvironmentOptions["jest-playwright"].devices = [proj]
testEnvironmentOptions["jest-playwright"].browsers = [proj.defaultBrowserType]
}
if(!process.env.DEVICE && !process.env.BROWSER && !process.env.PROJECT) {
testEnvironmentOptions["jest-playwright"].devices = projects
testEnvironmentOptions["jest-playwright"].browsers = ["chromium", "firefox", "webkit"]
}
export default {
preset: "jest-playwright-preset",
testEnvironmentOptions,
setupFilesAfterEnv: ["expect-playwright", "./test/integration/jest.setup.js"],
testMatch: ["**/integration/**/*.test.js"],
verbose: false,
}