.toHaveValue(value)
Asserts the element has a value strictly equal to value.
Usage
expect(value).toHaveValue(value)
Parameters
value(String | Number | Boolean): Value to compare against the element's value.
Returns
Promise: A promise that resolves if the assertion is successful.
Support
| Platform | Supported |
|---|---|
| iOS | Yes |
| Android | Yes |
| Web | Yes |
Examples
Text input:
const { element, by, expect } = require("appdriver");
(async () => {
const $input = await element(by.label("text-input"));
await expect($input).toHaveValue("Hello World!");
})();
Switch input:
const { element, by, expect } = require("appdriver");
(async () => {
const $input = await element(by.label("switch"));
await expect($input).toHaveValue(true);
})();
Slider input:
const { element, by, expect } = require("appdriver");
(async () => {
const $input = await element(by.label("slider"), {
sliderRange: [0, 10]
});
await expect($input).toHaveValue(5);
})();