Browse Source

docs(python): enable web-first assertions (#10390)

pull/10399/head
Max Schmitt 2 months ago
committed by GitHub
parent
commit
0781d0303b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 465
      docs/src/api/class-locatorassertions.md
  3. 64
      docs/src/api/class-pageassertions.md
  4. 8
      docs/src/api/class-playwrightassertions.md
  5. 24
      packages/playwright-test/src/matchers/matchers.ts

1
.gitignore

@ -23,3 +23,4 @@ playwright-report
/packages/*/LICENSE
/packages/*/NOTICE
/packages/playwright/README.md
/packages/playwright-core/api.json

465
docs/src/api/class-locatorassertions.md

@ -1,5 +1,5 @@
# class: LocatorAssertions
* langs: java
* langs: java, python
The [LocatorAssertions] class provides assertion methods that can be used to make assertions about the [Locator] state in the tests. A new instance of [LocatorAssertions] is created by calling [`method: PlaywrightAssertions.assertThatLocator`]:
@ -18,186 +18,210 @@ public class TestLocator {
}
```
## method: LocatorAssertions.containsText
## method: LocatorAssertions.not
* langs: java
- returns: <[LocatorAssertions]>
Ensures the [Locator] points to an element that contains the given text. You can use regular expressions for the value as well.
Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`:
```java
assertThat(page.locator(".title")).containsText("substring");
assertThat(locator).not().containsText("error");
```
Note that if array is passed as an expected value, entire lists can be asserted:
## method: LocatorAssertions.NotToBeChecked
* langs: python
```java
assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
```
The opposite of [`method: LocatorAssertions.toBeChecked`].
### option: LocatorAssertions.NotToBeChecked.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeDisabled
* langs: python
The opposite of [`method: LocatorAssertions.toBeDisabled`].
### option: LocatorAssertions.NotToBeDisabled.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeEditable
* langs: python
The opposite of [`method: LocatorAssertions.toBeEditable`].
### option: LocatorAssertions.NotToBeEditable.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeEmpty
* langs: python
The opposite of [`method: LocatorAssertions.toBeEmpty`].
### option: LocatorAssertions.NotToBeEmpty.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeEnabled
* langs: python
The opposite of [`method: LocatorAssertions.toBeEnabled`].
### option: LocatorAssertions.NotToBeEnabled.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeFocused
* langs: python
The opposite of [`method: LocatorAssertions.toBeFocused`].
### option: LocatorAssertions.NotToBeFocused.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToBeHidden
* langs: python
The opposite of [`method: LocatorAssertions.toBeHidden`].
### option: LocatorAssertions.NotToBeHidden.timeout = %%-assertions-timeout-%%
### param: LocatorAssertions.containsText.expected
## method: LocatorAssertions.NotToBeVisible
* langs: python
The opposite of [`method: LocatorAssertions.toBeVisible`].
### option: LocatorAssertions.NotToBeVisible.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.NotToContainText
* langs: python
The opposite of [`method: LocatorAssertions.toContainText`].
### param: LocatorAssertions.NotToContainText.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected substring or RegExp or a list of those.
### option: LocatorAssertions.containsText.useInnerText
### option: LocatorAssertions.NotToContainText.useInnerText
- `useInnerText` <[boolean]>
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.containsText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToContainText.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasAttribute
Ensures the [Locator] points to an element with given attribute.
## method: LocatorAssertions.NotToHaveAttribute
* langs: python
```java
assertThat(page.locator("input")).hasAttribute("type", "text");
```
The opposite of [`method: LocatorAssertions.toHaveAttribute`].
### param: LocatorAssertions.hasAttribute.name
### param: LocatorAssertions.NotToHaveAttribute.name
- `name` <[string]>
Attribute name.
### param: LocatorAssertions.hasAttribute.value
### param: LocatorAssertions.NotToHaveAttribute.value
- `value` <[string]|[RegExp]>
Expected attribute value.
### option: LocatorAssertions.hasAttribute.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasClass
### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-assertions-timeout-%%
Ensures the [Locator] points to an element with given CSS class.
## method: LocatorAssertions.NotToHaveClass
* langs: python
```java
assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
```
The opposite of [`method: LocatorAssertions.toHaveClass`].
Note that if array is passed as an expected value, entire lists can be asserted:
```java
assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
```
### param: LocatorAssertions.hasClass.expected
### param: LocatorAssertions.NotToHaveClass.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected class or RegExp or a list of those.
### option: LocatorAssertions.hasClass.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveClass.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasCount
## method: LocatorAssertions.NotToHaveCount
* langs: python
Ensures the [Locator] resolves to an exact number of DOM nodes.
The opposite of [`method: LocatorAssertions.toHaveCount`].
```java
assertThat(page.locator("list > .component")).hasCount(3);
```
### param: LocatorAssertions.hasCount.count
### param: LocatorAssertions.NotToHaveCount.count
- `count` <[int]>
Expected count.
### option: LocatorAssertions.hasCount.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveCount.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasCSS
## method: LocatorAssertions.NotToHaveCSS
* langs: python
Ensures the [Locator] resolves to an element with the given computed CSS style.
```java
assertThat(page.locator("button")).hasCSS("display", "flex");
```
The opposite of [`method: LocatorAssertions.toHaveCSS`].
### param: LocatorAssertions.hasCSS.name
### param: LocatorAssertions.NotToHaveCSS.name
- `name` <[string]>
CSS property name.
### param: LocatorAssertions.hasCSS.value
### param: LocatorAssertions.NotToHaveCSS.value
- `value` <[string]|[RegExp]>
CSS property value.
### option: LocatorAssertions.hasCSS.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasId
### option: LocatorAssertions.NotToHaveCSS.timeout = %%-assertions-timeout-%%
Ensures the [Locator] points to an element with the given DOM Node ID.
## method: LocatorAssertions.NotToHaveId
* langs: python
```java
assertThat(page.locator("input")).hasId("lastname");
```
The opposite of [`method: LocatorAssertions.toHaveId`].
### param: LocatorAssertions.hasId.id
- `id` <[string]>
### param: LocatorAssertions.NotToHaveId.id
- `id` <[string]|[RegExp]>
Element id.
### option: LocatorAssertions.hasId.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveId.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasJSProperty
Ensures the [Locator] points to an element with given JavaScript property. Note that this property can be of a primitive type as well as a plain serializable JavaScript object.
## method: LocatorAssertions.NotToHaveJSProperty
* langs: python
```java
assertThat(page.locator("input")).hasJSProperty("type", "text");
```
The opposite of [`method: LocatorAssertions.toHaveJSProperty`].
### param: LocatorAssertions.hasJSProperty.name
### param: LocatorAssertions.NotToHaveJSProperty.name
- `name` <[string]>
Property name.
### param: LocatorAssertions.hasJSProperty.value
### param: LocatorAssertions.NotToHaveJSProperty.value
- `value` <[Serializable]>
Property value.
### option: LocatorAssertions.hasJSProperty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasText
## method: LocatorAssertions.NotToHaveText
* langs: python
Ensures the [Locator] points to an element with the given text. You can use regular expressions for the value as well.
The opposite of [`method: LocatorAssertions.toHaveText`].
```java
assertThat(page.locator(".title")).hasText("Welcome, Test User");
assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
```
Note that if array is passed as an expected value, entire lists can be asserted:
```java
assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
```
### param: LocatorAssertions.hasText.expected
### param: LocatorAssertions.NotToHaveText.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected substring or RegExp or a list of those.
### option: LocatorAssertions.hasText.useInnerText
### option: LocatorAssertions.NotToHaveText.useInnerText
- `useInnerText` <[boolean]>
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.hasText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveText.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.hasValue
## method: LocatorAssertions.NotToHaveValue
* langs: python
Ensures the [Locator] points to an element with the given input value. You can use regular expressions for the value as well.
The opposite of [`method: LocatorAssertions.toHaveValue`].
```java
assertThat(page.locator("input[type=number]")).hasValue(Pattern.compile("[0-9]"));
```
### param: LocatorAssertions.hasValue.value
### param: LocatorAssertions.NotToHaveValue.value
- `value` <[string]|[RegExp]>
Expected value.
### option: LocatorAssertions.hasValue.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveValue.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isChecked
## method: LocatorAssertions.toBeChecked
* langs:
- alias-java: isChecked
Ensures the [Locator] points to a checked input.
@ -205,9 +229,13 @@ Ensures the [Locator] points to a checked input.
assertThat(page.locator(".subscribe")).isChecked();
```
### option: LocatorAssertions.isChecked.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeChecked.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isDisabled
## method: LocatorAssertions.toBeDisabled
* langs:
- alias-java: isDisabled
Ensures the [Locator] points to a disabled element.
@ -215,9 +243,12 @@ Ensures the [Locator] points to a disabled element.
assertThat(page.locator("button.submit")).isDisabled();
```
### option: LocatorAssertions.isDisabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeDisabled.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isEditable
## method: LocatorAssertions.toBeEditable
* langs:
- alias-java: isEditable
Ensures the [Locator] points to an editable element.
@ -225,9 +256,12 @@ Ensures the [Locator] points to an editable element.
assertThat(page.locator("input")).isEditable();
```
### option: LocatorAssertions.isEditable.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEditable.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isEmpty
## method: LocatorAssertions.toBeEmpty
* langs:
- alias-java: isEmpty
Ensures the [Locator] points to an empty editable element or to a DOM node that has no text.
@ -235,9 +269,12 @@ Ensures the [Locator] points to an empty editable element or to a DOM node that
assertThat(page.locator("div.warning")).isEmpty();
```
### option: LocatorAssertions.isEmpty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEmpty.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isEnabled
## method: LocatorAssertions.toBeEnabled
* langs:
- alias-java: isEnabled
Ensures the [Locator] points to an enabled element.
@ -245,9 +282,12 @@ Ensures the [Locator] points to an enabled element.
assertThat(page.locator("button.submit")).isEnabled();
```
### option: LocatorAssertions.isEnabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEnabled.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isFocused
## method: LocatorAssertions.toBeFocused
* langs:
- alias-java: isFocused
Ensures the [Locator] points to a focused DOM node.
@ -255,9 +295,12 @@ Ensures the [Locator] points to a focused DOM node.
assertThat(page.locator("input")).isFocused();
```
### option: LocatorAssertions.isFocused.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeFocused.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isHidden
## method: LocatorAssertions.toBeHidden
* langs:
- alias-java: isHidden
Ensures the [Locator] points to a hidden DOM node, which is the opposite of [visible](./actionability.md#visible).
@ -265,23 +308,217 @@ Ensures the [Locator] points to a hidden DOM node, which is the opposite of [vis
assertThat(page.locator(".my-element")).isHidden();
```
### option: LocatorAssertions.isHidden.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeHidden.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.isVisible
## method: LocatorAssertions.toBeVisible
* langs:
- alias-java: isVisible
Ensures the [Locator] points to a [visible](./actionability.md#visible) DOM node.
```java
assertThat(page.locator(".my-element")).isVisible();
assertThat(page.locator(".my-element")).toBeVisible();
```
### option: LocatorAssertions.isVisible.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeVisible.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.not
- returns: <[LocatorAssertions]>
## method: LocatorAssertions.toContainText
* langs:
- alias-java: containsText
Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`:
Ensures the [Locator] points to an element that contains the given text. You can use regular expressions for the value as well.
```java
assertThat(locator).not().containsText("error");
assertThat(page.locator(".title")).containsText("substring");
```
Note that if array is passed as an expected value, entire lists can be asserted:
```java
assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
```
### param: LocatorAssertions.toContainText.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected substring or RegExp or a list of those.
### option: LocatorAssertions.toContainText.useInnerText
- `useInnerText` <[boolean]>
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.toContainText.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveAttribute
* langs:
- alias-java: hasAttribute
Ensures the [Locator] points to an element with given attribute.
```java
assertThat(page.locator("input")).hasAttribute("type", "text");
```
### param: LocatorAssertions.toHaveAttribute.name
- `name` <[string]>
Attribute name.
### param: LocatorAssertions.toHaveAttribute.value
- `value` <[string]|[RegExp]>
Expected attribute value.
### option: LocatorAssertions.toHaveAttribute.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveClass
* langs:
- alias-java: hasClass
Ensures the [Locator] points to an element with given CSS class.
```java
assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
```
Note that if array is passed as an expected value, entire lists can be asserted:
```java
assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
```
### param: LocatorAssertions.toHaveClass.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected class or RegExp or a list of those.
### option: LocatorAssertions.toHaveClass.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveCount
* langs:
- alias-java: hasCount
Ensures the [Locator] resolves to an exact number of DOM nodes.
```java
assertThat(page.locator("list > .component")).hasCount(3);
```
### param: LocatorAssertions.toHaveCount.count
- `count` <[int]>
Expected count.
### option: LocatorAssertions.toHaveCount.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveCSS
* langs:
- alias-java: hasCSS
Ensures the [Locator] resolves to an element with the given computed CSS style.
```java
assertThat(page.locator("button")).hasCSS("display", "flex");
```
### param: LocatorAssertions.toHaveCSS.name
- `name` <[string]>
CSS property name.
### param: LocatorAssertions.toHaveCSS.value
- `value` <[string]|[RegExp]>
CSS property value.
### option: LocatorAssertions.toHaveCSS.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveId
* langs:
- alias-java: hasId
Ensures the [Locator] points to an element with the given DOM Node ID.
```java
assertThat(page.locator("input")).hasId("lastname");
```
### param: LocatorAssertions.toHaveId.id
- `id` <[string]|[RegExp]>
Element id.
### option: LocatorAssertions.toHaveId.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveJSProperty
* langs:
- alias-java: hasJSProperty
Ensures the [Locator] points to an element with given JavaScript property. Note that this property can be of a primitive type as well as a plain serializable JavaScript object.
```java
assertThat(page.locator("input")).hasJSProperty("type", "text");
```
### param: LocatorAssertions.toHaveJSProperty.name
- `name` <[string]>
Property name.
### param: LocatorAssertions.toHaveJSProperty.value
- `value` <[Serializable]>
Property value.
### option: LocatorAssertions.toHaveJSProperty.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveText
* langs:
- alias-java: hasText
Ensures the [Locator] points to an element with the given text. You can use regular expressions for the value as well.
```java
assertThat(page.locator(".title")).hasText("Welcome, Test User");
assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
```
Note that if array is passed as an expected value, entire lists can be asserted:
```java
assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
```
### param: LocatorAssertions.toHaveText.expected
- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>>
Expected substring or RegExp or a list of those.
### option: LocatorAssertions.toHaveText.useInnerText
- `useInnerText` <[boolean]>
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.toHaveText.timeout = %%-assertions-timeout-%%
## method: LocatorAssertions.toHaveValue
* langs:
- alias-java: hasValue
Ensures the [Locator] points to an element with the given input value. You can use regular expressions for the value as well.
```java
assertThat(page.locator("input[type=number]")).hasValue(Pattern.compile("[0-9]"));
```
### param: LocatorAssertions.toHaveValue.value
- `value` <[string]|[RegExp]>
Expected value.
### option: LocatorAssertions.toHaveValue.timeout = %%-assertions-timeout-%%

64
docs/src/api/class-pageassertions.md

@ -1,5 +1,5 @@
# class: PageAssertions
* langs: java
* langs: java, python
The [PageAssertions] class provides assertion methods that can be used to make assertions about the [Page] state in the tests. A new instance of [LocatorAssertions] is created by calling [`method: PlaywrightAssertions.assertThatPage`]:
@ -18,7 +18,46 @@ public class TestPage {
}
```
## method: PageAssertions.hasTitle
## method: PageAssertions.not
* langs: java
- returns: <[PageAssertions]>
Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`:
```java
assertThat(page).not().hasURL("error");
```
## method: PageAssertions.NotToHaveTitle
* langs: python
The opposite of [`method: PageAssertions.toHaveTitle`].
### param: PageAssertions.NotToHaveTitle.titleOrRegExp
- `titleOrRegExp` <[string]|[RegExp]>
Expected title or RegExp.
### option: PageAssertions.NotToHaveTitle.timeout = %%-assertions-timeout-%%
## method: PageAssertions.NotToHaveURL
* langs: python
- alias-java: hasURL
The opposite of [`method: PageAssertions.toHaveURL`].
### param: PageAssertions.NotToHaveURL.urlOrRegExp
- `urlOrRegExp` <[string]|[RegExp]>
Expected substring or RegExp.
### option: PageAssertions.NotToHaveURL.timeout = %%-assertions-timeout-%%
## method: PageAssertions.toHaveTitle
* langs:
- alias-java: hasTitle
Ensures the page has the given title.
@ -26,14 +65,16 @@ Ensures the page has the given title.
assertThat(page).hasTitle("Playwright");
```
### param: PageAssertions.hasTitle.titleOrRegExp
### param: PageAssertions.toHaveTitle.titleOrRegExp
- `titleOrRegExp` <[string]|[RegExp]>
Expected title or RegExp.
### option: PageAssertions.hasTitle.timeout = %%-assertions-timeout-%%
### option: PageAssertions.toHaveTitle.timeout = %%-assertions-timeout-%%
## method: PageAssertions.hasURL
## method: PageAssertions.toHaveURL
* langs:
- alias-java: hasURL
Ensures the page is navigated to the given URL.
@ -41,18 +82,9 @@ Ensures the page is navigated to the given URL.
assertThat(page).hasURL(".com");
```
### param: PageAssertions.hasURL.urlOrRegExp
### param: PageAssertions.toHaveURL.urlOrRegExp
- `urlOrRegExp` <[string]|[RegExp]>
Expected substring or RegExp.
### option: PageAssertions.hasURL.timeout = %%-assertions-timeout-%%
## method: PageAssertions.not
- returns: <[PageAssertions]>
Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`:
```java
assertThat(page).not().hasURL("error");
```
### option: PageAssertions.toHaveURL.timeout = %%-assertions-timeout-%%

8
docs/src/api/class-playwrightassertions.md

@ -1,5 +1,5 @@
# class: PlaywrightAssertions
* langs: java
* langs: java, python
The [PlaywrightAssertions] class provides convenience methods for creating assertions that will wait until the expected condition is met.
@ -37,8 +37,9 @@ To use Playwright assertions add the following dependency into the `pom.xml` of
```
## method: PlaywrightAssertions.assertThatLocator
* langs: java
* langs: java, python
- alias-java: assertThat
- alias-python: expect
- returns: <[LocatorAssertions]>
Creates a [LocatorAssertions] object for the given [Locator].
@ -53,8 +54,9 @@ PlaywrightAssertions.assertThat(locator).isVisible();
[Locator] object to use for assertions.
## method: PlaywrightAssertions.assertThatPage
* langs: java
* langs: java, python
- alias-java: assertThat
- alias-python: expect
- returns: <[PageAssertions]>
Creates a [PageAssertions] object for the given [Page].

24
packages/playwright-test/src/matchers/matchers.ts

@ -224,6 +224,18 @@ export function toHaveText(
}
}
export function toHaveValue(
this: ReturnType<Expect['getState']>,
locator: LocatorEx,
expected: string | RegExp,
options?: { timeout?: number },
) {
return toMatchText.call(this, 'toHaveValue', locator, 'Locator', async (isNot, timeout) => {
const expectedText = toExpectedTextValues([expected]);
return await locator._expect('to.have.value', { expectedText, isNot, timeout });
}, expected, options);
}
export function toHaveTitle(
this: ReturnType<Expect['getState']>,
page: Page,
@ -251,15 +263,3 @@ export function toHaveURL(
return await locator._expect('to.have.url', { expectedText, isNot, timeout });
}, expected, options);
}
export function toHaveValue(
this: ReturnType<Expect['getState']>,
locator: LocatorEx,
expected: string | RegExp,
options?: { timeout?: number },
) {
return toMatchText.call(this, 'toHaveValue', locator, 'Locator', async (isNot, timeout) => {
const expectedText = toExpectedTextValues([expected]);
return await locator._expect('to.have.value', { expectedText, isNot, timeout });
}, expected, options);
}

Loading…
Cancel
Save