forked from ariakit/ariakit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
49 lines (44 loc) · 1.24 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
import { LaunchOptions, PlaywrightTestConfig, devices } from "@playwright/test";
process.env.PLAYWRIGHT_EXPERIMENTAL_FEATURES = "1";
if (process.argv.includes("--headed")) {
process.env.PWHEADED = "true";
}
const headed = process.env.PWHEADED === "true";
const launchOptions: LaunchOptions = headed ? { slowMo: 150 } : {};
const config: PlaywrightTestConfig = {
webServer: {
command: "npm start",
reuseExistingServer: !process.env.CI,
port: 3000,
},
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: headed ? 1 : 0.025,
},
},
use: {
screenshot: "only-on-failure",
},
reporter: process.env.CI ? [["github"], ["dot"]] : "list",
projects: [
{
name: "chrome",
testMatch: [/\/test[^\/]*\-chrome/, /\/test[^\/]*\-browser/],
retries: 1,
use: { ...devices["Desktop Chrome"], launchOptions },
},
{
name: "firefox",
testMatch: [/\/test[^\/]*\-firefox/, /\/test[^\/]*\-browser/],
retries: 2,
use: { ...devices["Desktop Firefox"], launchOptions },
},
{
name: "safari",
testMatch: [/\/test[^\/]*\-safari/, /\/test[^\/]*\-browser/],
retries: 1,
use: { ...devices["Desktop Safari"], launchOptions },
},
],
};
export default config;