jest-playwright icon indicating copy to clipboard operation
jest-playwright copied to clipboard

[Question] Is it possible to have a custom defineConfig for playwright ?

Open vmalay opened this issue 10 months ago • 0 comments

Hello,

I would like to know if it's possible to have our own custom defineConfig from playwright ?

Playwright offers a lot of configuration by adding a custom playwright.config.ts file, doc: https://playwright.dev/docs/test-configuration.

I want for example to modify the fullyParallel, the retries and the workers.

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  // Look for test files in the "tests" directory, relative to this configuration file.
  testDir: 'tests',

  // Run all tests in parallel.
  fullyParallel: true,

  // Fail the build on CI if you accidentally left test.only in the source code.
  forbidOnly: !!process.env.CI,

  // Retry on CI only.
  retries: process.env.CI ? 2 : 0,

  // Opt out of parallel tests on CI.
  workers: process.env.CI ? 1 : undefined,

  // Reporter to use
  reporter: 'html',

  use: {
    // Collect trace when retrying the failed test.
    trace: 'on-first-retry',
  },
  // Configure projects for major browsers.
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
});

Is it possible to customize it ?

vmalay avatar Jan 29 '25 11:01 vmalay