running-tools

A collection of tools for runners and their coaches
git clone https://git.ashermorgan.net/running-tools/
Log | Files | Refs | README

playwright.config.js (1620B)


      1 // @ts-check
      2 import { defineConfig, devices } from '@playwright/test';
      3 
      4 /**
      5  * Read environment variables from file.
      6  * https://github.com/motdotla/dotenv
      7  */
      8 // require('dotenv').config();
      9 
     10 /**
     11  * @see https://playwright.dev/docs/test-configuration
     12  */
     13 export default defineConfig({
     14   testDir: './tests/e2e',
     15 
     16   /* Run tests in files in parallel */
     17   fullyParallel: true,
     18 
     19   /* Fail the build on CI if you accidentally left test.only in the source code. */
     20   forbidOnly: !!process.env.CI,
     21 
     22   /* Retry on CI only */
     23   retries: process.env.CI ? 2 : 0,
     24 
     25   /* Opt out of parallel tests on CI. */
     26   workers: process.env.CI ? 1 : undefined,
     27 
     28   /* Reporter to use. See https://playwright.dev/docs/test-reporters */
     29   reporter: 'line',
     30 
     31   /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
     32   use: {
     33     /* Base URL to use in actions like `await page.goto('/')`. */
     34     baseURL: 'http://localhost:5173',
     35 
     36     /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
     37     trace: 'on-first-retry',
     38   },
     39 
     40   /* Configure projects for major browsers */
     41   projects: [
     42     {
     43       name: 'chromium',
     44       use: { ...devices['Desktop Chrome'] },
     45     },
     46 
     47     {
     48       name: 'firefox',
     49       use: { ...devices['Desktop Firefox'] },
     50     },
     51   ],
     52 
     53   /* Folder for test artifacts such as screenshots, videos, traces, etc. */
     54   outputDir: './tests/e2e/results/',
     55 
     56   /* Run your local dev server before starting the tests */
     57   webServer: {
     58     command: 'npm run dev',
     59     url: 'http://localhost:5173',
     60     reuseExistingServer: !process.env.CI,
     61   },
     62 });
     63