expect-webdriverio
[![Build Status](https://travis-ci.org/webdriverio/expect-webdriverio.svg?branch=master)](https://travis-ci.org/webdriverio/expect-webdriverio) [![codecov](https://codecov.io/gh/webdriverio/expect-webdriverio/branch/master/graph/badge.svg)](https://codeco
Last updated 4 years ago by mgrybyk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install expect-webdriverio 
SYNC missed versions from official npm registry.

expect-webdriverio

Test

API | TypeScript / JS Autocomplete | Examples | Extending Matchers

WebdriverIO Assertion library inspired by expect

Key Features

  • waits for expectation to succeed
  • detailed error messages
  • works in Mocha, Cucumber, Jest, Jasmine
  • builtin types for TypeScript and JS autocompletion

Installation

  1. npm install expect (Jasmine and Jest users should skip this step)
  2. npm install expect-webdriverio

NOTE: WebdriverIO v5.16.11 or higher is required!

Usage

Using WebdriverIO Testrunner

If you run your tests through the WDIO testrunner no additional setup is needed. WebdriverIO initialises expect-webdriverio and makes expect available in the global scope. So you can use it directly in your tests:

const $button = await $('button')
await expect($button).toBeDisplayed()

See more Examples

Using in a standalone script

If you embed WebdriverIO in a standalone script, make sure you import expect-webdriverio before you use it anywhere.

import { remote } from 'webdriverio'
import { expect } from 'expect-webdriverio'

;(async () => {
    const browser = await remote({
        capabilities: {
            browserName: 'chrome'
        }
    })

    await browser.url('https://webdriver.io')

    const $button = await browser.$('button')
    await expect($button).toBeDisplayed()
    
    await browser.deleteSession()
})().catch(console.error)

API

Please see API doc

Error messages

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)

toHaveText toHaveElementClass

What's next?

First of all, feel free to raise an issue with your suggestions or help with PR!

Planned

  • css matcher
  • size matcher
  • cookie / localStorage matchers?
  • text regex matchers
  • multiremote support (if requested)

Current Tags

  • 4.1.2                                ...           latest (2 years ago)
  • 4.0.0-alpha.6                                ...           next (2 years ago)

51 Versions

  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 3.5.3                                ...           2 years ago
  • 3.5.2                                ...           2 years ago
  • 3.5.1                                ...           2 years ago
  • 3.5.0                                ...           2 years ago
  • 4.0.0-alpha.6                                ...           2 years ago
  • 4.0.0-alpha.5                                ...           2 years ago
  • 4.0.0-alpha.4                                ...           2 years ago
  • 4.0.0-alpha.3                                ...           2 years ago
  • 4.0.0-alpha.2                                ...           2 years ago
  • 4.0.0-alpha.1                                ...           2 years ago
  • 4.0.0-alpha.0                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.2                                ...           2 years ago
  • 3.3.1                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.1                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.4                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 4.0.0 [deprecated]           ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1 [deprecated]           ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.3-beta.7                                ...           5 years ago
  • 0.1.2-beta.6                                ...           5 years ago
  • 0.1.1-beta.5                                ...           5 years ago
  • 0.1.0-beta.4                                ...           5 years ago
  • 0.0.1-alpha.3                                ...           5 years ago
  • 0.0.1-alpha.2                                ...           5 years ago
  • 0.0.1-alpha.1                                ...           5 years ago
  • 0.0.1-alpha.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (16)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |