|
| 1 | +import path from 'node:path'; |
| 2 | +import { defineConfig, devices } from '@playwright/test'; |
| 3 | +import baseConfig from '../playwright.config'; |
| 4 | + |
| 5 | +const buildCommand = [ |
| 6 | + 'INCLUDE_AUTH_PAGES=true', |
| 7 | + 'NEXT_PUBLIC_TIME_TILL_LOGOUT_SECONDS=25', |
| 8 | + 'NEXT_PUBLIC_PROMPT_SECONDS_BEFORE_LOGOUT=5', |
| 9 | + 'npm run build && npm run start', |
| 10 | +].join(' '); |
| 11 | + |
| 12 | +export default defineConfig({ |
| 13 | + ...baseConfig, |
| 14 | + |
| 15 | + timeout: 30_000, // 30 seconds in the playwright default |
| 16 | + expect: { |
| 17 | + timeout: 10_000, // default is 5 seconds. After creating and previewing sometimes the load is slow on a cold start |
| 18 | + }, |
| 19 | + projects: [ |
| 20 | + { |
| 21 | + name: 'component:setup', |
| 22 | + testMatch: 'component.setup.ts', |
| 23 | + use: { |
| 24 | + baseURL: 'http://localhost:3000', |
| 25 | + ...devices['Desktop Chrome'], |
| 26 | + headless: true, |
| 27 | + screenshot: 'only-on-failure', |
| 28 | + }, |
| 29 | + }, |
| 30 | + { |
| 31 | + name: 'modal', |
| 32 | + testMatch: 'template-mgmt-logout-warning.component.modal.spec.ts', |
| 33 | + use: { |
| 34 | + screenshot: 'only-on-failure', |
| 35 | + baseURL: 'http://localhost:3000', |
| 36 | + ...devices['Desktop Chrome'], |
| 37 | + headless: true, |
| 38 | + storageState: path.resolve(__dirname, '../.auth/user.json'), |
| 39 | + }, |
| 40 | + timeout: 60_000, |
| 41 | + dependencies: ['component:setup'], |
| 42 | + teardown: 'component:teardown', |
| 43 | + fullyParallel: true, // make these sets of tests parallel due to their slow nature. |
| 44 | + }, |
| 45 | + { |
| 46 | + name: 'component:teardown', |
| 47 | + testMatch: 'component.teardown.ts', |
| 48 | + }, |
| 49 | + ], |
| 50 | + /* Run your local dev server before starting the tests */ |
| 51 | + webServer: { |
| 52 | + timeout: 2 * 60 * 1000, // 2 minutes |
| 53 | + command: buildCommand, |
| 54 | + cwd: path.resolve(__dirname, '../../../..'), |
| 55 | + url: 'http://localhost:3000/templates/create-and-submit-templates', |
| 56 | + reuseExistingServer: !process.env.CI, |
| 57 | + stderr: 'pipe', |
| 58 | + }, |
| 59 | +}); |
0 commit comments