Skip to content

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

docs: Improve `not` property sections (#39041)

Chris2451a7bca62c
diff --git a/docs/src/api/class-apiresponseassertions.md b/docs/src/api/class-apiresponseassertions.md
index 9584365d88..a9913fe812 100644
--- a/docs/src/api/class-apiresponseassertions.md
+++ b/docs/src/api/class-apiresponseassertions.md
@@ -51,7 +51,11 @@ def test_navigates_to_login_page(page: Page) -> None:
* 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:
+Makes the assertion check for the opposite condition.
+
+**Usage**
+
+For example, this code tests that the response status is not successful:
```js
await expect(response).not.toBeOK();
diff --git a/docs/src/api/class-genericassertions.md b/docs/src/api/class-genericassertions.md
index 603995eddd..40e594fb64 100644
--- a/docs/src/api/class-genericassertions.md
+++ b/docs/src/api/class-genericassertions.md
@@ -17,7 +17,11 @@ test('assert a value', async ({ page }) => {
* since: v1.9
- returns: <[GenericAssertions]>
-Makes the assertion check for the opposite condition. For example, the following code passes:
+Makes the assertion check for the opposite condition.
+
+**Usage**
+
+For example, the following code passes:
```js
const value = 1;
diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md
index eb8147a636..0b9d382a25 100644
--- a/docs/src/api/class-locatorassertions.md
+++ b/docs/src/api/class-locatorassertions.md
@@ -70,7 +70,11 @@ public class ExampleTests : PageTest
* langs: java, js, csharp
- returns: <[LocatorAssertions]>
-Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`:
+Makes the assertion check for the opposite condition.
+
+**Usage**
+
+For example, this code tests that the Locator doesn't contain text `"error"`:
```js
await expect(locator).not.toContainText('error');
diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md
index 49e00880ee..7b0a983cb6 100644
--- a/docs/src/api/class-pageassertions.md
+++ b/docs/src/api/class-pageassertions.md
@@ -72,7 +72,11 @@ public class ExampleTests : PageTest
* langs: java, js, csharp
- returns: <[PageAssertions]>
-Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`:
+Makes the assertion check for the opposite condition.
+
+**Usage**
+
+For example, this code tests that the page URL doesn't contain `"error"`:
```js
await expect(page).not.toHaveURL('error');
diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts
index 0da905e6e3..7660c2931c 100644
--- a/packages/playwright/types/test.d.ts
+++ b/packages/playwright/types/test.d.ts
@@ -7924,7 +7924,11 @@ interface AsymmetricMatchers {
*/
interface GenericAssertions<R> {
/**
- * Makes the assertion check for the opposite condition. For example, the following code passes:
+ * Makes the assertion check for the opposite condition.
+ *
+ * **Usage**
+ *
+ * For example, the following code passes:
*
* ```js
* const value = 1;
@@ -9435,8 +9439,11 @@ interface LocatorAssertions {
}): Promise<void>;
/**
- * Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain
- * text `"error"`:
+ * Makes the assertion check for the opposite condition.
+ *
+ * **Usage**
+ *
+ * For example, this code tests that the Locator doesn't contain text `"error"`:
*
* ```js
* await expect(locator).not.toContainText('error');
@@ -9633,8 +9640,11 @@ interface APIResponseAssertions {
toBeOK(): Promise<void>;
/**
- * Makes the assertion check for the opposite condition. For example, this code tests that the response status is not
- * successful:
+ * Makes the assertion check for the opposite condition.
+ *
+ * **Usage**
+ *
+ * For example, this code tests that the response status is not successful:
*
* ```js
* await expect(response).not.toBeOK();
@@ -9756,8 +9766,11 @@ interface PageAssertions {
}): Promise<void>;
/**
- * Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't
- * contain `"error"`:
+ * Makes the assertion check for the opposite condition.
+ *
+ * **Usage**
+ *
+ * For example, this code tests that the page URL doesn't contain `"error"`:
*
* ```js
* await expect(page).not.toHaveURL('error');