Skip to content

Getting started with UI tests

Javon Davis edited this page Apr 3, 2019 · 8 revisions

Overview

We use appium combined with SauceLabs as an on-device testing solution for covering writing flows using Gutenberg blocks.

Appium is built on the idea that testing native apps shouldn't require including an SDK or recompiling your app. And that you should be able to use your preferred test practices, frameworks, and tools. Appium is an open source project and has made design and tool decisions to encourage a vibrant contributing community.

SauceLabs is a cloud hosting platform that provides access to a variety of simulators, emulators and real devices.

Getting set up to run the tests

Emulators && Simulators

iOS: Once you've already set up XCode and the simulators you should be good to go to run the tests on an iOS simulator.

Android: You'll need to have created the emulator images and fired up the desired emulator before running the tests against an Android emulator.

Real Devices

TBA

Running the tests locally

Starting the Appium Server

One of the Caveats to using Appium is the need for the Appium server to be running to interact with the Simulator or Device through Webdriver, as a result the appium server will need to be started before running the tests. To make the entire process easier in the beforeAll block of the tests an Appium instance is fired up on a default port of 4723. If you already have something running on that port and would rather not stop that you can change the port within the code that starts that up. At the moment that port number is referenced from the config located at __device-tests__/helpers/serverConfigs.js. The process is killed in the afterAll block but some errors might cause it not to get there so it might be best

WebDriver capabilities

Appium uses a config object usually referenced to as desired capabilities to connect to a simulator or device, these objects are currently located in __device-tests__/helpers/caps.js and then referenced when firing up the driver. There are two values that I think are important to know and that's

  • platformVersion which is the platform version of a connected adb device.
  • app which is the absolute path to the .app or .apk file or the path relative to the Appium root. At the moment when running locally, these both point to the debug version of the app used after running yarn android or yarn ios for the respective platform.
Clone this wiki locally