|
1 | 1 | import { defineConfig, devices } from '@playwright/test'; |
2 | | -import { fileURLToPath } from 'url'; |
| 2 | +import type { GitHubActionOptions } from '@estruyf/github-actions-reporter'; |
3 | 3 |
|
4 | | -// @ts-expect-error we probably need a custom tsconfig for the playwright environment |
5 | | -const __filename = fileURLToPath(import.meta.url); |
6 | | -const STORYBOOK_URL = 'http://localhost:6007'; |
7 | | -// For CI, you may want to set BASE_URL to the deployed application. |
8 | | -const baseURL = process.env['BASE_URL'] || STORYBOOK_URL; // storybook URL |
9 | | -/** |
10 | | - * Read environment variables from file. |
11 | | - * https://github.com/motdotla/dotenv |
12 | | - */ |
13 | | -// require('dotenv').config(); |
14 | 4 | /** |
15 | 5 | * See https://playwright.dev/docs/test-configuration. |
16 | 6 | */ |
17 | 7 | export default defineConfig({ |
18 | 8 | testDir: 'src', |
| 9 | + |
| 10 | + fullyParallel: true, |
| 11 | + |
| 12 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 13 | + forbidOnly: !!process.env.CI, |
| 14 | + |
| 15 | + /* Retry on CI only */ |
| 16 | + retries: process.env.CI ? 2 : 0, |
| 17 | + |
| 18 | + reporter: process.env.CI |
| 19 | + ? [ |
| 20 | + ['html', { open: 'never' }], |
| 21 | + [ |
| 22 | + '@estruyf/github-actions-reporter', |
| 23 | + <GitHubActionOptions>{ |
| 24 | + useDetails: true, |
| 25 | + includeResults: ['fail', 'flaky', 'skipped'], |
| 26 | + }, |
| 27 | + ], |
| 28 | + ] |
| 29 | + : [['list'], ['html', { open: 'never' }]], |
| 30 | + |
19 | 31 | /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
20 | 32 | use: { |
21 | | - baseURL, |
22 | | - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
23 | | - trace: 'on-all-retries', |
| 33 | + trace: 'retain-on-failure', |
| 34 | + video: process.env.ci ? 'off' : 'retain-on-failure', |
24 | 35 | }, |
25 | 36 | expect: { |
26 | 37 | timeout: process.env.CI ? 30000 : 10000, |
27 | 38 | }, |
28 | | - reporter: process.env.CI ? 'dot' : 'list', |
29 | 39 | /* Run your local dev server before starting the tests */ |
30 | 40 | webServer: { |
31 | 41 | command: 'pnpm run start:prod', |
32 | | - url: STORYBOOK_URL, |
| 42 | + port: 6007, |
33 | 43 | reuseExistingServer: !process.env.CI, |
34 | 44 | timeout: 120000, |
35 | 45 | }, |
|
0 commit comments