|
| 1 | +import { nxE2EPreset } from '@nx/playwright/preset'; |
| 2 | +import { defineConfig, devices } from '@playwright/test'; |
| 3 | + |
| 4 | +import { workspaceRoot } from '@nx/devkit'; |
| 5 | + |
| 6 | +// For CI, you may want to set BASE_URL to the deployed application. |
| 7 | +const baseURL = process.env['BASE_URL'] || 'http://localhost:5173'; |
| 8 | + |
| 9 | +/** |
| 10 | + * Read environment variables from file. |
| 11 | + * https://github.com/motdotla/dotenv |
| 12 | + */ |
| 13 | +// require('dotenv').config(); |
| 14 | + |
| 15 | +/** |
| 16 | + * See https://playwright.dev/docs/test-configuration. |
| 17 | + */ |
| 18 | +export default defineConfig({ |
| 19 | + ...nxE2EPreset(__filename, { testDir: './e2e' }), |
| 20 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 21 | + use: { |
| 22 | + baseURL, |
| 23 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 24 | + trace: 'on-first-retry', |
| 25 | + }, |
| 26 | + /* Run your local dev server before starting the tests */ |
| 27 | + webServer: { |
| 28 | + command: 'pnpm dev', |
| 29 | + url: 'http://localhost:5173', |
| 30 | + reuseExistingServer: !process.env.CI, |
| 31 | + cwd: workspaceRoot, |
| 32 | + // timeout: 120000, |
| 33 | + }, |
| 34 | + projects: [ |
| 35 | + { |
| 36 | + name: 'chromium', |
| 37 | + use: { ...devices['Desktop Chrome'] }, |
| 38 | + }, |
| 39 | + |
| 40 | + { |
| 41 | + name: 'firefox', |
| 42 | + use: { ...devices['Desktop Firefox'] }, |
| 43 | + }, |
| 44 | + |
| 45 | + { |
| 46 | + name: 'webkit', |
| 47 | + use: { ...devices['Desktop Safari'] }, |
| 48 | + }, |
| 49 | + |
| 50 | + // Uncomment for mobile browsers support |
| 51 | + /* { |
| 52 | + name: 'Mobile Chrome', |
| 53 | + use: { ...devices['Pixel 5'] }, |
| 54 | + }, |
| 55 | + { |
| 56 | + name: 'Mobile Safari', |
| 57 | + use: { ...devices['iPhone 12'] }, |
| 58 | + }, */ |
| 59 | + |
| 60 | + // Uncomment for branded browsers |
| 61 | + /* { |
| 62 | + name: 'Microsoft Edge', |
| 63 | + use: { ...devices['Desktop Edge'], channel: 'msedge' }, |
| 64 | + }, |
| 65 | + { |
| 66 | + name: 'Google Chrome', |
| 67 | + use: { ...devices['Desktop Chrome'], channel: 'chrome' }, |
| 68 | + } */ |
| 69 | + ], |
| 70 | +}); |
0 commit comments