Skip to content

v1.31.0

Compare
Choose a tag to compare
@dgozman dgozman released this 21 Feb 19:13
· 12 commits to release-1.31 since this release

New APIs

  • New property TestProject.dependencies to configure dependencies between projects.

    Using dependencies allows global setup to produce traces and other artifacts,
    see the setup steps in the test report and more.

    // playwright.config.ts
    import { defineConfig } from '@playwright/test';
    
    export default defineConfig({
      projects: [
        {
          name: 'setup',
          testMatch: /global.setup\.ts/,
        },
        {
          name: 'chromium',
          use: devices['Desktop Chrome'],
          dependencies: ['setup'],
        },
        {
          name: 'firefox',
          use: devices['Desktop Firefox'],
          dependencies: ['setup'],
        },
        {
          name: 'webkit',
          use: devices['Desktop Safari'],
          dependencies: ['setup'],
        },
      ],
    });
  • New assertion expect(locator).toBeInViewport() ensures that locator points to an element that intersects viewport, according to the intersection observer API.

    const button = page.getByRole('button');
    
    // Make sure at least some part of element intersects viewport.
    await expect(button).toBeInViewport();
    
    // Make sure element is fully outside of viewport.
    await expect(button).not.toBeInViewport();
    
    // Make sure that at least half of the element intersects viewport.
    await expect(button).toBeInViewport({ ratio: 0.5 });

Miscellaneous

  • DOM snapshots in trace viewer can be now opened in a separate window.
  • New method defineConfig to be used in playwright.config.
  • New option maxRedirects for method Route.fetch.
  • Playwright now supports Debian 11 arm64.
  • Official docker images now include Node 18 instead of Node 16.

⚠️ Breaking change in component tests

Note: component tests only, does not affect end-to-end tests.

playwright-ct.config configuration file for component testing now requires calling defineConfig.

// Before

import { type PlaywrightTestConfig, devices } from '@playwright/experimental-ct-react';
const config: PlaywrightTestConfig = {
  // ... config goes here ...
};
export default config;

Replace config variable definition with defineConfig call:

// After

import { defineConfig, devices } from '@playwright/experimental-ct-react';
export default defineConfig({
  // ... config goes here ...
});

Browser Versions

  • Chromium 111.0.5563.19
  • Mozilla Firefox 109.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 110
  • Microsoft Edge 110