Skip to content

Releases: microsoft/playwright

v1.31.1

23 Feb 05:36
81d2394
Compare
Choose a tag to compare

Highlights

#21093 - [Regression v1.31] Headless Windows shows cascading cmd windows
#21106 - fix(loader): experimentalLoader with node@18

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

v1.31.0

21 Feb 19:13
Compare
Choose a tag to compare

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

v1.30.0

25 Jan 01:38
aea542f
Compare
Choose a tag to compare

🎉 Happy New Year 🎉

Maintenance release with bugfixes and new browsers only. We are baking some nice features for v1.31.

Browser Versions

  • Chromium 110.0.5481.38
  • Mozilla Firefox 108.0.2
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 109
  • Microsoft Edge 109

v1.29.2

06 Jan 18:04
64a18ac
Compare
Choose a tag to compare

Highlights

#19661 - [BUG] 1.29.1 browserserver + page.goto = net::ERR_SOCKS_CONNECTION_FAILED

Browser Versions

  • Chromium 109.0.5414.46
  • Mozilla Firefox 107.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 108
  • Microsoft Edge 108

v1.29.1

21 Dec 22:22
0bdca2b
Compare
Choose a tag to compare

Highlights

#18928 - [BUG] Electron firstWindow times out after upgrading to 1.28.0
#19246 - [BUG] Electron firstWindow times out after upgrading to 1.28.1
#19412 - [REGRESSION]: 1.28 does not work with electron-serve anymore.
#19540 - [BUG] electron.app.getAppPath() returns the path one level higher if you run electron pointing to the directory
#19548 - [REGRESSION]: Ubuntu 18 LTS not supported anymore

Browser Versions

  • Chromium 109.0.5414.46
  • Mozilla Firefox 107.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 108
  • Microsoft Edge 108

v1.29.0

16 Dec 22:51
00895e3
Compare
Choose a tag to compare

New APIs

  • New method route.fetch() and new option json for route.fulfill():

    await page.route('**/api/settings', async route => {
      // Fetch original settings.
      const response = await route.fetch();
    
      // Force settings theme to a predefined value.
      const json = await response.json();
      json.theme = 'Solorized';
    
      // Fulfill with modified data.
      await route.fulfill({ json });
    });
  • New method locator.all() to iterate over all matching elements:

    // Check all checkboxes!
    const checkboxes = page.getByRole('checkbox');
    for (const checkbox of await checkboxes.all())
      await checkbox.check();
  • Locator.selectOption matches now by value or label:

    <select multiple>
      <option value="red">Red</div>
      <option value="green">Green</div>
      <option value="blue">Blue</div>
    </select>
    await element.selectOption('Red');
  • Retry blocks of code until all assertions pass:

    await expect(async () => {
      const response = await page.request.get('https://api.example.com');
      await expect(response).toBeOK();
    }).toPass();

    Read more in our documentation.

  • Automatically capture full page screenshot on test failure:

    // playwright.config.ts
    import type { PlaywrightTestConfig } from '@playwright/test';
    
    const config: PlaywrightTestConfig = {
      use: {
        screenshot: {
          mode: 'only-on-failure',
          fullPage: true,
        }
      }
    };
    
    export default config;

Miscellaneous

Browser Versions

  • Chromium 109.0.5414.46
  • Mozilla Firefox 107.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 108
  • Microsoft Edge 108

v1.28.1

23 Nov 17:57
Compare
Choose a tag to compare

Highlights

This patch release includes the following bug fixes:

#18928 - [BUG] Electron firstWindow times out after upgrading to 1.28.0
#18920 - [BUG] [expanded=false] in role selector returns elements without aria-expanded attribute
#18865 - [BUG] regression in killing web server process in 1.28.0

Browser Versions

  • Chromium 108.0.5359.29
  • Mozilla Firefox 106.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 107
  • Microsoft Edge 107

v1.28

16 Nov 17:01
Compare
Choose a tag to compare

Playwright Tools

  • Record at Cursor in VSCode. You can run the test, position the cursor at the end of the test and continue generating the test.

New VSCode Extension

  • Live Locators in VSCode. You can hover and edit locators in VSCode to get them highlighted in the opened browser.
  • Live Locators in CodeGen. Generate a locator for any element on the page using "Explore" tool.

Locator Explorer

  • Codegen and Trace Viewer Dark Theme. Automatically picked up from operating system settings.

Dark Theme

Test Runner

New APIs

Browser Versions

  • Chromium 108.0.5359.29
  • Mozilla Firefox 106.0
  • WebKit 16.4

This version was also tested against the following stable channels:

  • Google Chrome 107
  • Microsoft Edge 107

v1.27.1

12 Oct 06:01
fde19c1
Compare
Choose a tag to compare

Highlights

This patch release includes the following bug fixes:

#18010 - fix(generator): generate nice locators for arbitrary selectors
#17999 - chore: don't fail on undefined video/trace
#17955 - [Question] Github Actions test compatibility check failed mitigation?
#17960 - [BUG] Codegen 1.27 creates NUnit code that does not compile
#17952 - fix: fix typo in treeitem role typing

Browser Versions

  • Chromium 107.0.5304.18
  • Mozilla Firefox 105.0.1
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 106
  • Microsoft Edge 106

v1.27.0

07 Oct 20:39
Compare
Choose a tag to compare

Locators

With these new APIs, inspired by Testing Library, writing locators is a joy:

await page.getByLabel('User Name').fill('John');

await page.getByLabel('Password').fill('secret-password');

await page.getByRole('button', { name: 'Sign in' }).click();

await expect(page.getByText('Welcome, John!')).toBeVisible();

All the same methods are also available on Locator, FrameLocator and Frame classes.

Other highlights

  • workers option in the playwright.config.ts now accepts a percentage string to use some of the available CPUs. You can also pass it in the command line:

    npx playwright test --workers=20%
  • New options host and port for the html reporter.

    reporters: [['html', { host: 'localhost', port: '9223' }]]
  • New field FullConfig.configFile is available to test reporters, specifying the path to the config file if any.

  • As announced in v1.25, Ubuntu 18 will not be supported as of Dec 2022. In addition to that, there will be no WebKit updates on Ubuntu 18 starting from the next Playwright release.

Behavior Changes

  • expect(locator).toHaveAttribute(name, value, options) with an empty value does not match missing attribute anymore. For example, the following snippet will succeed when button does not have a disabled attribute.

    await expect(page.getByRole('button')).toHaveAttribute('disabled', '');
  • Command line options --grep and --grep-invert previously incorrectly ignored grep and grepInvert options specified in the config. Now all of them are applied together.

  • JSON reporter path resolution is performed relative to the config directory instead of the current working directory:

    ["json", { outputFile: "./test-results/results.json" }]]

Browser Versions

  • Chromium 107.0.5304.18
  • Mozilla Firefox 105.0.1
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 106
  • Microsoft Edge 106