Playwright · Junior · Question 34 of 75
Which assertion checks the current value of an input?
- 1
await expect(input).toHaveText('john@x.io') - 2
await expect(input).toBe('john@x.io') - 3
await expect(input).toHaveValue('john@x.io')
Show the answer
Correct answer: await expect(input).toHaveValue('john@x.io')
Explanation
Input values aren't text content, so toHaveText won't see them. toHaveValue reads the live value property.