diff --git a/.gitignore b/.gitignore index 71632f6aa2..0934f3cff0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ playwright-report /packages/*/LICENSE /packages/*/NOTICE /packages/playwright/README.md +/packages/playwright-core/api.json diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 1d0aad31bc..2970bd0dc8 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/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,7 +18,314 @@ public class TestLocator { } ``` -## method: LocatorAssertions.containsText +## method: LocatorAssertions.not +* langs: java +- returns: <[LocatorAssertions]> + +Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`: + +```java +assertThat(locator).not().containsText("error"); +``` + +## method: LocatorAssertions.NotToBeChecked +* langs: python + +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-%% + +## 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.NotToContainText.useInnerText +- `useInnerText` <[boolean]> + +Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text. + +### option: LocatorAssertions.NotToContainText.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveAttribute +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveAttribute`]. + +### param: LocatorAssertions.NotToHaveAttribute.name +- `name` <[string]> + +Attribute name. + +### param: LocatorAssertions.NotToHaveAttribute.value +- `value` <[string]|[RegExp]> + +Expected attribute value. + +### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveClass +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveClass`]. + +### param: LocatorAssertions.NotToHaveClass.expected +- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> + +Expected class or RegExp or a list of those. + +### option: LocatorAssertions.NotToHaveClass.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveCount +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveCount`]. + +### param: LocatorAssertions.NotToHaveCount.count +- `count` <[int]> + +Expected count. + +### option: LocatorAssertions.NotToHaveCount.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveCSS +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveCSS`]. + +### param: LocatorAssertions.NotToHaveCSS.name +- `name` <[string]> + +CSS property name. + +### param: LocatorAssertions.NotToHaveCSS.value +- `value` <[string]|[RegExp]> + +CSS property value. + +### option: LocatorAssertions.NotToHaveCSS.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveId +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveId`]. + +### param: LocatorAssertions.NotToHaveId.id +- `id` <[string]|[RegExp]> + +Element id. + +### option: LocatorAssertions.NotToHaveId.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveJSProperty +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveJSProperty`]. + +### param: LocatorAssertions.NotToHaveJSProperty.name +- `name` <[string]> + +Property name. + +### param: LocatorAssertions.NotToHaveJSProperty.value +- `value` <[Serializable]> + +Property value. + +### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveText +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveText`]. + +### param: LocatorAssertions.NotToHaveText.expected +- `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> + +Expected substring or RegExp or a list of those. + +### option: LocatorAssertions.NotToHaveText.useInnerText +- `useInnerText` <[boolean]> + +Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text. + +### option: LocatorAssertions.NotToHaveText.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.NotToHaveValue +* langs: python + +The opposite of [`method: LocatorAssertions.toHaveValue`]. + +### param: LocatorAssertions.NotToHaveValue.value +- `value` <[string]|[RegExp]> + +Expected value. + +### option: LocatorAssertions.NotToHaveValue.timeout = %%-assertions-timeout-%% + + +## method: LocatorAssertions.toBeChecked +* langs: + - alias-java: isChecked + +Ensures the [Locator] points to a checked input. + +```java +assertThat(page.locator(".subscribe")).isChecked(); +``` + +### option: LocatorAssertions.toBeChecked.timeout = %%-assertions-timeout-%% + + + +## method: LocatorAssertions.toBeDisabled +* langs: + - alias-java: isDisabled + +Ensures the [Locator] points to a disabled element. + +```java +assertThat(page.locator("button.submit")).isDisabled(); +``` + +### option: LocatorAssertions.toBeDisabled.timeout = %%-assertions-timeout-%% + + +## method: LocatorAssertions.toBeEditable +* langs: + - alias-java: isEditable + +Ensures the [Locator] points to an editable element. + +```java +assertThat(page.locator("input")).isEditable(); +``` + +### option: LocatorAssertions.toBeEditable.timeout = %%-assertions-timeout-%% + + +## 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. + +```java +assertThat(page.locator("div.warning")).isEmpty(); +``` + +### option: LocatorAssertions.toBeEmpty.timeout = %%-assertions-timeout-%% + + +## method: LocatorAssertions.toBeEnabled +* langs: + - alias-java: isEnabled + +Ensures the [Locator] points to an enabled element. + +```java +assertThat(page.locator("button.submit")).isEnabled(); +``` + +### option: LocatorAssertions.toBeEnabled.timeout = %%-assertions-timeout-%% + + +## method: LocatorAssertions.toBeFocused +* langs: + - alias-java: isFocused + +Ensures the [Locator] points to a focused DOM node. + +```java +assertThat(page.locator("input")).isFocused(); +``` + +### option: LocatorAssertions.toBeFocused.timeout = %%-assertions-timeout-%% + + +## 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). + +```java +assertThat(page.locator(".my-element")).isHidden(); +``` + +### option: LocatorAssertions.toBeHidden.timeout = %%-assertions-timeout-%% + + +## 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")).toBeVisible(); +``` + +### option: LocatorAssertions.toBeVisible.timeout = %%-assertions-timeout-%% + +## method: LocatorAssertions.toContainText +* langs: + - alias-java: containsText Ensures the [Locator] points to an element that contains the given text. You can use regular expressions for the value as well. @@ -32,19 +339,22 @@ Note that if array is passed as an expected value, entire lists can be asserted: assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"}); ``` -### param: LocatorAssertions.containsText.expected +### param: LocatorAssertions.toContainText.expected - `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> Expected substring or RegExp or a list of those. -### option: LocatorAssertions.containsText.useInnerText +### option: LocatorAssertions.toContainText.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.toContainText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasAttribute + +## method: LocatorAssertions.toHaveAttribute +* langs: + - alias-java: hasAttribute Ensures the [Locator] points to an element with given attribute. @@ -52,19 +362,21 @@ Ensures the [Locator] points to an element with given attribute. assertThat(page.locator("input")).hasAttribute("type", "text"); ``` -### param: LocatorAssertions.hasAttribute.name +### param: LocatorAssertions.toHaveAttribute.name - `name` <[string]> Attribute name. -### param: LocatorAssertions.hasAttribute.value +### param: LocatorAssertions.toHaveAttribute.value - `value` <[string]|[RegExp]> Expected attribute value. -### option: LocatorAssertions.hasAttribute.timeout = %%-assertions-timeout-%% +### option: LocatorAssertions.toHaveAttribute.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasClass +## method: LocatorAssertions.toHaveClass +* langs: + - alias-java: hasClass Ensures the [Locator] points to an element with given CSS class. @@ -78,14 +390,17 @@ Note that if array is passed as an expected value, entire lists can be asserted: assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"}); ``` -### param: LocatorAssertions.hasClass.expected +### param: LocatorAssertions.toHaveClass.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.toHaveClass.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasCount + +## method: LocatorAssertions.toHaveCount +* langs: + - alias-java: hasCount Ensures the [Locator] resolves to an exact number of DOM nodes. @@ -93,14 +408,16 @@ Ensures the [Locator] resolves to an exact number of DOM nodes. assertThat(page.locator("list > .component")).hasCount(3); ``` -### param: LocatorAssertions.hasCount.count +### param: LocatorAssertions.toHaveCount.count - `count` <[int]> Expected count. -### option: LocatorAssertions.hasCount.timeout = %%-assertions-timeout-%% +### option: LocatorAssertions.toHaveCount.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasCSS +## method: LocatorAssertions.toHaveCSS +* langs: + - alias-java: hasCSS Ensures the [Locator] resolves to an element with the given computed CSS style. @@ -108,19 +425,21 @@ Ensures the [Locator] resolves to an element with the given computed CSS style. assertThat(page.locator("button")).hasCSS("display", "flex"); ``` -### param: LocatorAssertions.hasCSS.name +### param: LocatorAssertions.toHaveCSS.name - `name` <[string]> CSS property name. -### param: LocatorAssertions.hasCSS.value +### param: LocatorAssertions.toHaveCSS.value - `value` <[string]|[RegExp]> CSS property value. -### option: LocatorAssertions.hasCSS.timeout = %%-assertions-timeout-%% +### option: LocatorAssertions.toHaveCSS.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasId +## method: LocatorAssertions.toHaveId +* langs: + - alias-java: hasId Ensures the [Locator] points to an element with the given DOM Node ID. @@ -128,14 +447,17 @@ Ensures the [Locator] points to an element with the given DOM Node ID. assertThat(page.locator("input")).hasId("lastname"); ``` -### param: LocatorAssertions.hasId.id -- `id` <[string]> +### param: LocatorAssertions.toHaveId.id +- `id` <[string]|[RegExp]> Element id. -### option: LocatorAssertions.hasId.timeout = %%-assertions-timeout-%% +### option: LocatorAssertions.toHaveId.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasJSProperty + +## 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. @@ -143,19 +465,21 @@ Ensures the [Locator] points to an element with given JavaScript property. Note assertThat(page.locator("input")).hasJSProperty("type", "text"); ``` -### param: LocatorAssertions.hasJSProperty.name +### param: LocatorAssertions.toHaveJSProperty.name - `name` <[string]> Property name. -### param: LocatorAssertions.hasJSProperty.value +### param: LocatorAssertions.toHaveJSProperty.value - `value` <[Serializable]> Property value. -### option: LocatorAssertions.hasJSProperty.timeout = %%-assertions-timeout-%% +### option: LocatorAssertions.toHaveJSProperty.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasText +## 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. @@ -170,19 +494,21 @@ Note that if array is passed as an expected value, entire lists can be asserted: assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"}); ``` -### param: LocatorAssertions.hasText.expected +### param: LocatorAssertions.toHaveText.expected - `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> Expected substring or RegExp or a list of those. -### option: LocatorAssertions.hasText.useInnerText +### option: LocatorAssertions.toHaveText.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.toHaveText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.hasValue +## 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. @@ -190,98 +516,9 @@ Ensures the [Locator] points to an element with the given input value. You can u assertThat(page.locator("input[type=number]")).hasValue(Pattern.compile("[0-9]")); ``` -### param: LocatorAssertions.hasValue.value +### param: LocatorAssertions.toHaveValue.value - `value` <[string]|[RegExp]> Expected value. -### option: LocatorAssertions.hasValue.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isChecked - -Ensures the [Locator] points to a checked input. - -```java -assertThat(page.locator(".subscribe")).isChecked(); -``` - -### option: LocatorAssertions.isChecked.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isDisabled - -Ensures the [Locator] points to a disabled element. - -```java -assertThat(page.locator("button.submit")).isDisabled(); -``` - -### option: LocatorAssertions.isDisabled.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isEditable - -Ensures the [Locator] points to an editable element. - -```java -assertThat(page.locator("input")).isEditable(); -``` - -### option: LocatorAssertions.isEditable.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isEmpty - -Ensures the [Locator] points to an empty editable element or to a DOM node that has no text. - -```java -assertThat(page.locator("div.warning")).isEmpty(); -``` - -### option: LocatorAssertions.isEmpty.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isEnabled - -Ensures the [Locator] points to an enabled element. - -```java -assertThat(page.locator("button.submit")).isEnabled(); -``` - -### option: LocatorAssertions.isEnabled.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isFocused - -Ensures the [Locator] points to a focused DOM node. - -```java -assertThat(page.locator("input")).isFocused(); -``` - -### option: LocatorAssertions.isFocused.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isHidden - -Ensures the [Locator] points to a hidden DOM node, which is the opposite of [visible](./actionability.md#visible). - -```java -assertThat(page.locator(".my-element")).isHidden(); -``` - -### option: LocatorAssertions.isHidden.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.isVisible - -Ensures the [Locator] points to a [visible](./actionability.md#visible) DOM node. - -```java -assertThat(page.locator(".my-element")).isVisible(); -``` - -### option: LocatorAssertions.isVisible.timeout = %%-assertions-timeout-%% - -## method: LocatorAssertions.not -- returns: <[LocatorAssertions]> - -Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`: - -```java -assertThat(locator).not().containsText("error"); -``` +### option: LocatorAssertions.toHaveValue.timeout = %%-assertions-timeout-%% diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index 5b4a6007af..66e9c096d1 100644 --- a/docs/src/api/class-pageassertions.md +++ b/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,37 +18,9 @@ public class TestPage { } ``` -## method: PageAssertions.hasTitle - -Ensures the page has the given title. - -```java -assertThat(page).hasTitle("Playwright"); -``` - -### param: PageAssertions.hasTitle.titleOrRegExp -- `titleOrRegExp` <[string]|[RegExp]> - -Expected title or RegExp. - -### option: PageAssertions.hasTitle.timeout = %%-assertions-timeout-%% - -## method: PageAssertions.hasURL - -Ensures the page is navigated to the given URL. - -```java -assertThat(page).hasURL(".com"); -``` - -### param: PageAssertions.hasURL.urlOrRegExp -- `urlOrRegExp` <[string]|[RegExp]> - -Expected substring or RegExp. - -### option: PageAssertions.hasURL.timeout = %%-assertions-timeout-%% ## 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"`: @@ -56,3 +28,63 @@ Makes the assertion check for the opposite condition. For example, this code tes ```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. + +```java +assertThat(page).hasTitle("Playwright"); +``` + +### param: PageAssertions.toHaveTitle.titleOrRegExp +- `titleOrRegExp` <[string]|[RegExp]> + +Expected title or RegExp. + +### option: PageAssertions.toHaveTitle.timeout = %%-assertions-timeout-%% + +## method: PageAssertions.toHaveURL +* langs: + - alias-java: hasURL + +Ensures the page is navigated to the given URL. + +```java +assertThat(page).hasURL(".com"); +``` + +### param: PageAssertions.toHaveURL.urlOrRegExp +- `urlOrRegExp` <[string]|[RegExp]> + +Expected substring or RegExp. + +### option: PageAssertions.toHaveURL.timeout = %%-assertions-timeout-%% \ No newline at end of file diff --git a/docs/src/api/class-playwrightassertions.md b/docs/src/api/class-playwrightassertions.md index 6c6162d193..a8a96bb5c9 100644 --- a/docs/src/api/class-playwrightassertions.md +++ b/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]. diff --git a/packages/playwright-test/src/matchers/matchers.ts b/packages/playwright-test/src/matchers/matchers.ts index 2fdd9c6fb1..1b35c17ac2 100644 --- a/packages/playwright-test/src/matchers/matchers.ts +++ b/packages/playwright-test/src/matchers/matchers.ts @@ -224,6 +224,18 @@ export function toHaveText( } } +export function toHaveValue( + this: ReturnType, + 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, 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, - 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); -}