WebdriverIO Assertion library inspired by expect
- waits for expectation to succeed
- detailed error messages
- works in Mocha, Cucumber, Jest, Jasmine
- builtin types for TypeScript and JS autocompletion
npm install expect
(Jasmine and Jest users should skip this step)npm install expect-webdriverio
NOTE: WebdriverIO v5.16.11
or higher is required!
In your wdio.conf.js
before () { // not needed in WebdriverIO v6
require('expect-webdriverio')
},
In your test
const $button = $('button')
expect($button).toBeDisplayed()
See more Examples
Please see API doc
Error messages are informative out of the box and contain:
- full element selector, like
$('form').$('input')
- actual and expected values
- highlight the difference (texts assertions)
First of all, feel free to raise an issue with your suggestions or help with PR!
- css matcher
- size matcher
- cookie / localStorage matchers?
- text regex matchers
- multiremote support (if requested)