Releases: microsoft/playwright
v1.25.1
Highlights
This patch includes the following bug fixes:
#16319 - [BUG] webServer.command esbuild fails with ESM and Yarn
#16460 - [BUG] Component test fails on 2nd run when SSL is used
#16665 - [BUG] custom selector engines don't work when running in debug mode
Browser Versions
- Chromium 105.0.5195.19
- Mozilla Firefox 103.0
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 104
- Microsoft Edge 104
v1.25.0
VSCode Extension
-
New Playwright actions view
-
Pick selector
You can pick selector right from a live page, before or after running a test -
Record new test
Start recording where you left off with the new 'Record new test' feature. -
Show & reuse browser
Watch your tests running live & keep devtools open. Develop while continuously running tests.
Test Runner
-
test.step(title, body)
now returns the value of the step function:test('should work', async ({ page }) => { const pageTitle = await test.step('get title', async () => { await page.goto('https://playwright.dev'); return await page.title(); }); console.log(pageTitle); });
-
New
'interrupted'
test status. -
Enable tracing via CLI flag:
npx playwright test --trace=on
. -
New property
testCase.id
that can be use in reporters as a history ID.
Announcements
- 🎁 We now ship Ubuntu 22.04 Jammy Jellyfish docker image:
mcr.microsoft.com/playwright:v1.25.0-jammy
. - 🪦 This is the last release with macOS 10.15 support (deprecated as of 1.21).
- 🪦 This is the last release with Node.js 12 support, we recommend upgrading to Node.js LTS (16).
⚠️ Ubuntu 18 is now deprecated and will not be supported as of Dec 2022.
Browser Versions
- Chromium 105.0.5195.19
- Mozilla Firefox 103.0
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 104
- Microsoft Edge 104
v1.24.2
Highlights
This patch includes the following bug fixes:
#15977 - [BUG] test.use of storage state regression in 1.24
Browser Versions
- Chromium 104.0.5112.48
- Mozilla Firefox 102.0
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.24.1
Highlights
This patch includes the following bug fixes:
#15898 - [BUG] Typescript error: The type for webServer config property (TestConfigWebServer) is not typed correctly
#15913 - [BUG] hooksConfig is required for mount fixture
#15932 - [BUG] - Install MS Edge on CI Fails
Browser Versions
- Chromium 104.0.5112.48
- Mozilla Firefox 102.0
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.24.0
🌍 Multiple Web Servers in playwright.config.ts
Launch multiple web servers, databases, or other processes by passing an array of configurations:
// playwright.config.ts
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: [
{
command: 'npm run start',
port: 3000,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
{
command: 'npm run backend',
port: 3333,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
}
],
use: {
baseURL: 'http://localhost:3000/',
},
};
export default config;
🐂 Debian 11 Bullseye Support
Playwright now supports Debian 11 Bullseye on x86_64 for Chromium, Firefox and WebKit. Let us know
if you encounter any issues!
Linux support looks like this:
Ubuntu 18.04 | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | |
---|---|---|---|---|
Chromium | ✅ | ✅ | ✅ | ✅ |
WebKit | ✅ | ✅ | ✅ | ✅ |
Firefox | ✅ | ✅ | ✅ | ✅ |
🕵️ Anonymous Describe
It is now possible to call test.describe(callback)
to create suites without a title. This is useful for giving a group of tests a common option with test.use(options)
.
test.describe(() => {
test.use({ colorScheme: 'dark' });
test('one', async ({ page }) => {
// ...
});
test('two', async ({ page }) => {
// ...
});
});
🧩 Component Tests Update
Playwright 1.24 Component Tests introduce beforeMount
and afterMount
hooks.
Use these to configure your app for tests.
Vue + Vue Router
For example, this could be used to setup App router in Vue.js:
// src/component.spec.ts
import { test } from '@playwright/experimental-ct-vue';
import { Component } from './mycomponent';
test('should work', async ({ mount }) => {
const component = await mount(Component, {
hooksConfig: {
/* anything to configure your app */
}
});
});
// playwright/index.ts
import { router } from '../router';
import { beforeMount } from '@playwright/experimental-ct-vue/hooks';
beforeMount(async ({ app, hooksConfig }) => {
app.use(router);
});
React + Next.js
A similar configuration in Next.js would look like this:
// src/component.spec.jsx
import { test } from '@playwright/experimental-ct-react';
import { Component } from './mycomponent';
test('should work', async ({ mount }) => {
const component = await mount(<Component></Component>, {
// Pass mock value from test into `beforeMount`.
hooksConfig: {
router: {
query: { page: 1, per_page: 10 },
asPath: '/posts'
}
}
});
});
// playwright/index.js
import router from 'next/router';
import { beforeMount } from '@playwright/experimental-ct-react/hooks';
beforeMount(async ({ hooksConfig }) => {
// Before mount, redefine useRouter to return mock value from test.
router.useRouter = () => hooksConfig.router;
});
Browser Versions
- Chromium 104.0.5112.48
- Mozilla Firefox 102.0
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.23.4
Highlights
This patch includes the following bug fix:
#15717 - [REGRESSION]: Suddenly stopped working despite nothing having changed (experimentalLoader.js:load
did not call the next hook in its chain and did not explicitly signal a short circuit)
Browser Versions
- Chromium 104.0.5112.20
- Mozilla Firefox 100.0.2
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.23.3
Highlights
This patch includes the following bug fixes:
#15557 - [REGRESSION]: Event Listeners not being removed if same handler is used for different events
Browser Versions
- Chromium 104.0.5112.20
- Mozilla Firefox 100.0.2
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.23.2
Highlights
This patch includes the following bug fixes:
#15273 - [BUG] LaunchOptions config has no effect after update to v1.23.0
#15351 - [REGRESSION]: Component testing project does not compile anymore
#15431 - [BUG] Regression: page.on('console') is ignored in 1.23
Browser Versions
- Chromium 104.0.5112.20
- Mozilla Firefox 100.0.2
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.23.1
Highlights
This patch includes the following bug fixes:
#15219 - [REGRESSION]: playwright-core 1.23.0 issue with 'TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument'
Browser Versions
- Chromium 104.0.5112.20
- Mozilla Firefox 100.0.2
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 103
- Microsoft Edge 103
v1.23.0
Network Replay
Now you can record network traffic into a HAR file and re-use the data in your tests.
To record network into HAR file:
npx playwright open --save-har=github.har.zip https://github.com/microsoft
Alternatively, you can record HAR programmatically:
const context = await browser.newContext({
recordHar: { path: 'github.har.zip' }
});
// ... do stuff ...
await context.close();
Use the new methods page.routeFromHAR()
or browserContext.routeFromHAR()
to serve matching responses from the HAR file:
await context.routeFromHAR('github.har.zip');
Read more in our documentation.
Advanced Routing
You can now use route.fallback()
to defer routing to other handlers.
Consider the following example:
// Remove a header from all requests.
test.beforeEach(async ({ page }) => {
await page.route('**/*', route => {
const headers = route.request().headers();
delete headers['if-none-match'];
route.fallback({ headers });
});
});
test('should work', async ({ page }) => {
await page.route('**/*', route => {
if (route.request().resourceType() === 'image')
route.abort();
else
route.fallback();
});
});
Note that the new methods page.routeFromHAR()
and browserContext.routeFromHAR()
also participate in routing and could be deferred to.
Web-First Assertions Update
- New method
expect(locator).toHaveValues()
that asserts all selected values of<select multiple>
element. - Methods
expect(locator).toContainText()
andexpect(locator).toHaveText()
now acceptignoreCase
option.
Component Tests Update
- Support for Vue2 via the
@playwright/experimental-ct-vue2
package. - Support for component tests for create-react-app with components in
.js
files.
Read more about component testing with Playwright.
Miscellaneous
- If there's a service worker that's in your way, you can now easily disable it with a new context option
serviceWorkers
:// playwright.config.ts export default { use: { serviceWorkers: 'block', } }
- Using
.zip
path forrecordHar
context option automatically zips the resulting HAR:const context = await browser.newContext({ recordHar: { path: 'github.har.zip', } });
- If you intend to edit HAR by hand, consider using the
"minimal"
HAR recording mode
that only records information that is essential for replaying:const context = await browser.newContext({ recordHar: { path: 'github.har.zip', mode: 'minimal', } });
- Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64. We also publish new docker image
mcr.microsoft.com/playwright:v1.23.0-focal
.
⚠️ Breaking Changes ⚠️
WebServer is now considered "ready" if request to the specified port has any of the following HTTP status codes:
200-299
300-399
(new)400
,401
,402
,403
(new)