github.com/kubeshop/testkube@v1.17.23/test/playwright/executor-tests/playwright-project/playwright.config.js (about)

     1  // @ts-check
     2  const { defineConfig, devices } = require('@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  module.exports = defineConfig({
    14    testDir: './tests',
    15    /* Maximum time one test can run for. */
    16    timeout: 30 * 1000,
    17    expect: {
    18      /**
    19       * Maximum time expect() should wait for the condition to be met.
    20       * For example in `await expect(locator).toHaveText();`
    21       */
    22      timeout: 5000
    23    },
    24    /* Run tests in files in parallel */
    25    fullyParallel: true,
    26    /* Fail the build on CI if you accidentally left test.only in the source code. */
    27    forbidOnly: !!process.env.CI,
    28    /* Retry on CI only */
    29    retries: process.env.CI ? 2 : 0,
    30    /* Opt out of parallel tests on CI. */
    31    workers: process.env.CI ? 1 : undefined,
    32    /* Reporter to use. See https://playwright.dev/docs/test-reporters */
    33    reporter: 'html',
    34    /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
    35    use: {
    36      /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
    37      actionTimeout: 0,
    38      /* Base URL to use in actions like `await page.goto('/')`. */
    39      // baseURL: 'http://localhost:3000',
    40  
    41      /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    42      trace: 'on-first-retry',
    43    },
    44  
    45    /* Configure projects for major browsers */
    46    projects: [
    47      {
    48        name: 'chromium',
    49        use: { ...devices['Desktop Chrome'] },
    50      },
    51  
    52      {
    53        name: 'firefox',
    54        use: { ...devices['Desktop Firefox'] },
    55      },
    56  
    57      // {
    58      //   name: 'webkit',
    59      //   use: { ...devices['Desktop Safari'] },
    60      // },
    61  
    62      /* Test against mobile viewports. */
    63      // {
    64      //   name: 'Mobile Chrome',
    65      //   use: { ...devices['Pixel 5'] },
    66      // },
    67      // {
    68      //   name: 'Mobile Safari',
    69      //   use: { ...devices['iPhone 12'] },
    70      // },
    71  
    72      /* Test against branded browsers. */
    73      // {
    74      //   name: 'Microsoft Edge',
    75      //   use: { channel: 'msedge' },
    76      // },
    77      // {
    78      //   name: 'Google Chrome',
    79      //   use: { channel: 'chrome' },
    80      // },
    81    ],
    82  
    83    /* Folder for test artifacts such as screenshots, videos, traces, etc. */
    84    // outputDir: 'test-results/',
    85  
    86    /* Run your local dev server before starting the tests */
    87    // webServer: {
    88    //   command: 'npm run start',
    89    //   port: 3000,
    90    // },
    91  });
    92