-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathplaywright-ct.config.ts
More file actions
68 lines (65 loc) · 2.16 KB
/
playwright-ct.config.ts
File metadata and controls
68 lines (65 loc) · 2.16 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
import {
defineConfig,
devices,
} from '@playwright/experimental-ct-react';
import { parseEnvironment } from './tests/playwright/env/parseEnvironment';
const environment = parseEnvironment();
const isCI = !!process.env.CI;
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: isCI,
// Run tests in files in parallel
fullyParallel: true,
// Directory where the output generated by Playwright is stored
outputDir: './tests/playwright/.temp/playwright-ct-output/',
// Run tests for following projects
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
// Retry failed tests once to eliminate flakiness
retries: 1,
// Directory where the snapshots are located
// (must be same as testDir to save snapshots in place where tests are located)
snapshotDir: './src/',
// Directory where the tests are located
testDir: './src/',
// Pattern to search for test files
testMatch: '*/*.spec.{ts,tsx}',
// Timeout for each test
timeout: 10 * 1000,
// Do not update snapshots automatically
updateSnapshots: 'none',
// Configuration for Playwright component testing
use: {
// Directory where the cache is stored
ctCacheDir: './tests/playwright/.temp/playwright-ct-cache',
// Port to use for Playwright component endpoint
ctPort: environment.CT_PORT,
// Directory where the templates are stored
ctTemplateDir: './tests/playwright/templates',
// Launch options for Playwright
launchOptions: {
args: [
'--use-gl=egl',
// # Must be set to `new` to enable new version of Chromium Headless to obtain correct snapshots
'--headless=new',
],
ignoreDefaultArgs: [
// # Must be ignored to enable new version of Chromium Headless to obtain correct snapshots
'--headless',
],
},
// Collect trace on all retries
trace: 'on-all-retries',
},
// Number of workers to use
workers: environment.WORKERS,
});