Playwright - v1.19.0


Version 1.19

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.

```js
// 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:

js await expect(page.locator('text=Name'), 'should be logged in').toBeVisible();

The error would look like this:

```bash
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:

```js
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:

js 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


Details

date
Feb. 11, 2022, 10:26 p.m.
name
v1.19.0
type
Minor
👇
Register or login to:
  • 🔍View and search all Playwright releases.
  • 🛠️Create and share lists to track your tools.
  • 🚨Setup notifications for major, security, feature or patch updates.
  • 🚀Much more coming soon!
Continue with GitHub
Continue with Google
or