Releases: microsoft/playwright
v1.19.0
Playwright Test Updates
Soft assertions
Playwright Test v1.19 now supports soft assertions. Failed soft assertions do not terminate test execution, but mark the test as failed. Read more in our documentation.
// Make a few checks that will not stop the test when failed...
await expect.soft(page.locator('#status')).toHaveText('Success');
await expect.soft(page.locator('#eta')).toHaveText('1 day');
// ... and continue the test to check more things.
await page.locator('#next-page').click();
await expect.soft(page.locator('#title')).toHaveText('Make another order');
Custom error messages
You can now specify a custom error message as a second argument to the expect
and expect.soft
functions, for example:
await expect(page.locator('text=Name'), 'should be logged in').toBeVisible();
The error would look like this:
Error: should be logged in
Call log:
- expect.toBeVisible with timeout 5000ms
- waiting for selector "text=Name"
2 |
3 | test('example test', async({ page }) => {
> 4 | await expect(page.locator('text=Name'), 'should be logged in').toBeVisible();
| ^
5 | });
6 |
Parallel mode in file
By default, tests in a single file are run in order. If you have many independent tests in a single file, you can now
run them in parallel with method: test.describe.configure
:
import { test } from '@playwright/test';
test.describe.configure({ mode: 'parallel' });
test('parallel 1', async () => {});
test('parallel 2', async () => {});
⚠️ Potentially breaking change in Playwright Test Global Setup
It is unlikely that this change will affect you, no action is required if your tests keep running as they did.
We've noticed that in rare cases, the set of tests to be executed was configured in the global setup by means of the environment variables. We also noticed some applications that were post processing the reporters' output in the global teardown. If you are doing one of the two, learn more
Locator Updates
Locator now supports a has
option that makes sure it contains another locator inside:
await page.locator('article', {
has: page.locator('.highlight'),
}).locator('button').click();
The snippet above will select article that has highlight in it and will press the button in it.
Read more in locator documentation
Other Updates
- New
method: Locator.page
method: Page.screenshot
andmethod: Locator.screenshot
now automatically hides blinking caret- Playwright Codegen now generates locators and frame locators
- New option
url
intestConfig.webServer
to ensure your web server is ready before running the tests - New
property: TestInfo.errors
andproperty: TestResult.errors
that contain all failed assertions and soft assertions.
Browser Versions
- Chromium 100.0.4863.0
- Mozilla Firefox 96.0.1
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 98
- Microsoft Edge 98
v1.18.1
Highlights
This patch includes improvements to the TypeScript support and the following bug fixes:
#11550 - [REGRESSION]: Errors inside route handler does not lead to unhandled rejections anymore
#11552 - [BUG] Could not resolve "C:\repo\framework\utils" in file C:\repo\tests\test.ts.
Browser Versions
- Chromium 99.0.4812.0
- Mozilla Firefox 95.0
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 97
- Microsoft Edge 97
v1.18.0
Locator Improvements
locator.dragTo(locator)
expect(locator).toBeChecked({ checked })
- Each locator can now be optionally filtered by the text it contains:
Read more in locator documentation.
await page.locator('li', { hasText: 'my item' }).locator('button').click();
Testing API improvements
Improved TypeScript Support
- Playwright Test now respects
tsconfig.json
'sbaseUrl
andpaths
, so you can use aliases - There is a new environment variable
PW_EXPERIMENTAL_TS_ESM
that allows importing ESM modules in your TS code, without the need for the compile step. Don't forget the.js
suffix when you are importing your esm modules. Run your tests as follows:
npm i --save-dev @playwright/test@1.18.0
PW_EXPERIMENTAL_TS_ESM=1 npx playwright test
Create Playwright
The npm init playwright
command is now generally available for your use:
# Run from your project's root directory
npm init playwright
# Or create a new project
npm init playwright new-project
This will scaffold everything needed to get started with Playwright Test: configuration file, optionally add examples, a GitHub Action workflow and a first test example.spec.ts
.
New APIs & changes
- new
testCase.repeatEachIndex
API acceptDownloads
option now defaults totrue
Breaking change: custom config options
Custom config options are a convenient way to parametrize projects with different values. Learn more in the parametrization guide.
Previously, any fixture introduced through test.extend
could be overridden in the testProject.use
config section. For example,
// WRONG: THIS SNIPPET DOES NOT WORK SINCE v1.18.
// fixtures.js
const test = base.extend({
myParameter: 'default',
});
// playwright.config.js
module.exports = {
use: {
myParameter: 'value',
},
};
The proper way to make a fixture parametrized in the config file is to specify option: true
when defining the fixture. For example,
// CORRECT: THIS SNIPPET WORKS SINCE v1.18.
// fixtures.js
const test = base.extend({
// Fixtures marked as "option: true" will get a value specified in the config,
// or fallback to the default value.
myParameter: ['default', { option: true }],
});
// playwright.config.js
module.exports = {
use: {
myParameter: 'value',
},
};
Browser Versions
- Chromium 99.0.4812.0
- Mozilla Firefox 95.0
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 97
- Microsoft Edge 97
(1.18.0-beta-1642620709000
)
v1.18.0-rc1
Locator Improvements
locator.dragTo(locator)
expect(locator).toBeChecked({ checked })
- Each locator can now be optionally filtered by the text it contains:
Read more in locator documentation.
await page.locator('li', { hasText: 'my item' }).locator('button').click();
Testing API improvements
Improved TypeScript Support
- Playwright Test now respects
tsconfig.json
'sbaseUrl
andpaths
, so you can use aliases - There is a new environment variable
PW_EXPERIMENTAL_TS_ESM
that allows importing ESM modules in your TS code, without the need for the compile step. Don't forget the.js
suffix when you are importing your esm modules. Run your tests as follows:
npm i --save-dev @playwright/test@1.18.0-rc1
PW_EXPERIMENTAL_TS_ESM=1 npx playwright test
Create Playwright
The npm init playwright
command is now generally available for your use:
# Run from your project's root directory
npm init playwright
# Or create a new project
npm init playwright new-project
This will scaffold everything needed to get started with Playwright Test: configuration file, optionally add examples, a GitHub Action workflow and a first test example.spec.ts
.
New APIs & changes
- new
testCase.repeatEachIndex
API - new option fixtures
acceptDownloads
option now defaults totrue
Browser Versions
- Chromium 99.0.4812.0
- Mozilla Firefox 95.0
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 97
- Microsoft Edge 97
v1.17.2
v1.17.1
Highlights
This patch includes bug fixes for the following issues:
#10638 - [BUG] Locator.click -> subtree intercepts pointer events since version 1.17.0
#10632 - [BUG] Playwright 1.17.0 -> After clicking the element - I get an error that click action was failed
#10627 - [REGRESSION]: Can no longer click Material UI select box
#10620 - [BUG] trailing zero width whitespace fails toHaveText
Browser Versions
- Chromium 98.0.4695.0
- Mozilla Firefox 94.0.1
- WebKit 15.4
This version of Playwright was also tested against the following stable channels:
- Google Chrome 96
- Microsoft Edge 96
(1.17.1)
v1.17.0
Frame Locators
Playwright 1.17 introduces frame locators - a locator to the iframe on the page. Frame locators capture the logic sufficient to retrieve the iframe
and then locate elements in that iframe. Frame locators are strict by default, will wait for iframe
to appear and can be used in Web-First assertions.
Frame locators can be created with either page.frameLocator(selector)
or locator.frameLocator(selector)
method.
const locator = page.frameLocator('#my-iframe').locator('text=Submit');
await locator.click();
Read more at our documentation.
Trace Viewer Update
Playwright Trace Viewer is now available online at https://trace.playwright.dev! Just drag-and-drop your trace.zip
file to inspect its contents.
NOTE: trace files are not uploaded anywhere; trace.playwright.dev is a progressive web application that processes traces locally.
- Playwright Test traces now include sources by default (these could be turned off with tracing option)
- Trace Viewer now shows test name
- New trace metadata tab with browser details
- Snapshots now have URL bar
HTML Report Update
- HTML report now supports dynamic filtering
- Report is now a single static HTML file that could be sent by e-mail or as a slack attachment.
Ubuntu ARM64 support + more
- Playwright now supports Ubuntu 20.04 ARM64. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.
- You can now use Playwright to install stable version of Edge on Linux:
npx playwright install msedge
New APIs
- Tracing now supports a
'title'
option - Page navigations support a new
'commit'
waiting option - HTML reporter got new configuration options
testConfig.snapshotDir
optiontestInfo.parallelIndex
testInfo.titlePath
testOptions.trace
has new optionsexpect.toMatchSnapshot
supports subdirectoriesreporter.printsToStdio()
Browser Versions
- Chromium 98.0.4695.0
- Mozilla Firefox 94.0.1
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 96
- Microsoft Edge 96
v1.17.0-rc1
Frame Locators
Playwright 1.17 introduces frame locators - a locator to the iframe on the page. Frame locators capture the logic sufficient to retrieve the iframe
and then locate elements in that iframe. Frame locators are strict by default, will wait for iframe
to appear and can be used in Web-First assertions.
Frame locators can be created with either page.frameLocator(selector)
or locator.frameLocator(selector)
method.
const locator = page.frameLocator('#my-iframe').locator('text=Submit');
await locator.click();
Read more at our documentation.
Trace Viewer Update
Playwright Trace Viewer is now available online at https://trace.playwright.dev! Just drag-and-drop your trace.zip
file to inspect its contents.
NOTE: trace files are not uploaded anywhere; trace.playwright.dev is a progressive web application that processes traces locally.
- Playwright Test traces now include sources by default (these could be turned off with tracing option)
- Trace Viewer now shows test name
- New trace metadata tab with browser details
- Snapshots now have URL bar
HTML Report Update
- HTML report now supports dynamic filtering
- Report is now a single static HTML file that could be sent by e-mail or as a slack attachment.
Ubuntu ARM64 support + more
- Playwright now supports Ubuntu 20.04 ARM64. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.
- You can now use Playwright to install stable version of Edge on Linux:
npx playwright install msedge
New APIs
- Tracing now supports a
'title'
option - Page navigations support a new
'commit'
waiting option - HTML reporter got new configuration options
testConfig.snapshotDir
optiontestInfo.parallelIndex
testInfo.titlePath
testOptions.trace
has new optionsexpect.toMatchSnapshot
supports subdirectoriesreporter.printsToStdio()
v1.16.3
Highlights
This patch includes bug fixes for the following issues:
#9849 - [BUG]: toHaveCount fails with serialization error in 1.16 when elements do not yet exists
#9897 - [Bug]: TraceViewer doesn't show actions
#9902 - [BUG] Warn if the html-report gets opened with file://
Browser Versions
- Chromium 97.0.4666.0
- Mozilla Firefox 93.0
- WebKit 15.4
This version of Playwright was also tested against the following stable channels:
- Google Chrome 94
- Microsoft Edge 94
(1.16.3-1635814179000)
v1.16.2
Highlights
This patch includes bug fixes for the following issues:
#7818 - [Bug]: dedup snapshot CSS images
#9741 - [BUG] Error while an attempt to install Playwright in CI -> Failed at the playwright@1.16.1 install script
#9756 - [Regression] Page.screenshot does not work inside Docker with BrowserServer
#9759 - [BUG] 1.16.x the package.json is not export anymore
#9760 - [BUG] snapshot updating causes failures for all tries except the last
#9768 - [BUG] ignoreHTTPSErrors not working on page.request
Browser Versions
- Chromium 97.0.4666.0
- Mozilla Firefox 93.0
- WebKit 15.4
This version of Playwright was also tested against the following stable channels:
- Google Chrome 94
- Microsoft Edge 94
(1.16.2-1635322350000)