mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(dotnet): enable api response assertions (#16799)
This commit is contained in:
parent
80389c7d47
commit
9341bf12c6
@ -1,6 +1,5 @@
|
||||
# class: APIResponseAssertions
|
||||
* since: v1.18
|
||||
* langs: js, java, python
|
||||
|
||||
The [APIResponseAssertions] class provides assertion methods that can be used to make assertions about the [APIResponse] in the tests. A new instance of [APIResponseAssertions] is created by calling [`method: PlaywrightAssertions.expectAPIResponse`]:
|
||||
|
||||
@ -50,7 +49,7 @@ def test_navigates_to_login_page(page: Page) -> None:
|
||||
|
||||
## property: APIResponseAssertions.not
|
||||
* since: v1.20
|
||||
* langs: java, js
|
||||
* langs: java, js, csharp
|
||||
- returns: <[APIResponseAssertions]>
|
||||
|
||||
Makes the assertion check for the opposite condition. For example, this code tests that the response status is not successful:
|
||||
@ -74,7 +73,7 @@ The opposite of [`method: APIResponseAssertions.toBeOK`].
|
||||
* langs:
|
||||
- alias-java: isOK
|
||||
|
||||
Ensures the response status code is within [200..299] range.
|
||||
Ensures the response status code is within `200..299` range.
|
||||
|
||||
```js
|
||||
await expect(response).toBeOK();
|
||||
|
||||
@ -74,7 +74,7 @@ By default, the timeout for assertions is set to 5 seconds.
|
||||
|
||||
## method: PlaywrightAssertions.expectAPIResponse
|
||||
* since: v1.18
|
||||
* langs: js, java, python
|
||||
* langs:
|
||||
- alias-java: assertThat
|
||||
- alias-python: expect
|
||||
- alias-js: expect
|
||||
|
||||
2
packages/playwright-test/types/test.d.ts
vendored
2
packages/playwright-test/types/test.d.ts
vendored
@ -3180,7 +3180,7 @@ interface APIResponseAssertions {
|
||||
not: APIResponseAssertions;
|
||||
|
||||
/**
|
||||
* Ensures the response status code is within [200..299] range.
|
||||
* Ensures the response status code is within `200..299` range.
|
||||
*
|
||||
* ```js
|
||||
* await expect(response).toBeOK();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user