Skip to content

Commit 77e1b02

Browse files
authored
docs: 1.42 release notes (#29666)
1 parent c1421bc commit 77e1b02

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

docs/src/release-notes-js.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,82 @@ toc_max_heading_level: 2
66

77
import LiteYouTube from '@site/src/components/LiteYouTube';
88

9+
## Version 1.42
10+
11+
### New APIs
12+
13+
- New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears:
14+
```js
15+
// Setup the handler.
16+
await page.addLocatorHandler(page.getByRole('button', { name: 'Accept all cookies' }), async () => {
17+
await page.getByRole('button', { name: 'Reject all cookies' }).click();
18+
});
19+
20+
// Write the test as usual.
21+
await page.goto('https://example.com');
22+
await page.getByRole('button', { name: 'Start here' }).click();
23+
```
24+
25+
- `expect(callback).toPass()` timeout can now be configured by `expect.toPass.timeout` option [globally](./api/class-testconfig#test-config-expect) or in [project config](./api/class-testproject#test-project-expect)
26+
27+
- [`event: ElectronApplication.console`] event is emitted when Electron main process calls console API methods.
28+
```js
29+
electronApp.on('console', async msg => {
30+
const values = [];
31+
for (const arg of msg.args())
32+
values.push(await arg.jsonValue());
33+
console.log(...values);
34+
});
35+
await electronApp.evaluate(() => console.log('hello', 5, { foo: 'bar' }));
36+
```
37+
38+
- [New syntax](./test-annotations#tag-tests) for adding tags to the tests (@-tokens in the test title are still supported):
39+
```js
40+
test('test customer login', {
41+
tag: ['@fast', '@login'],
42+
}, async ({ page }) => {
43+
// ...
44+
});
45+
```
46+
Use `--grep` command line option to run only tests with certain tags.
47+
```sh
48+
npx playwright test --grep @fast
49+
```
50+
51+
- `--project` command line [flag](./test-cli#reference) now supports '*' wildcard:
52+
```sh
53+
npx playwright test --project='*mobile*'
54+
```
55+
56+
- [New syntax](./test-annotations#annotate-tests) for test annotations:
57+
```js
58+
test('test full report', {
59+
annotation: [
60+
{ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/23180' },
61+
{ type: 'docs', description: 'https://playwright.dev/docs/test-annotations#tag-tests' },
62+
],
63+
}, async ({ page }) => {
64+
// ...
65+
});
66+
```
67+
68+
- [`method: Page.pdf`] accepts two new options [`tagged`](./api/class-page#page-pdf-option-tagged) and [`outline`](./api/class-page#page-pdf-option-outline).
69+
70+
### Announcements
71+
72+
* ⚠️ Ubuntu 18 is not supported anymore.
73+
74+
### Browser Versions
75+
76+
* Chromium 123.0.6312.4
77+
* Mozilla Firefox 123.0
78+
* WebKit 17.4
79+
80+
This version was also tested against the following stable channels:
81+
82+
* Google Chrome 122
83+
* Microsoft Edge 123
84+
985
## Version 1.41
1086

1187
### New APIs

0 commit comments

Comments
 (0)