|
| 1 | +import { defineConfig, devices } from '@playwright/test' |
| 2 | + |
| 3 | +/** |
| 4 | + * See https://playwright.dev/docs/test-configuration. |
| 5 | + */ |
| 6 | +export default defineConfig({ |
| 7 | + testDir: './tests', |
| 8 | + /* Run tests in files in parallel */ |
| 9 | + fullyParallel: true, |
| 10 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 11 | + forbidOnly: !!process.env.CI, |
| 12 | + /* Retry on CI only */ |
| 13 | + retries: process.env.CI ? 2 : 0, |
| 14 | + /* Opt out of parallel tests on CI. */ |
| 15 | + workers: process.env.CI ? 1 : undefined, |
| 16 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 17 | + reporter: 'html', |
| 18 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 19 | + use: { |
| 20 | + /* Base URL to use in actions like `await page.goto('/')`. */ |
| 21 | + // baseURL: 'http://127.0.0.1:3000', |
| 22 | + |
| 23 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 24 | + trace: 'on-first-retry', |
| 25 | + }, |
| 26 | + |
| 27 | + /* Configure projects for major browsers */ |
| 28 | + projects: [ |
| 29 | + { |
| 30 | + name: 'chromium', |
| 31 | + use: { ...devices['Desktop Chrome'] }, |
| 32 | + }, |
| 33 | + { |
| 34 | + name: 'webkit', |
| 35 | + use: { ...devices['Desktop Safari'] }, |
| 36 | + }, |
| 37 | + { |
| 38 | + name: 'firefox', |
| 39 | + use: { |
| 40 | + ...devices['Desktop Firefox'], |
| 41 | + // https://playwright.dev/docs/test-use-options#more-browser-and-context-options |
| 42 | + launchOptions: { |
| 43 | + // https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-firefox-user-prefs |
| 44 | + firefoxUserPrefs: { |
| 45 | + // By default, headless Firefox runs as though no pointers |
| 46 | + // capabilities are available. |
| 47 | + // https://github.com/microsoft/playwright/issues/7769#issuecomment-966098074 |
| 48 | + // |
| 49 | + // This impacts our `hover` variant implementation which uses an |
| 50 | + // '(hover: hover)' media query to determine if hover is available. |
| 51 | + // |
| 52 | + // Available values for pointer capabilities: |
| 53 | + // NO_POINTER = 0x00; |
| 54 | + // COARSE_POINTER = 0x01; |
| 55 | + // FINE_POINTER = 0x02; |
| 56 | + // HOVER_CAPABLE_POINTER = 0x04; |
| 57 | + // |
| 58 | + // Setting to 0x02 | 0x04 says the system supports a mouse |
| 59 | + 'ui.primaryPointerCapabilities': 0x02 | 0x04, |
| 60 | + 'ui.allPointerCapabilities': 0x02 | 0x04, |
| 61 | + }, |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + ], |
| 66 | +}) |
0 commit comments