Skip to content

Mobile UI Automation Test Project Example with Appium + WebdriverIO

Notifications You must be signed in to change notification settings

lynix28/mobileui-appium-wdio-example

Repository files navigation

MobileUI Automation Test Project Example with Appium & WebdriverIO

CircleCI SauceLabs

Description:

An example project about Mobile automation (Android & iOS) testing using WebdriverIO. The test examples are created in Mocha Framework and Cucumber Framework.

Requirements

  • NodeJS
  • Appium Server
  • Appium Inspector (to find selector)
  • Android Studio (for device emulator)
  • Xcode (for iOS Simulator)
  • Demo App (for testing sample) by Sauce Labs

Inside the project:

  • WebdriverIO Packages
    • Mocha and Cucumber as Test Framework
    • Allure as Test Reporter
    • Appium Server as a service to run the test
    • Appium Driver (uiautomator2 & xcuitest)
    • sauce-service to run the test on Sauce Labs cloud service

How to setup:

  • Clone the project
    Run npm install

How to run the test:

Android:

  • all the test
    • npm run test-android
      or
    • npm run test-android-bdd
  • specific spec / test file
    • npm run test-android -- --spec ./to/file/location.js
      or
    • npm run test-android-bdd -- --spec ./to/file/location.feature
  • specific suite / test suite
    • npm run test-android -- --suite "suiteName"
  • specific test case
    • npm run test-android -- --spec ./to/file/location.js --mochaOpts.grep "testcase name or testing tag"
    • npm run test-android -- --suite "suiteName" --mochaOpts.grep "testcase name or testing tag"

iOS

  • all the test
    • npm run test-ios
  • specific spec / test file
    • npm run test-ios -- --spec ./to/file/location.js
  • specific suite / test suite
    • npm run test-ios -- --suite "suiteName"
  • specific test case
    • npm run test-ios -- --spec ./to/file/location.js --mochaOpts.grep "testcase name or testing tag"
    • npm run test-ios -- --suite "suiteName" --mochaOpts.grep "testcase name or testing tag"

Common issue might happen:

  • Appium doesn't start automatically during the test (in local)

    • to solve the issue, just run the Appium server manually and re-run your test.
  • WDA (web driver agent) is not installed in iOS Simultor when tried to run the test

    • to solve the issue, try to run Appium Inspector and access the Simulator, It might take some time for the first time but once the WDA is installed, the test / inspection will run normal.

How the report look like?

Allure Report

use npm run report to open the test report

image

SauceLabs Build & Test Status

image