This directory contains simple test scenario using Appium + Webdriver.io + Mocha.
.
├── package.json
├── package-lock.json
├── run-tests.sh
├── test
│ └── specs
│ ├─── android.js
│ └─── ios.js
├─── android.conf.js
├─── ios.conf.js
└─── create-zip.sh
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.run-tests.sh- starting point for BitBar Cloud executortest/specs/android.jsortest/specs/ios.js- Test itselfandroid.conf.js- Config for android Webdriver.io Testrunnerios.conf.js- Config for ios Webdriver.io Testrunnercreate-zip.sh- script creating zip file needed to run tests on BitBar
@wdio/appium-service- Appium Service@wdio/cli- Webdriver.io (and Testrunner)@wdio/junit-reporter- JUnit reporter, because Bitbar Cloud reads JUnit reports to fetch information about i.a. test cases@wdio/local-runner- To run test "locally" (because from server perspective it's locally)@wdio/mocha-framework- Mocha support@wdio/spec-reporter- Default spec reporterchai- Chai for Mocha (because I wanted to use should [BDD style])
As always for server side execution you need to create zip package. Zip all files mentioned in Structure section above.
You can do it either manually (with your OS file explorer) or by command line. Linux example:
zip "sample-test.zip" \
"package.json" \
"package-lock.json" \
"run-tests.sh" \
"test/specs/android.js" \
"test/specs/ios.js" \
"android.conf.js" \
"ios.conf.js"We've prepared script to make running that command easier. Just run create-zip.sh with output file name passed as parameter.
./create-zip.sh "sample-test"The simplest way to do that would be using Bitbar Cloud UI. Especially if you don't know your API key. Click here to check out documentation.
This test is using for Android bitbar-sample-app.apk and for iOS bitbar-ios-sample.ipa. Download it and use it with prepared test package.
To use Chai's
shouldyou need to run proper code. Where it's done?
It's in *.conf.js's before hook.
There is global function
takeScreenshotin test - where it came from?
It's in *.conf.js's before hook.
- Webdriver.io Testrunner Configuration (helpful if you want to understand and modify
*.conf.js) - Webdriver.io Appium API
- Chai BDD API