-
Notifications
You must be signed in to change notification settings - Fork 358
/
playwright.config.ts
63 lines (58 loc) · 1.64 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
import 'dotenv/config';
import { devices, PlaywrightTestConfig } from '@playwright/test';
// Essential environment variables check
if (!process.env.MODE) {
throw new Error('MODE is undefined. Please set MODE environment variable.');
}
if (!process.env.PORT) {
throw new Error('PORT is undefined. Please set PORT environment variable.');
}
const recordingSettings = process.env.WEBM
? {
contextOptions: {
recordVideo: { dir: './packages/test-framework/videos' },
},
launchOptions: { slowMo: 800 },
viewport: { width: 1280, height: 1080 },
}
: null;
const config: PlaywrightTestConfig = {
webServer: {
command: `http-server dist --port=${process.env.PORT}`,
port: Number(process.env.PORT),
timeout: 3 * 1000,
reuseExistingServer: true,
},
timeout: 60 * 1000,
expect: {
// timeout: 25 * 1000,
},
testDir: './packages',
testMatch: /e2e\/.*\.spec\.ts/,
outputDir: './packages/test-framework/screenshots',
fullyParallel: true,
forbidOnly: true,
retries: 3,
workers: process.env.IS_CI ? 3 : undefined,
reporter: [
[
'html',
{ outputFolder: './packages/test-framework/report', open: 'never' },
],
],
use: {
baseURL: `http://localhost:${process.env.PORT}`,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
...recordingSettings,
},
},
],
};
export default config;