-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
140 lines (137 loc) · 4.32 KB
/
playwright.config.ts
File metadata and controls
140 lines (137 loc) · 4.32 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'node:path';
import { title } from 'node:process';
import type { TestOptions } from './test_auxiliaries/fixtures/parameterizeFixture';
dotenv.config({ quiet: true, path: path.resolve(path.join('./', `test_environments/${process.env.TARGETHOST || 'qa'}.env`)), override: true });
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig<TestOptions>({
expect: {
timeout: 10 * 1000,
toHaveScreenshot: { maxDiffPixels: 10, maxDiffPixelRatio: 0.1, threshold: 0.2 },
toMatchSnapshot: { maxDiffPixels: 10 },
toMatchAriaSnapshot: { pathTemplate: '' },
toPass: { intervals: [1, 5, 10, 50], timeout: 10 * 1000 },
},
globalTimeout: 60 * 60 * 1000,
timeout: 120 * 1000,
testDir: '.',
fullyParallel: false,
failOnFlakyTests: !!process.env.CI,
forbidOnly: !!process.env.CI,
maxFailures: process.env.CI ? 5 : 0,
outputDir: './test_output/results',
preserveOutput: 'always',
name: 'Playwright Playground',
metadata: { title: 'E2E and Functional Tests', version: '0.0.1' },
quiet: !!process.env.CI,
tag: process.env.CI ? '@CI_TAG' : '@LOCAL_TAG',
testIgnore: './*ignore*.spec.ts',
captureGitInfo: { commit: true, diff: true },
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? undefined : 2,
reporter: process.env.CI
? 'blob'
: [
['html', { outputFolder: './test_output/reports/htmlReports' }],
['json', { outputFile: './test_output/reports/jsonReports/output.json' }],
['junit', { outputFile: './test_output/reports/jUnitReports/output.xml' }],
['blob', { outputFolder: './test_output/reports/blobReports' }],
],
use: {
video: 'on',
trace: 'on',
viewport: null,
acceptDownloads: true,
actionTimeout: 5 * 1000,
colorScheme: 'dark',
geolocation: { longitude: 12.492507, latitude: 41.889938 },
deviceScaleFactor: undefined,
headless: true,
hasTouch: true,
launchOptions: { args: ['--start-maximized'] },
locale: 'en-US',
timezoneId: 'Europe/Paris',
navigationTimeout: 90 * 1000,
permissions: [
//'accelerometer', --doesn't have firefox
//'ambient-light-sensor',
//'background-sync',
//'camera',
//'clipboard-read',
//'clipboard-write',
//'geolocation',
//'gyroscope',
//'local-fonts',
//'local-network-access',
//'magnetometer',
//'microphone',
//'midi',
//'notifications',
//'payment-handler',
//'storage-access',
],
screenshot: 'only-on-failure',
testIdAttribute: 'data-testid',
},
/* Configure projects for major browsers */
projects: [
{ name: 'GLOBALSETUP_PROJECT', testMatch: '**/globalSetup.spec.ts', teardown: 'GLOBALTEARDOWN_PROJECT' },
{
name: 'CHROMIUM_PROJECT',
use: { ...devices[''], isMobile: false },
dependencies: ['GLOBALSETUP_PROJECT'],
},
{ name: 'GLOBALTEARDOWN_PROJECT', testMatch: '**/globalTeardown.spec.ts' },
{ name: 'SMOKE_PROJECT', testDir: 'test_cases/smoke', retries: 3 },
{ name: 'SANITY_PROJECT', testDir: 'test_cases/sanity', retries: 2 },
{ name: 'REGRESSION_PROJECT', testDir: 'test_cases/regression', retries: 1 },
{ name: 'E2E_PROJECT', testDir: 'test_cases/e2e', retries: 0 },
/*Parameterized projects
{
name: 'Rupesh',
use: { person: 'Rupesh' },
},
{
name: 'Somala',
use: { person: 'Somala' },
},
*/
/*
{
name: 'firefox',
use: { ...devices['Desktop Firefox'],isMobile:false },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'],isMobile:false },
},
//Test against mobile viewports.
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'],isMobile:true },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'],isMobile:true },
},
//Test against branded browsers.
{
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},
*/
],
/* Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
}, */
});