@lifeway/webdriver-testing-library
v0.2.6
Published
Simple and complete custom Selenium Webdriver commands and utilities that encourage good testing practices.
Downloads
1,838
Readme
Webdriver Testing Library
Simple and complete custom Selenium Webdriver commands and utilities that encourage good testing practices.
Due to limited bandwidth to maintain a healthy open-source project at this time, this project is being replaced by an internal project: @lifewayit/webdriver-testing-library. See the migration guide for details on moving from this library to the new library.
The Problem
Writing tests with Selenium Webdriver can feel very different from other end-to-end test, or unit test, frameworks. The cross-browser flexibily of the WebDriver spec can make using Selenium necessary at times, however the interface can cumbersome and there for lead to unmaintainable tests.
This Solution
The Webdriver Testing Library is a collection of utilites intended combine the browser compatibility of the Selenium Webdriver with the readability of React Testing Libary's interface. Writing tests with this library should feel similiar to writing tests using any other Testing Library, and therefore encourage better testing practices.
Installation
This module is distributed via npm which is bundled
node and should be installed as on of your projects
devDependencies
.
npm install --save-dev @lifeway/webdriver-testing-library
This library has peerDependencies
listings for selenium-webdriver
.
Examples
Basic Example
import { WebDriver } from 'selenium-webdriver';
import { click, queryByText } from '@lifeway/webdriver-testing-library';
test('Basic Example', async () => {
const driver = new WebDriver();
await click(driver)(queryByText('Login'));
});
useScreen Example
import { WebDriver } from 'selenium-webdriver';
import { useScreen } from '@lifeway/webdriver-testing-library';
test('useScreen Example', async () => {
const driver = new WebDriver();
const screen = useScreen(driver);
await screen.click(screen.queryByText('Login'));
});