Skip to content

Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android

License

Notifications You must be signed in to change notification settings

LayMuiToh/appium-boilerplate

 
 

Repository files navigation

appium-boilerplate

Boilerplate project to run Appium tests together with WebdriverIO for:

  • iOS/Android Native Apps
  • iOS/Android Hybrid Apps
  • Android Chrome and iOS Safari browser (check here)

This boilerplate uses the WebdriverIO native demo app which can be found here. The releases can be found and downloaded here. Before running tests, please create a ./apps directory, download the app and move the zip files into that directory

Note: This boilerplate only handles local execution on 1 em/simulator at a time, not parallel execution. For more info about that Google on setting up a grid with Appium.

webdriverio-demo-app-ios.ios

Based on

This boilerplate is currently based on:

  • WebdriverIO: 4.13.#
  • Appium: 1.9.0

Updates to the latest versions will come, see TODO

Installing Appium on a local machine

See Installing Appium on a local machine

Setting up Android and iOS on a local machine

To setup your loal machine to use an Android emulator and an iOS simulator see Setting up Android and iOS on a local machine

Quick start

Choose one of the following options:

  1. Clone the git repo — git clone https://github.com/webdriverio/appium-boilerplate.git

  2. Then copy the files to your project directory (all files in /test and the wdio.conf-files in the config-folder)

  3. Merge project dev dependencies with your projects dev dependencies in your package.json

  4. merge the scripts to your package.json scripts

  5. Run the tests for iOS with npm run ios.app and for Android with npm run android.app

Config

This boilerplate uses a specific config for iOS and Android, see configs and are based on wdio.shared.conf.js. This shared config holds all the defaults so the iOS and Android configs only need to hold the capabilities and specs that are needed for running on iOS and or Android (app or browser).

Locator strategy for native apps

The locator strategy for this boilerplate is to use accessibilityID's, see also the WebdriverIO docs or this newsletter on AppiumPro. accessibilityID's make it easy to script once and run on iOS and Android because most of the apps already have some accessibilityID's.

If accessibilityID's can't be used and for example only XPATH is only available then the following setup could be used to make cross-platform selectors

const SELECTORS = {
    WEB_VIEW_SCREEN: browser.isAndroid
        ? '*//android.webkit.WebView'
        : '*//XCUIElementTypeWebView',
};

Automating Chrome or Safari

Mobile web automation is almost the same as writing tests for desktop browsers. The only difference can be found in the configuration that needs to be used. Click here to find the config for iOS Safari and here for Android Chrome. For Android be sure that the lastest version of Chrome is installed, see also here.

For this boilerplate the testcases from the jasmine-boilerplte, created by Christian Bromann, are used.

FAQ

See FAQ

Tips and Tricks

See Tips and Tricks

TODO

  • Setup configs for:
    • iOS and Android app
    • iOS and Android browsers
  • Setup helpers for:
    • WebView
    • Gestures
    • Native alerts
    • Pickers
  • Create tests for:
    • WebView
    • Login
    • Forms
    • Swipe
    • Browsers
  • Write docs
  • Update dependencies:
    • Update to work with WebdriverIO 5.#.#

About

Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%