diff --git a/dotnet/docs/api/class-apirequest.mdx b/dotnet/docs/api/class-apirequest.mdx index d50bec5aae2..f598427edd8 100644 --- a/dotnet/docs/api/class-apirequest.mdx +++ b/dotnet/docs/api/class-apirequest.mdx @@ -28,9 +28,6 @@ await ApiRequest.NewContextAsync(options); **Arguments** - `options` `ApiRequestNewContextOptions?` *(optional)* - - `ApiRequestFailsOnErrorStatus` [bool]? *(optional)* Added in: v1.51# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `BaseURL` [string]? *(optional)*# Methods like [ApiRequestContext.GetAsync()](/api/class-apirequestcontext.mdx#api-request-context-get) take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples: @@ -77,6 +74,9 @@ await ApiRequest.NewContextAsync(options); - `ExtraHTTPHeaders` [IDictionary]?<[string], [string]> *(optional)*# An object containing additional HTTP headers to be sent with every request. Defaults to none. + - `FailOnStatusCode` [bool]? *(optional)* Added in: v1.51# + + Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes. - `HttpCredentials` HttpCredentials? *(optional)*# - `Username` [string] diff --git a/dotnet/docs/api/class-browser.mdx b/dotnet/docs/api/class-browser.mdx index 31db1629ade..7a53c7bbf4e 100644 --- a/dotnet/docs/api/class-browser.mdx +++ b/dotnet/docs/api/class-browser.mdx @@ -166,9 +166,6 @@ await browser.CloseAsync(); - `AcceptDownloads` [bool]? *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `ApiRequestFailsOnErrorStatus` [bool]? *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `BaseURL` [string]? *(optional)*# When using [Page.GotoAsync()](/api/class-page.mdx#page-goto), [Page.RouteAsync()](/api/class-page.mdx#page-route), [Page.WaitForURLAsync()](/api/class-page.mdx#page-wait-for-url), [Page.RunAndWaitForRequestAsync()](/api/class-page.mdx#page-wait-for-request), or [Page.RunAndWaitForResponseAsync()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: @@ -387,9 +384,6 @@ await Browser.NewPageAsync(options); - `AcceptDownloads` [bool]? *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `ApiRequestFailsOnErrorStatus` [bool]? *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `BaseURL` [string]? *(optional)*# When using [Page.GotoAsync()](/api/class-page.mdx#page-goto), [Page.RouteAsync()](/api/class-page.mdx#page-route), [Page.WaitForURLAsync()](/api/class-page.mdx#page-wait-for-url), [Page.RunAndWaitForRequestAsync()](/api/class-page.mdx#page-wait-for-request), or [Page.RunAndWaitForResponseAsync()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: diff --git a/dotnet/docs/api/class-browsertype.mdx b/dotnet/docs/api/class-browsertype.mdx index 5512dde1d1d..7cb378d26fa 100644 --- a/dotnet/docs/api/class-browsertype.mdx +++ b/dotnet/docs/api/class-browsertype.mdx @@ -277,9 +277,6 @@ await BrowserType.LaunchPersistentContextAsync(userDataDir, options); - `AcceptDownloads` [bool]? *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `ApiRequestFailsOnErrorStatus` [bool]? *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `Args` [IEnumerable]?<[string]> *(optional)*# :::warning diff --git a/java/docs/api/class-apirequest.mdx b/java/docs/api/class-apirequest.mdx index 003fe85f16c..274f9ce927b 100644 --- a/java/docs/api/class-apirequest.mdx +++ b/java/docs/api/class-apirequest.mdx @@ -29,9 +29,6 @@ APIRequest.newContext(options); **Arguments** - `options` `ApiRequest.NewContextOptions` *(optional)* - - `setApiRequestFailsOnErrorStatus` [boolean] *(optional)* Added in: v1.51# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `setBaseURL` [String] *(optional)*# Methods like [APIRequestContext.get()](/api/class-apirequestcontext.mdx#api-request-context-get) take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples: @@ -78,6 +75,9 @@ APIRequest.newContext(options); - `setExtraHTTPHeaders` [Map]<[String], [String]> *(optional)*# An object containing additional HTTP headers to be sent with every request. Defaults to none. + - `setFailOnStatusCode` [boolean] *(optional)* Added in: v1.51# + + Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes. - `setHttpCredentials` HttpCredentials *(optional)*# - `setUsername` [String] diff --git a/java/docs/api/class-browser.mdx b/java/docs/api/class-browser.mdx index 5a92ee2288b..4d1835a5afc 100644 --- a/java/docs/api/class-browser.mdx +++ b/java/docs/api/class-browser.mdx @@ -170,9 +170,6 @@ browser.close(); - `setAcceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `setApiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `setBaseURL` [String] *(optional)*# When using [Page.navigate()](/api/class-page.mdx#page-goto), [Page.route()](/api/class-page.mdx#page-route), [Page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [Page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [Page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: @@ -392,9 +389,6 @@ Browser.newPage(options); - `setAcceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `setApiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `setBaseURL` [String] *(optional)*# When using [Page.navigate()](/api/class-page.mdx#page-goto), [Page.route()](/api/class-page.mdx#page-route), [Page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [Page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [Page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: diff --git a/java/docs/api/class-browsertype.mdx b/java/docs/api/class-browsertype.mdx index c977a01aad9..49b7158ef80 100644 --- a/java/docs/api/class-browsertype.mdx +++ b/java/docs/api/class-browsertype.mdx @@ -277,9 +277,6 @@ BrowserType.launchPersistentContext(userDataDir, options); - `setAcceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `setApiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `setArgs` [List]<[String]> *(optional)*# :::warning diff --git a/nodejs/docs/api/class-androiddevice.mdx b/nodejs/docs/api/class-androiddevice.mdx index 741f799a9e0..b5907d300d4 100644 --- a/nodejs/docs/api/class-androiddevice.mdx +++ b/nodejs/docs/api/class-androiddevice.mdx @@ -199,9 +199,6 @@ await androidDevice.launchBrowser(options); - `acceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `apiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `args` [Array]<[string]> *(optional)* Added in: v1.29# :::warning diff --git a/nodejs/docs/api/class-apirequest.mdx b/nodejs/docs/api/class-apirequest.mdx index ca33c4f527e..77a455d8889 100644 --- a/nodejs/docs/api/class-apirequest.mdx +++ b/nodejs/docs/api/class-apirequest.mdx @@ -29,9 +29,6 @@ await apiRequest.newContext(options); **Arguments** - `options` [Object] *(optional)* - - `apiRequestFailsOnErrorStatus` [boolean] *(optional)* Added in: v1.51# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `baseURL` [string] *(optional)*# Methods like [apiRequestContext.get()](/api/class-apirequestcontext.mdx#api-request-context-get) take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples: @@ -78,6 +75,9 @@ await apiRequest.newContext(options); - `extraHTTPHeaders` [Object]<[string], [string]> *(optional)*# An object containing additional HTTP headers to be sent with every request. Defaults to none. + - `failOnStatusCode` [boolean] *(optional)* Added in: v1.51# + + Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes. - `httpCredentials` [Object] *(optional)*# - `username` [string] diff --git a/nodejs/docs/api/class-browser.mdx b/nodejs/docs/api/class-browser.mdx index 402c41db84e..86973afc5a7 100644 --- a/nodejs/docs/api/class-browser.mdx +++ b/nodejs/docs/api/class-browser.mdx @@ -168,9 +168,6 @@ If directly using this method to create [BrowserContext]s, it is best practice t - `acceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `apiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `baseURL` [string] *(optional)*# When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: @@ -512,9 +509,6 @@ await browser.newPage(options); - `acceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `apiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `baseURL` [string] *(optional)*# When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: diff --git a/nodejs/docs/api/class-browsertype.mdx b/nodejs/docs/api/class-browsertype.mdx index dfc3fe7ac37..fbdf67d9568 100644 --- a/nodejs/docs/api/class-browsertype.mdx +++ b/nodejs/docs/api/class-browsertype.mdx @@ -281,9 +281,6 @@ await browserType.launchPersistentContext(userDataDir, options); - `acceptDownloads` [boolean] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. - - `apiRequestFailsOnErrorStatus` [boolean] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `args` [Array]<[string]> *(optional)*# :::warning diff --git a/nodejs/docs/api/class-locatorassertions.mdx b/nodejs/docs/api/class-locatorassertions.mdx index 99a541b5dec..c943a8dc870 100644 --- a/nodejs/docs/api/class-locatorassertions.mdx +++ b/nodejs/docs/api/class-locatorassertions.mdx @@ -997,13 +997,13 @@ await expect(page.locator('body')).toMatchAriaSnapshot(` Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.mdx). -Snapshot is stored in a separate `.yml` file in a location configured by `expect.toMatchAriaSnapshot.pathTemplate` and/or `snapshotPathTemplate` properties in the configuration file. +Snapshot is stored in a separate `.snapshot.yml` file in a location configured by `expect.toMatchAriaSnapshot.pathTemplate` and/or `snapshotPathTemplate` properties in the configuration file. **Usage** ```js await expect(page.locator('body')).toMatchAriaSnapshot(); -await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'body.yml' }); +await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'body.snapshot.yml' }); ``` **Arguments** diff --git a/nodejs/docs/api/class-testconfig.mdx b/nodejs/docs/api/class-testconfig.mdx index aa3366691bf..c932bae1223 100644 --- a/nodejs/docs/api/class-testconfig.mdx +++ b/nodejs/docs/api/class-testconfig.mdx @@ -342,8 +342,10 @@ export default defineConfig({ Added in: v1.10testConfig.metadata Metadata contains key-value pairs to be included in the report. For example, HTML report will display it as key-value pairs, and JSON report will include metadata serialized as json. +* Providing `gitCommit: 'generate'` property will populate it with the git commit details. +* Providing `gitDiff: 'generate'` property will populate it with the git diff details. -Providing `'git.commit.info': {}` property will populate it with the git commit details. This is useful for CI/CD environments. +On selected CI providers, both will be generated automatically. Specifying values will prevent the automatic generation. **Usage** diff --git a/nodejs/docs/aria-snapshots.mdx b/nodejs/docs/aria-snapshots.mdx index d3d3d92e58d..11e30811ee4 100644 --- a/nodejs/docs/aria-snapshots.mdx +++ b/nodejs/docs/aria-snapshots.mdx @@ -223,10 +223,10 @@ npx playwright test --update-snapshots --update-source-mode=3way #### Snapshots as separate files -To store your snapshots in a separate file, use the `toMatchAriaSnapshot` method with the `name` option, specifying a `.yml` file extension. +To store your snapshots in a separate file, use the `toMatchAriaSnapshot` method with the `name` option, specifying a `.snapshot.yml` file extension. ```js -await expect(page.getByRole('main')).toMatchAriaSnapshot({ name: 'main-snapshot.yml' }); +await expect(page.getByRole('main')).toMatchAriaSnapshot({ name: 'main.snapshot.yml' }); ``` By default, snapshots from a test file `example.spec.ts` are placed in the `example.spec.ts-snapshots` directory. As snapshots should be the same across browsers, only one snapshot is saved even if testing with multiple browsers. Should you wish, you can customize the [snapshot path template](./api/class-testconfig#test-config-snapshot-path-template) using the following configuration: diff --git a/python/docs/api/class-apirequest.mdx b/python/docs/api/class-apirequest.mdx index e5935aa9e56..597241807b9 100644 --- a/python/docs/api/class-apirequest.mdx +++ b/python/docs/api/class-apirequest.mdx @@ -28,9 +28,6 @@ api_request.new_context(**kwargs) ``` **Arguments** -- `api_request_fails_on_error_status` [bool] *(optional)* Added in: v1.51# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `base_url` [str] *(optional)*# Methods like [api_request_context.get()](/api/class-apirequestcontext.mdx#api-request-context-get) take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples: @@ -77,6 +74,9 @@ api_request.new_context(**kwargs) - `extra_http_headers` [Dict]\[[str], [str]\] *(optional)*# An object containing additional HTTP headers to be sent with every request. Defaults to none. +- `fail_on_status_code` [bool] *(optional)* Added in: v1.51# + + Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes. - `http_credentials` [Dict] *(optional)*# - `username` [str] diff --git a/python/docs/api/class-browser.mdx b/python/docs/api/class-browser.mdx index d6ddafbc90e..eafd76c1efa 100644 --- a/python/docs/api/class-browser.mdx +++ b/python/docs/api/class-browser.mdx @@ -174,9 +174,6 @@ await browser.close() - `accept_downloads` [bool] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. -- `api_request_fails_on_error_status` [bool] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `base_url` [str] *(optional)*# When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.wait_for_url()](/api/class-page.mdx#page-wait-for-url), [page.expect_request()](/api/class-page.mdx#page-wait-for-request), or [page.expect_response()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: @@ -486,9 +483,6 @@ browser.new_page(**kwargs) - `accept_downloads` [bool] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. -- `api_request_fails_on_error_status` [bool] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `base_url` [str] *(optional)*# When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.wait_for_url()](/api/class-page.mdx#page-wait-for-url), [page.expect_request()](/api/class-page.mdx#page-wait-for-request), or [page.expect_response()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples: diff --git a/python/docs/api/class-browsertype.mdx b/python/docs/api/class-browsertype.mdx index fd2e2294a14..c58687d0aa0 100644 --- a/python/docs/api/class-browsertype.mdx +++ b/python/docs/api/class-browsertype.mdx @@ -329,9 +329,6 @@ browser_type.launch_persistent_context(user_data_dir, **kwargs) - `accept_downloads` [bool] *(optional)*# Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted. -- `api_request_fails_on_error_status` [bool] *(optional)*# - - An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes. - `args` [List]\[[str]\] *(optional)*# :::warning