-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
playwright.config.ts
71 lines (67 loc) · 2.61 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
67
68
69
70
71
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
dotenv.config();
const env = process.env;
const DEFAULT_WORKERS = "2";
// const DEFAULT_RETRIES = "1";
// FIXME: High timeouts are a temporary solution to handle slower CI environments.
// Local development on high-performance machines is much faster, but shared CI workers
// can be overloaded, causing operations to take longer than expected.
export const SUCCESS_BANNER_TIMEOUT = process.env.CI ? 20000 : 10000;
export default defineConfig({
testDir: "playwright/tests",
fullyParallel: true,
forbidOnly: !!env.CI,
retries: 0,
// We are disabling retries for now as it prolongs the test run time
// as the test will most likely fail again. We can enable it later if needed.
// retries: parseInt(env.RETRIES || DEFAULT_RETRIES),
workers: parseInt(env.WORKERS || DEFAULT_WORKERS),
reporter: process.env.CI
? [
["blob"],
["github"],
[
"playwright-testmo-reporter",
{
outputFile: "testmo/testmo.xml", // Optional: Output file path. Defaults to 'testmo.xml'.
embedBrowserType: true, // Optional: Embed browser type in the XML file. Defaults to false.
embedTestSteps: true, // Optional: Embed test steps in the XML file. Defaults to true.
testStepCategories: ["hook", "expect", "pw:api", "test.step"], // Optional: Test step categories to include in the XML file. Defaults to ["hook","expect","pw:api","test.step"]. Possible options are "hook", "expect", "pw:api", "test.step".
testTitleDepth: 1, // Optional: Test case title depth to report in the XML file. Defaults to 1. Increase this to 2 include suite name. Increase this even further to include the path.
attachmentBasePathCallback: () =>
process.env.URL_TO_RUN ? process.env.URL_TO_RUN : "",
},
],
]
: [["html"], ["list"]],
expect: { timeout: 10 * 1000 },
maxFailures: 10,
timeout: 35 * 1000,
use: {
baseURL: env.BASE_URL || "",
trace: env.CI ? "retain-on-failure" : "on",
screenshot: "only-on-failure",
testIdAttribute: "data-test-id",
video: env.CI ? "retain-on-failure" : "off",
headless: true,
},
projects: [
{
name: "setup",
testMatch: /.*\.setup\.ts/,
},
{
name: "e2e",
dependencies: ["setup"],
use: { ...devices["Desktop Chrome"] },
testIgnore: "playwright/tests/apps.spec.ts",
},
{
name: "apps-e2e",
dependencies: ["setup"],
use: { ...devices["Desktop Chrome"] },
testMatch: "playwright/tests/apps.spec.ts",
},
],
});