- Sauce Labs
- Cloud 9 IDE
- wdio-workshop repo
- Storing cloud Selenium credentials in WebdriverIO (video)
- Sauce Labs Integration (video)
Create sauce labs account (and Cloud 9 if preferred)
Clone wdio-workshop repo
https://github.com/klamping/wdio-workshop.git
Install webdriverio
npm install --save-dev webdriverio
Set up webdriverio config
./node_modules/.bin/wdio
Config Responses:
- Where do you want to execute your tests? In the cloud using Sauce Labs, Browserstack or Testingbot
- Environment variable for username SAUCE_USERNAME
- Environment variable for access key SAUCE_ACCESS_KEY
- Which framework do you want to use? mocha
- Shall I install the framework adapter for you? Yes
- Where are your test specs located? ./test/**/*.js
- Which reporter do you want to use? spec - https://github.com/webdriverio/wdio-spec-reporter
- Shall I install the reporter library for you? Yes
- Do you want to add a service to your test setup? sauce - https://github.com/webdriverio/wdio-sauce-service
- Shall I install the services for you? Yes
- Level of logging verbosity silent
- In which directory should screenshots gets saved if a command fails? ./errorShots/
- What is the base url? http://kevinlamping.com/webdriverio-course-content/
Add Sauce Labs credentials to environment variables
In .bashrc
file:
export SAUCE_USERNAME="username"
export SAUCE_ACCESS_KEY="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Run pre-written tests via sauce labs and review results
./node_modules/.bin/wdio
If you're running in to issues with an error message of 'Timeout of 10000ms exceeded.', increase the test timeout setting by opening your wdio.conf.js
file, navigating to the mochaOpts
object, and adding timeout: 30000
to it.
For example:
// wdio.conf.js
exports.config = {
// ...
mochaOpts: {
ui: 'bdd',
timeout: 30000
},
// ...
}