Releases: microsoft/playwright
v1.31.2
Highlights
#20784 - [BUG] ECONNREFUSED on GitHub Actions with Node 18
#21145 - [REGRESSION]: firefox-1378 times out on await page.reload() when URL contains a #hash
#21226 - [BUG] Playwright seems to get stuck when using shard option and last test is skipped
#21227 - Using the webServer config with a Vite dev server?
#21312 - throw if defineConfig is not used for component testing
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.1
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
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 inplaywright.config
. - New option
maxRedirects
for methodRoute.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
🎉 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
v1.29.1
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
New APIs
-
New method
route.fetch()
and new optionjson
forroute.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
- Playwright Test now respects
jsconfig.json
. - New options
args
andproxy
forandroidDevice.launchBrowser()
. - Option
postData
in methodroute.continue()
now supports serializable values. - Ubuntu 18.04 is 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.28.1
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
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.
- 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.
- Codegen and Trace Viewer Dark Theme. Automatically picked up from operating system settings.
Test Runner
-
Configure retries and test timeout for a file or a test with
test.describe.configure([options])
.// Each test in the file will be retried twice and have a timeout of 20 seconds. test.describe.configure({ retries: 2, timeout: 20_000 }); test('runs first', async ({ page }) => {}); test('runs second', async ({ page }) => {});
-
Use
testProject.snapshotPathTemplate
andtestConfig.snapshotPathTemplate
to configure a template controlling location of snapshots generated byexpect(page).toHaveScreenshot(name[, options])
andexpect(screenshot).toMatchSnapshot(name[, options])
.// playwright.config.ts import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { testDir: './tests', snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}', }; export default config;
New APIs
locator.blur([options])
locator.clear([options])
android.launchServer([options])
andandroid.connect(wsEndpoint[, options])
androidDevice.on('close')
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
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