Reputation: 2008
Using await page.inputValue('input')
to get the input value and it returns the actual value but how do i test for it?
I have tried something like this await expect(page.inputValue('input')).toHaveValue('10');
but that does not work.
Upvotes: 1
Views: 4203
Reputation: 350
You can use this:
const value = await page.inputValue('input');
expect(value).toEqual('10')
or shorter
expect(await page.inputValue('input')).toEqual('10')
Upvotes: 2
Reputation: 18624
You have to use this:
await expect(page.locator('input')).toHaveValue('10')
Upvotes: 0