-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
71 lines (63 loc) · 2.07 KB
/
playwright.config.ts
File metadata and controls
71 lines (63 loc) · 2.07 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
import { defineConfig } from '@playwright/test';
import path from 'path';
import dotenv from 'dotenv';
export const STORAGE_STATE: string = path.join(__dirname, 'playwright/.auth/customer.json');
dotenv.config();
export default defineConfig({
testDir: './src/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 ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : 5,
// Timeouts for assertions
expect: {
timeout: 10_000
},
// Reporters
reporter: [
['html', { open: 'never', outputFolder: 'reports' }],
['list', { printSteps: true }]
],
use: {
baseURL: process.env.BASE_URL,
actionTimeout: 1000,
trace: 'on-first-retry',
headless: false,
// Enables data-testid attribute using id
testIdAttribute: 'id',
// Takes a screenshot on failure
screenshot: 'only-on-failure'
},
globalSetup: require.resolve('./config/global.setup.ts'),
projects: [
{
name: 'init-setup',
testDir: './config',
testMatch: 'init.setup.ts'
},
{
name: 'create-customer',
testDir: './config',
testMatch: 'createCustomer.setup.ts',
dependencies: ['init-setup']
},
{
name: 'e2e-tests',
testDir: './src/tests',
testMatch: ['login.spec.ts', 'register.spec.ts'],
dependencies: ['create-customer']
},
{
name: 'e2e-tests-logged-in',
use: { storageState: STORAGE_STATE },
testDir: './src/tests',
testMatch: ['billPay.spec.ts', 'customerInfo.spec.ts', 'openAccount.spec.ts', 'requestLoan.spec.ts', 'transactions.spec.ts', 'transferFunds.spec.ts'],
// dependencies: ['e2e-tests']
dependencies: ['create-customer']
}
]
});