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 // require('dotenv').config(); 8 9 /** 10 * @see https://playwright.dev/docs/test-configuration 11 */ 12 export default defineConfig({ 13 timeout: 1000 * 15, 14 /* timeout 15 seconds */ 15 testDir: './tests', 16 /* Run tests in files in parallel */ 17 fullyParallel: false, 18 /* Fail the build on CI if you accidentally left test.only in the source code. */ 19 forbidOnly: Boolean(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: 'http://127.0.0.1:8000', 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 // name: 'firefox', 43 // use: { ...devices['Desktop Firefox'] } 44 // }, 45 46 // { 47 // name: 'webkit', 48 // use: { ...devices['Desktop Safari'] } 49 // } 50 ] 51 // expect: { 52 // toHaveScreenshot: { maxDiffPixels: 2000 } 53 // } 54 })