AI Resource Pro / website / playwright.config.ts
| 1 | import { defineConfig, devices } from '@playwright/test'; |
| 2 | |
| 3 | /** |
| 4 | * Read environment variables from file. |
| 5 | * https://github.com/motdotla/dotenv |
| 6 | */ |
| 7 | // import dotenv from 'dotenv'; |
| 8 | // import path from 'path'; |
| 9 | // dotenv.config({ path: path.resolve(__dirname, '.env') }); |
| 10 | |
| 11 | /** |
| 12 | * See https://playwright.dev/docs/test-configuration. |
| 13 | */ |
| 14 | export default defineConfig({ |
| 15 | testDir: './e2e', |
| 16 | /* Run tests in files in parallel */ |
| 17 | fullyParallel: true, |
| 18 | /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 19 | forbidOnly: !!process.env.CI, |
| 20 | /* Retry on CI only */ |
| 21 | retries: process.env.CI ? 2 : 0, |
| 22 | /* Opt out of parallel tests on CI. */ |
| 23 | workers: process.env.CI ? 1 : undefined, |
| 24 | /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 25 | reporter: 'html', |
| 26 | /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 27 | use: { |
| 28 | /* Base URL to use in actions like `await page.goto('')`. */ |
| 29 | baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3001', |
| 30 | |
| 31 | /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 32 | trace: 'on-first-retry', |
| 33 | }, |
| 34 | |
| 35 | /* Configure projects for major browsers */ |
| 36 | projects: [ |
| 37 | { |
| 38 | name: 'chromium', |
| 39 | use: { ...devices['Desktop Chrome'] }, |
| 40 | }, |
| 41 | |
| 42 | { |
| 43 | name: 'firefox', |
| 44 | use: { ...devices['Desktop Firefox'] }, |
| 45 | }, |
| 46 | |
| 47 | { |
| 48 | name: 'webkit', |
| 49 | use: { ...devices['Desktop Safari'] }, |
| 50 | }, |
| 51 | |
| 52 | /* Test against mobile viewports. */ |
| 53 | // { |
| 54 | // name: 'Mobile Chrome', |
| 55 | // use: { ...devices['Pixel 5'] }, |
| 56 | // }, |
| 57 | // { |
| 58 | // name: 'Mobile Safari', |
| 59 | // use: { ...devices['iPhone 12'] }, |
| 60 | // }, |
| 61 | |
| 62 | /* Test against branded browsers. */ |
| 63 | // { |
| 64 | // name: 'Microsoft Edge', |
| 65 | // use: { ...devices['Desktop Edge'], channel: 'msedge' }, |
| 66 | // }, |
| 67 | // { |
| 68 | // name: 'Google Chrome', |
| 69 | // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, |
| 70 | // }, |
| 71 | ], |
| 72 | |
| 73 | /* Run your local dev server before starting the tests */ |
| 74 | // webServer: { |
| 75 | // command: 'npm run start', |
| 76 | // url: 'http://localhost:3000', |
| 77 | // reuseExistingServer: !process.env.CI, |
| 78 | // }, |
| 79 | }); |