docs(python): enable Python response assertions (#11609)
This commit is contained in:
parent
3c27badd31
commit
a13f71d328
|
|
@ -1,5 +1,5 @@
|
||||||
# class: APIResponseAssertions
|
# class: APIResponseAssertions
|
||||||
* langs: js, java
|
* 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`]:
|
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`]:
|
||||||
|
|
||||||
|
|
@ -29,7 +29,6 @@ public class TestPage {
|
||||||
```
|
```
|
||||||
|
|
||||||
```python async
|
```python async
|
||||||
import re
|
|
||||||
from playwright.async_api import Page, expect
|
from playwright.async_api import Page, expect
|
||||||
|
|
||||||
async def test_navigates_to_login_page(page: Page) -> None:
|
async def test_navigates_to_login_page(page: Page) -> None:
|
||||||
|
|
@ -39,7 +38,6 @@ async def test_navigates_to_login_page(page: Page) -> None:
|
||||||
```
|
```
|
||||||
|
|
||||||
```python sync
|
```python sync
|
||||||
import re
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
|
|
||||||
def test_navigates_to_login_page(page: Page) -> None:
|
def test_navigates_to_login_page(page: Page) -> None:
|
||||||
|
|
@ -63,6 +61,11 @@ await expect(response).not.toBeOK();
|
||||||
assertThat(response).not().isOK();
|
assertThat(response).not().isOK();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## async method: APIResponseAssertions.NotToBeOK
|
||||||
|
* langs: python
|
||||||
|
|
||||||
|
The opposite of [`method: APIResponseAssertions.toBeOK`].
|
||||||
|
|
||||||
## async method: APIResponseAssertions.toBeOK
|
## async method: APIResponseAssertions.toBeOK
|
||||||
* langs:
|
* langs:
|
||||||
- alias-java: isOK
|
- alias-java: isOK
|
||||||
|
|
@ -78,7 +81,6 @@ assertThat(response).isOK();
|
||||||
```
|
```
|
||||||
|
|
||||||
```python async
|
```python async
|
||||||
import re
|
|
||||||
from playwright.async_api import expect
|
from playwright.async_api import expect
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ reached. You can pass this timeout as an option.
|
||||||
By default, the timeout for assertions is set to 5 seconds.
|
By default, the timeout for assertions is set to 5 seconds.
|
||||||
|
|
||||||
## method: PlaywrightAssertions.expectAPIResponse
|
## method: PlaywrightAssertions.expectAPIResponse
|
||||||
* langs: js, java
|
* langs: js, java, python
|
||||||
- alias-java: assertThat
|
- alias-java: assertThat
|
||||||
- alias-python: expect
|
- alias-python: expect
|
||||||
- alias-js: expect
|
- alias-js: expect
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue