Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
expect-webdriverio
Advanced tools
The expect-webdriverio package is an assertion library designed to work with WebdriverIO, providing a set of matchers to make it easier to write assertions for WebdriverIO tests.
Element Matchers
This feature allows you to assert the state of elements in the DOM. For example, you can check if an element is displayed.
expect($('#element')).toBeDisplayed();
Attribute Matchers
This feature allows you to assert the attributes of elements. For example, you can check if an element has a specific class.
expect($('#element')).toHaveAttribute('class', 'my-class');
Text Matchers
This feature allows you to assert the text content of elements. For example, you can check if an element contains specific text.
expect($('#element')).toHaveText('Hello World');
Value Matchers
This feature allows you to assert the value of input elements. For example, you can check if an input field has a specific value.
expect($('#input')).toHaveValue('input value');
Condition Matchers
This feature allows you to assert the state of the browser. For example, you can check if the browser's URL matches a specific value.
expect(browser).toHaveUrl('https://example.com');
Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It provides a variety of assertion styles and is often used with WebdriverIO, but it does not have built-in support for WebdriverIO-specific matchers.
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It provides a rich set of matchers and is often used for unit testing. While it can be used with WebdriverIO, it does not have built-in support for WebdriverIO-specific matchers.
Assert is a simple assertion library provided by Node.js. It is minimalistic and does not provide the rich set of matchers that expect-webdriverio offers, especially for WebdriverIO-specific assertions.
WebdriverIO Assertion library inspired by expect
npm install expect
(Jasmine and Jest users should skip this step)npm install expect-webdriverio
NOTE: WebdriverIO v9.0.0
or higher is required!
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
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)
Please see API doc
Error messages are informative out of the box and contain:
$('form').$('input')
First of all, feel free to raise an issue with your suggestions or help with PR!
FAQs
WebdriverIO Assertion Library
The npm package expect-webdriverio receives a total of 675,888 weekly downloads. As such, expect-webdriverio popularity was classified as popular.
We found that expect-webdriverio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.