Skip to content

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

docs: clarify that toBeHidden works when nothing matches (#17057)

Dmitry Gozman1dc2a33896ca
diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md
index 2fd7927184..6204fedbb9 100644
--- a/docs/src/api/class-locatorassertions.md
+++ b/docs/src/api/class-locatorassertions.md
@@ -645,7 +645,7 @@ await Expect(locator).ToBeFocusedAsync();
* langs:
- alias-java: isHidden
-Ensures the [Locator] points to a hidden DOM node, which is the opposite of [visible](./actionability.md#visible).
+Ensures that [Locator] either does not resolve to any DOM node, or resolves to a [non-visible](./actionability.md#visible) one.
```js
const locator = page.locator('.my-element');
@@ -686,7 +686,7 @@ await Expect(locator).ToBeHiddenAsync();
* langs:
- alias-java: isVisible
-Ensures the [Locator] points to a [visible](./actionability.md#visible) DOM node.
+Ensures that [Locator] points to an [attached](./actionability.md#visible) and [visible](./actionability.md#visible) DOM node.
```js
const locator = page.locator('.my-element');
diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts
index 70fe146aee..d39e24895b 100644
--- a/packages/playwright-test/types/test.d.ts
+++ b/packages/playwright-test/types/test.d.ts
@@ -3332,7 +3332,8 @@ interface LocatorAssertions {
}): Promise<void>;
/**
- * Ensures the [Locator] points to a hidden DOM node, which is the opposite of [visible](https://playwright.dev/docs/api/actionability#visible).
+ * Ensures that [Locator] either does not resolve to any DOM node, or resolves to a
+ * [non-visible](https://playwright.dev/docs/api/actionability#visible) one.
*
* ```js
* const locator = page.locator('.my-element');
@@ -3349,7 +3350,8 @@ interface LocatorAssertions {
}): Promise<void>;
/**
- * Ensures the [Locator] points to a [visible](https://playwright.dev/docs/api/actionability#visible) DOM node.
+ * Ensures that [Locator] points to an [attached](https://playwright.dev/docs/api/actionability#visible) and [visible](https://playwright.dev/docs/api/actionability#visible) DOM
+ * node.
*
* ```js
* const locator = page.locator('.my-element');