-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
104 lines (99 loc) · 3.39 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
import { defineConfig, devices } from "@playwright/test";
import * as dotenv from "dotenv";
import { LogLevel } from "@slack/web-api/dist/index.js";
dotenv.config({
path: ".env.playwright",
});
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
globalTimeout: process.env.CI ? 900000 : 600000,
timeout: process.env.CI ? 180000 : 130000,
expect: {
timeout: process.env.CI ? 10000 : 7000,
},
testDir: "./tests",
/* 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 ? 1 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 4 : 6,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
[
"./node_modules/playwright-slack-report/dist/src/SlackReporter.js",
{
channels: [process.env.TEST_OAM ? "oam-monitoring" : "health_check"], // provide one or more Slack channels
sendResults: "always", // "always" , "on-failure", "off"
maxNumberOfFailuresToShow: 100,
meta: [
{
key: `Tests launched 🎬`,
value: `${process.env.CI ? "Github Actions 🐌" : "Locally"}`,
},
{
key: `Environment 👷🏻♂️`,
value: `${process.env.ENVIRONMENT?.toUpperCase()}`,
},
{
key: `Type ⚙️`,
value: `${process.env.TEST_OAM ? "OAM" : "API"} tests`,
},
{
key: `${process.env.TEST_OAM ? "No users tested" : "Tested user with PRO rights"}`,
value: `${process.env.TEST_OAM ? "-" : process.env.EMAIL_PRO}`,
},
{
key: `Note`,
value:
"📩 For reports, go to Workflow runs (below) -> Any workflow run -> Artifacts 🕵️",
},
{
key: `Workflow runs 🦾`,
value: `${process.env.TEST_OAM ? "<https://github.com/konturio/front-facing-api-tests/actions/workflows/oam-tests.yml|(see)>" : "<https://github.com/konturio/front-facing-api-tests/actions/workflows/run-tests.yml|(see)>"}`,
},
],
slackOAuthToken: process.env.SLACK_BOT_USER_OAUTH_TOKEN,
slackLogLevel: LogLevel.DEBUG,
disableUnfurl: true,
showInThread: true,
},
],
["html", { open: "always" }], // other reporters
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
trace: "on-first-retry",
actionTimeout: process.env.CI ? 15000 : 10000,
navigationTimeout: process.env.CI ? 20000 : 10000,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
},
/* Configure projects for major browsers */
projects: [
{
name: "setup",
testMatch: "auth.setup.ts",
},
{
name: "api_tests",
dependencies: ["setup"],
testIgnore: "oam.spec.ts",
},
{
name: "oam_tests",
testMatch: "oam.spec.ts",
},
],
});