Playwright

Instructions for getting your Playwright tests to run on Testery

Playwright enables reliable end-to-end testing for modern web apps. Here's more information on Getting Started with Playwright.

Your project requires simple modifications to your playwright config file.

Parallel

Testery will handle the level of parallelism for the test files, so for best result set this option to false. If you would like to keep this true for local runs and false for Testery, you can add an environment variable check for IS_TESTERY and set to false when present.

fullyParallel: false
fullyParallel: process.env.IS_TESTERY ? false : true

Retries

Testery also will handle any retries, so it's best to leave them at 0 when running on the cloud.

retries: 0

Viewport

Add the viewport option in your use array for each project under the projects array and set to 1920x1080. This will allow better sized video and screenshots to be displayed in Testery.

  use: {
    ...devices['Desktop Chrome'],
    channel: 'chrome',
    viewport: { width: 1920, height: 1080 },
  }

Screenshots

If you want your captured screenshots to display in Testery, you'll need adjust the outputDir option to a predefined path: ./screenshots

outputDir: './screenshots'

Also make sure your use block to contains right value for screenshots to be taken. For example:

screenshot: 'only-on-failure'

For better screenshot names, it's recommended to use a fixture instead.

  screenshots: [async ({ page }, use, testInfo) => {
    await use()
    await page.screenshot({ path: `./screenshots/${testInfo.title}.png` })
  }, { auto: true }],

Suggested Testery config example

export default defineConfig({
  testDir,
  outputDir: './screenshots',
  fullyParallel: false, // Testery will handle the parallelism
  retries: 0, // Testery will handle the retries
  workers: 4, // Leave this to local running preference. Testery will run one at a time per worker (File/Feature)
  reporter: [['list']], // Leave this to local running preference. Testery will change this to json report when running on cloud
  use: {
    trace: 'retain-on-failure',
    screenshot: 'only-on-failure'
  },
  timeout: 60_000, // Make sure this is less than test timeout in Testery to get more detailed timeout error in the log

  projects: [ // recommend using the playwright project field in test runs to separate different project to different runs
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], 
      viewport: { width: 1920, height: 1080 } }
    }
  ]
})

Last updated

Was this helpful?