Giter VIP home page Giter VIP logo

appium-boilerplate's Introduction

appium-boilerplate

NOTE: This boilerplate is for Webdriver V5, if you need a boilerplate for V4 please click here

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: 5.12.#
  • Appium: 1.14.#

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 local 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 /tests 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).

NEW: The new @wdio/appium-service is now also integrated in this boilerplate so you don't need to start an Appium server yourself, WebdriverIO will do that for you.

Since we do not have Appium installed as part of this package, this has been configured to use the global Appium installation. This is configured in wdio.shared.conf.js

appium: {
    command : 'appium'
},

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.

Cloud vendors

Sauce Labs Real Device Cloud

This boilerplate now also provides a setup for testing with the Real Device Cloud (RDC) of Sauce Labs. Please check the SauceLabs-folder to see the setup for iOS and Android.

With the latest version of WebdriverIO (5.4.13 and higher) the iOS and Android config holds:

  • automatic US or EU RDC cloud selection by providing a region in the config, see the iOS and the Android configs
  • automatic update of the teststatus in the RDC cloud without using a customer script

Make sure you install the latest version of the @wdio/sauce-service with

$ npm install --save-dev @wdio/sauce-service

and add services: ['sauce'], to the config. If no region is provided it will automatically default to the US-RDC cloud. If you provide region: 'us' or region: 'eu' it will connect to the US or the EU RDC cloud

There are 2 scripts that can be used, see the package.json, to execute the tests in the cloud:

// For iOS
$ npm run ios.sauce.rdc.app

// For Android
$ npm run android.sauce.rdc.app

FAQ

See FAQ

Tips and Tricks

See Tips and Tricks

Changes from original project

  • Make sure to run the Appium server with this setting: chrome binary path: C:\code...\appium-boilerplate\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
  • Changed an Spec that had some failing expectations.
  • Added appium-chromedriver dependency
  • Changed config to point to my Android 7 device

appium-boilerplate's People

Contributors

wswebcreation avatar sanijalal avatar christian-bromann avatar oscarcentenogft avatar mycatnamedweb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.