Skip to content

Commit 7b2ef21

Browse files
Skn0ttdgozman
andauthored
docs: 1.57 release notes (microsoft#38267)
Signed-off-by: Simon Knott <[email protected]> Co-authored-by: Dmitry Gozman <[email protected]>
1 parent 2564055 commit 7b2ef21

File tree

5 files changed

+127
-0
lines changed

5 files changed

+127
-0
lines changed
66.4 KB
Loading

docs/src/images/speedboard.png

655 KB
Loading

docs/src/release-notes-js.md

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

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

9+
## Version 1.57
10+
11+
### Speedboard
12+
13+
In HTML reporter, there's a new tab we call "Speedboard":
14+
15+
![Speedboard](./images/speedboard.png)
16+
17+
It shows you all your executed tests sorted by slowness,
18+
and can help you understand where your test suite is taking longer than expected.
19+
Take a look at yours - maybe you'll find some tests that are spending a longer time waiting than they should!
20+
21+
### Chrome for Testing
22+
23+
Starting with this release, Playwright switches from Chromium, to using [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) builds.
24+
Both headed and headless browsers are subject to this.
25+
Your tests should still be passing after upgrading to Playwright 1.57.
26+
We're expecting no functional changes to come from this switch - the biggest change is the new icon and title in your toolbar:
27+
28+
![new and old logo](./images/cft-logo-change.png)
29+
30+
If you still see an unexpected behaviour change, please [file an issue](https://github.com/microsoft/playwright/issues/new).
31+
32+
On Arm64 Linux, Playwright continues to use Chromium.
33+
34+
### Waiting for webserver output
35+
36+
[`property: TestConfig.webServer`] added a `wait` field. Pass a regular expression, and Playwright will wait until the webserver logs match it.
37+
38+
```js
39+
import { defineConfig } from '@playwright/test';
40+
41+
export default defineConfig({
42+
webServer: {
43+
command: 'npm run start',
44+
wait: {
45+
stdout: '/Listening on port (?<my_server_port>\\d+)/'
46+
},
47+
},
48+
});
49+
```
50+
51+
If you include a named capture group into the expression, then Playwright will provide the capture group contents via environment variables:
52+
53+
```js
54+
import { test, expect } from '@playwright/test';
55+
56+
test.use({ baseUrl: `http://localhost:${process.env.MY_SERVER_PORT ?? 3000}` });
57+
58+
test('homepage', async ({ page }) => {
59+
await page.goto('/');
60+
});
61+
```
62+
63+
This is not just useful for capturing varying ports of dev servers:
64+
You can also use it to wait for readiness of a service that doesn't expose an HTTP readiness check, but instead prints a readiness message to stdout or stderr.
65+
66+
### Breaking Change
67+
68+
After 3 years of being deprecated, we removed `Page#accessibility` from our API. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
69+
70+
### New APIs
71+
72+
- New property [`property: TestConfig.tag`] adds a tag to all tests in this run. This is useful when using [merge-reports](./test-sharding.md#merging-reports-from-multiple-shards).
73+
- [`event: Worker.console`] event is emitted when JavaScript within the worker calls one of console API methods, e.g. console.log or console.dir. [`method: Worker.waitForEvent`] can be used to wait for it. You can opt out of this using the `PLAYWRIGHT_DISABLE_SERVICE_WORKER_CONSOLE` environment variable.
74+
- [`method: Locator.description`] returns locator description previously set with [`method: Locator.describe`], and `Locator.toString()` now uses the description when available.
75+
- New option [`option: Locator.click.steps`] in [`method: Locator.click`] and [`method: Locator.dragTo`] that configures the number of `mousemove` events emitted while moving the mouse pointer to the target element.
76+
- Network requests issued by [Service Workers](./service-workers.md#network-events-and-routing) are now reported and can be routed through the [BrowserContext](./api/class-browsercontext.md), only in Chromium. You can opt out using the `PLAYWRIGHT_DISABLE_SERVICE_WORKER_NETWORK` environment variable.
77+
- New methods [`method: Request.postData`], [`method: Request.postDataBuffer`] and [`method: Request.postDataJSON`].
78+
- Option [`property: TestConfig.webServer`] added a `wait` field to check readiness based on stdout/stderr.
79+
80+
### Browser Versions
81+
82+
- Chromium 143.0.7499.4
83+
- Mozilla Firefox 142.0.1
84+
- WebKit 26.0
85+
986
## Version 1.56
1087
1188
<LiteYouTube

docs/src/test-api/class-testconfig.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,31 @@ export default defineConfig({
779779
});
780780
```
781781

782+
If your webserver runs on varying ports, use `wait` to capture the port:
783+
784+
```js
785+
import { defineConfig } from '@playwright/test';
786+
787+
export default defineConfig({
788+
webServer: {
789+
command: 'npm run start',
790+
wait: {
791+
stdout: '/Listening on port (?<my_server_port>\\d+)/'
792+
},
793+
},
794+
});
795+
```
796+
797+
```js
798+
import { test, expect } from '@playwright/test';
799+
800+
test.use({ baseUrl: `http://localhost:${process.env.MY_SERVER_PORT ?? 3000}` });
801+
802+
test('homepage', async ({ page }) => {
803+
await page.goto('/');
804+
});
805+
```
806+
782807
## property: TestConfig.workers
783808
* since: v1.10
784809
- type: ?<[int]|[string]>

packages/playwright/types/test.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,31 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
992992
* });
993993
* ```
994994
*
995+
* If your webserver runs on varying ports, use `wait` to capture the port:
996+
*
997+
* ```js
998+
* import { defineConfig } from '@playwright/test';
999+
*
1000+
* export default defineConfig({
1001+
* webServer: {
1002+
* command: 'npm run start',
1003+
* wait: {
1004+
* stdout: '/Listening on port (?<my_server_port>\\d+)/'
1005+
* },
1006+
* },
1007+
* });
1008+
* ```
1009+
*
1010+
* ```js
1011+
* import { test, expect } from '@playwright/test';
1012+
*
1013+
* test.use({ baseUrl: `http://localhost:${process.env.MY_SERVER_PORT ?? 3000}` });
1014+
*
1015+
* test('homepage', async ({ page }) => {
1016+
* await page.goto('/');
1017+
* });
1018+
* ```
1019+
*
9951020
*/
9961021
webServer?: TestConfigWebServer | TestConfigWebServer[];
9971022
/**

0 commit comments

Comments
 (0)