diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md index 7f1b00660e..6d74af49b7 100644 --- a/docs/src/release-notes-js.md +++ b/docs/src/release-notes-js.md @@ -5,6 +5,118 @@ title: "Release notes" +## Version 1.23 + +### Network Replay + +Now you can record network traffic into a HAR file and re-use this traffic in your tests. + +To record network into HAR file: + +```bash +npx playwright open --save-har=github.har.zip https://github.com/microsoft +``` + +Alternatively, you can record HAR programmatically: + +```ts +const context = await browser.newContext({ + recordHar: { path: 'github.har.zip' } +}); +// ... do stuff ... +await context.close(); +``` + +Use the new methods [`method: Page.routeFromHAR`] or [`method: BrowserContext.routeFromHAR`] to serve matching responses from the [HAR](http://www.softwareishard.com/blog/har-12-spec/) file: + + +```ts +await context.routeFromHAR('github.har.zip'); +``` + +Read more in [our documentation](./network#record-and-replay-requests). + + +### Advanced Routing + +You can now use [`method: Route.fallback`] to defer routing to other handlers. + +Consider the following example: + +```ts +// Remove a header from all requests. +test.beforeEach(async ({ page }) => { + await page.route('**/*', async route => { + const headers = await route.request().allHeaders(); + 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 [`method: Page.routeFromHAR`] and [`method: BrowserContext.routeFromHAR`] also participate in routing and could be deferred to. + +### Web-First Assertions Update + +* New method [`method: LocatorAssertions.toHaveValues`] that asserts all selected values of `