Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs(test-assertions): document soft assertions with expect.poll (#35619)

Marcin Szafranek8772389000b5
diff --git a/docs/src/test-assertions-js.md b/docs/src/test-assertions-js.md
index d64a70e6f9..403ecf7cda 100644
--- a/docs/src/test-assertions-js.md
+++ b/docs/src/test-assertions-js.md
@@ -223,6 +223,17 @@ await expect.poll(async () => {
}).toBe(200);
```
+You can combine expect.configure({ soft: true }) with expect.poll to perform soft assertions in polling logic.
+
+```js
+const softExpect = expect.configure({ soft: true });
+await softExpect.poll(async () => {
+ const response = await page.request.get('https://api.example.com');
+ return response.status();
+}, {}).toBe(200);
+```
+This allows the test to continue even if the assertion inside poll fails.
+
## expect.toPass
You can retry blocks of code until they are passing successfully.