forked from dflex-js/dflex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaywright.config.ts
62 lines (55 loc) · 1.52 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
/* eslint-disable import/no-extraneous-dependencies */
import { PlaywrightTestConfig, devices } from "@playwright/test";
const { CI, PLAYGROUND_TYPE } = process.env;
const IS_CI = CI === "true";
let testDir = "";
let baseURL = "";
if (PLAYGROUND_TYPE === "dflex-dnd") {
testDir = "./playgrounds/dflex-dnd-playground/tests/";
baseURL = "http://localhost:3001";
} else if (PLAYGROUND_TYPE === "next-dnd") {
testDir = "./playgrounds/dflex-next-playground/tests/";
baseURL = "http://localhost:3002";
} else if (PLAYGROUND_TYPE === "dflex-draggable") {
testDir = "./playgrounds/dflex-draggable-playground/tests/";
baseURL = "http://localhost:3000";
} else {
throw new Error(
"Invalid PLAYGROUND_TYPE. Please set PLAYGROUND_TYPE to 'dflex-dnd', 'next-dnd' or 'dflex-draggable'.",
);
}
// Log CI and PLAYGROUND_TYPE in bold pink
// eslint-disable-next-line no-console
console.log(`\x1b[1m\x1b[95mPLAYGROUND_TYPE: ${PLAYGROUND_TYPE}\x1b[0m`);
const config: PlaywrightTestConfig = {
forbidOnly: IS_CI,
retries: IS_CI ? 4 : 1,
// timeout: 30000,
use: {
video: "retain-on-failure",
navigationTimeout: 30000,
baseURL,
viewport: {
height: 1080,
width: 1920,
},
},
projects: [
{
name: "chromium",
testDir,
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
testDir,
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
testDir,
use: { ...devices["Desktop Safari"] },
},
],
};
export default config;