This directory contains simple test scenario using Appium + Webdriver.io + Mocha.
Note: For now it's Android only example.
.
├── package.json
├── package-lock.json
├── .npmrc
├── screenshots
│ └── .gitkeep
├── test
│ └── specs
│ └── main.js
├── wdio.conf.js
└── .credentials.json
package.jsonandpackage-lock.jsonis obvious for everyone familiar with Node.js. Shortly for those who doesn't know: it contains information about project and what's more important - dependenencies..npmrc- Config for npmscreenshots- Here will appear all taken screenshots. Note: Directory will be cleared before each test run.test/specs/main.js- Test itselfwdio.conf.js- Config for Webdriver.io Testrunner- .
credentials.json- This file isn't included in the repository, however it's required to run sample code. You need to create it by yourself according to instructions below. It is used to store sensitive data.
@wdio/cli- Webdriver.io (and Testrunner)@wdio/local-runner- To run test "locally" (because from server perspective it's locally)@wdio/mocha-framework- Mocha support@wdio/spec-reporter- Default spec reporter@wdio/sync- To be able to enable sync modechai- Chai for Mocha (because I wanted to use should [BDD style])
npm ci
Create a file called ".credentials.json" in the project's root and add your testdroid apiKey to it as described below:
{
"apiKey": "YOUR_BITBAR_CLOUD_APIKEY"
}Download sample application and upload it to your BitBar Files Library. Copy applications ID and add it to .credentials.json file:
{
"apiKey": "YOUR_BITBAR_CLOUD_APIKEY",
"appId": "YOUR_APPLICATION_ID"
}You need to edit wdio.conf.js and set capabilities. You can either edit existing one (if you set API key then it should
work out of the box) or you can use Capabilities Creator (you just need
to switch mode to "Appium" and language to "Node.js").
npm run test
To use Chai's
shouldyou need to run proper code. Where it's done?
It's in wdio.conf.js's before hook.
There is global function
takeScreenshotin test - where it came from?
It's in wdio.conf.js's before hook.
- Webdriver.io Testrunner Configuration (helpful if you want to understand and modify
wdio.conf.js) - Webdriver.io Appium API
- Chai BDD API