-
Notifications
You must be signed in to change notification settings - Fork 34
/
playwright.config.ts
126 lines (122 loc) · 3.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import type { PlaywrightTestConfig } from "@playwright/test";
import { devices } from "@playwright/test";
import { TestOptions } from "./tests/fixtures/lxd-test";
import dotenv from "dotenv";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// provide environment variables from .env.local to all tests
dotenv.config({ path: path.resolve(__dirname, ".env.local") });
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig<TestOptions> = {
testDir: "./tests",
/* Maximum time one test can run for. */
timeout: 120_000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 120_000,
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
[
process.env.CI ? "blob" : "html",
{ fileName: process.env.CI ? "report.zip" : "index.html" },
],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
baseURL: "https://localhost:8407/",
ignoreHTTPSErrors: true,
video: "retain-on-failure",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},
// Limit the number of failures on CI to save resources
maxFailures: process.env.CI ? 3 : undefined,
/* Configure projects for major browsers */
projects: [
// ensure login tests run first since we need to remove the tls certificate from lxd trust store
{
name: "login-chromium",
use: { ...devices["Desktop Chrome"] },
testMatch: "login.spec.ts",
},
{
name: "login-firefox",
use: { ...devices["Desktop Firefox"] },
testMatch: "login.spec.ts",
},
{
name: "chromium:lxd-5.0-edge",
use: {
...devices["Desktop Chrome"],
lxdVersion: "5.0-edge",
},
},
{
name: "firefox:lxd-5.0-edge",
use: {
...devices["Desktop Firefox"],
lxdVersion: "5.0-edge",
},
},
{
name: "chromium:lxd-5.21-edge",
use: {
...devices["Desktop Chrome"],
lxdVersion: "5.21-edge",
},
dependencies: ["login-chromium"],
},
{
name: "firefox:lxd-5.21-edge",
use: {
...devices["Desktop Firefox"],
lxdVersion: "5.21-edge",
},
dependencies: ["login-firefox"],
},
{
name: "chromium:lxd-latest-edge",
use: {
...devices["Desktop Chrome"],
lxdVersion: "latest-edge",
},
dependencies: ["login-chromium"],
},
{
name: "firefox:lxd-latest-edge",
use: {
...devices["Desktop Firefox"],
lxdVersion: "latest-edge",
},
dependencies: ["login-firefox"],
},
{
name: "coverage",
use: {
...devices["Desktop Chrome"],
lxdVersion: "latest-edge",
hasCoverage: true,
},
dependencies: ["login-chromium"],
},
],
};
export default config;