docs(python): enable Python response assertions (#11609)

This commit is contained in:
Max Schmitt 2022-01-25 18:53:49 +01:00 committed by GitHub
parent 3c27badd31
commit a13f71d328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# 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`]:
@ -29,7 +29,6 @@ public class TestPage {
```
```python async
import re
from playwright.async_api import Page, expect
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
import re
from playwright.sync_api import Page, expect
def test_navigates_to_login_page(page: Page) -> None:
@ -63,6 +61,11 @@ await expect(response).not.toBeOK();
assertThat(response).not().isOK();
```
## async method: APIResponseAssertions.NotToBeOK
* langs: python
The opposite of [`method: APIResponseAssertions.toBeOK`].
## async method: APIResponseAssertions.toBeOK
* langs:
- alias-java: isOK
@ -78,7 +81,6 @@ assertThat(response).isOK();
```
```python async
import re
from playwright.async_api import expect
# ...

View File

@ -55,7 +55,7 @@ reached. You can pass this timeout as an option.
By default, the timeout for assertions is set to 5 seconds.
## method: PlaywrightAssertions.expectAPIResponse
* langs: js, java
* langs: js, java, python
- alias-java: assertThat
- alias-python: expect
- alias-js: expect