WebdriverIO Starter Kit
Boilerplate repo for quick set up of WebdriverIO test scripts with TravisCI, Sauce Labs and Visual Regression Testing
- Clone the repo and run
- Add a valid
SAUCE_ACCESS_KEYto your environment variables to enable that integration. (Settting up Sauce)
- Update the 'baseUrl' property in
- Update the spec files and page objects in the test folder
By default, the kit is set up to run tests using the
npm test command.
You can also lint your code with
npm run lint.
This kit features:
- Login & Registration Tests, with Page Objects
- Chai with
- Chai WebdriverIO
- Sauce Labs integration
- Visual Regression Tests
- Local notifications
- ESLint using Semistandard style
- WebdriverIO tuned Gitignore file
Starter Test Cases
Because login and registration pages are ubiquitous on websites, I've included two test files with corresponding page objects.
You'll very likely need to replace the selectors used in the page objects.
You'll also want to update the
isRegistered functions in the page objects to return the proper response.
Tests and page objects go in the
test\ folder, which you'll need to create.
Name tests with a
.spec.js extension. For example:
Name Page Object files with a
.page.js extention. For example:
Visual regression screenshots will be saved to the
This kit includes a basic
.travis.yml file set up to allow easy integration with their service. Simply enable your repo in TravisCI and you'll get it up and running. And be sure to update the badge information at the top of this file.
Debug Command Line Flag to adjust timeout
By setting the 'DEBUG' environment variable to true, the test timeout with be essentially removed, allowing you to run the
debug command without your tests timing out.
DEBUG=true npm test
Configuration file flavors
By default, tests will run in Sauce Labs testing your production server.
To run the tests entirely locally, run:
npm test wdio.conf.local.js
WebdriverIO configurations can be passed in via a double-dash (i.e.
For example, to run a single test file, use the WDIO
npm test -- --spec=login
The double dash indicates that the remaining options should be sent to the command that NPM is running, not NPM itself.
In the previous example everything after
-- goes to WDIO.
A few more examples:
To change the log level, pass in a
npm test -- --logLevel=verbose
To specify a certain web server, pass in a
npm test -- --baseUrl=http://url.of.server