Sauce Labs Espresso Example

Link to Sauce Labs Espresso Example copied to clipboard

With Espresso tests looking for accessibility issues with axe DevTools Mobile, integration with Sauce Labs enables knowing what your audience will experience before it reaches their hands. All without additional effort from your team. Sauce Labs is the largest cloud-based testing platform hosting various device and emulator configurations to build your digital confidence. Configure your tests to run on Sauce within your current or future build automation to catch issues before they become production issues.

Below is a guide for running your Espresso tests integrated with axe DevTools with Sauce Labs.

Prerequisites

  1. Install saucectl command-line interface. Follow the instructions from Sauce Labs.

  2. Add your Sauce Labs credentials to your .bash_profile or .zshenv. Be sure to load the changes by running source .filename. Follow instructions from Sauce Labs.

Add Sauce Labs Configuration

Sauce Labs uses a yaml file at the project root located at .sauce/config.yml. A sample config file is below:

version: 2.1
apiVersion: v1alpha
kind: espresso
sauce:
 region: us-west-1
 concurrency: 10
 metadata:
   tags:
     - e2e
   build: Your App
espresso:
 app: ./app/build/outputs/apk/debug/<app_name>-debug.apk
 testApp: ./app/build/outputs/apk/androidTest/debug/<app_name>-debug-androidTest.apk
suites:
 - name: "<app_name>"
   testOptions:
     clearPackageData: true
     useTestOrchestrator: true
   emulators:
     - name: "Google Pixel 3 GoogleAPI Emulator"
       platformVersions:
         - "11.0"
     - name: "Google Pixel 3a GoogleAPI Emulator"
       platformVersions:
         - "10.0"
     - name: "Google Pixel 3 XL GoogleAPI Emulator"
       platformVersions:
         - "9.0"

Run Tests on Sauce Labs

Running saucectl run from the root of your project will kick off your Espresso tests on the Sauce Labs platform. Integrate this command into your CI/CD pipeline for full automation.