Swag Labs UI AUTOMATION using Webdriver IO and Javascript Coverage : Web UI
- Node JS (latest version recommended)
https://nodejs.org/en/download/package-manager
- Android Studio
https://developer.android.com/studio
- Android Device Emulator, with at least android version 11 using Google API version (DON'T USE GOOGLE PLAY STORE VERSION)
- ADB Setup
https://developer.android.com/tools/adb
- App/Web Test : Swag Labs
- Allure
https://allurereport.org/docs/install/
- Appium
https://appium.io/docs/en/2.0/quickstart/install/
- Swag User Credentials (User, Password), add it under swagCred object in
/constant/sessionValue.js
- Appium Inspector
https://github.com/appium/appium-inspector
- Chropath for chrome
https://chrome-stats.com/d/ljngjbnaijcbncmcnjfhigebomdlkcjo/download
Make Sure you already have install all requirement above
- Clone the project using SSH
git clone {{sshurl}}
- cd to the root directory and run
npm run install
Manual Installation Webdriver Selenium and Appium
- Init File Project
npm init -y
- Install Appium Driver
npm install appium --save-dev
npm install @wdio/appium-service appium
npm install appium-uiautomator2-driver --save-dev
- Install Chrome driver
npm install chromedriver --save-dev
npm install wdio-chromedriver-service --save-dev
- Install Other Dependencies
npm install @wdio/cli
npm install chai --save-dev
npm install axios --save-dev
npm install selenium-webdriver --save-dev
npm install @wdio/allure-reporter --save-dev
-
For Web version, run using command below
npx wdio run ./wdio.web.conf.js --spec ./test/specs/test.e2e.web.js
-
For Android version, before running the command, make sure you have spawned an android device emulator.
- Make sure it already detected by running
adb devices
- Make sure it already have
test APK
installed, update it to latest version by opening the apk and wait for several minutes and reopen the apps. - Command
npx wdio run ./wdio.mobile.conf.js --spec ./test/specs/test.e2e.mobile.js
You can run another test file by using template below
npx wdio run [config file] --spec [test file]
- To generate allure report, run a test case, after that make sure folder is generated
allure-results
Run below command to generate report
allure generate allure-results --clean
Open the report by running command
allure open
-
You can run one the test case in a test suite by adding "only" on test case, example
it.only("User can do something"....)
-
You can run a test cases with similar pattern by using command below, for example
npx wdio run [test config] --mochaOpts.grep [keyword]
Example :
npx wdio run ./wdio.mobile.conf.js --mochaOpts.grep "debug"
npx wdio run wdio.conf.js --cucumberOpts.tagExpression="@debug"