Skip to content

Public repo demonstrating how to script end-to-end (E2E) mobile tests with Waldo Scripting.

License

Notifications You must be signed in to change notification settings

waldoapp/waldo-programmatic-samples

Repository files navigation

Testing with Waldo Scripting

demo video

Introduction

When you execute a script that uses Waldo Scripting, the script always uses a remote device session on a simulator/emulator running within the Waldo infrastructure.

This has many advantages:

  • simplicity: the setup to execute or edit an E2E script locally only takes a few minutes: no more full Appium install on your local machine or tweaking of system configurations.
  • universality: wherever the script executes, it targets the same remote device environment, and therefore you know how it will behave: no more debugging local versus CI device conditions.
  • collaboration: one consequence of this simplicity and universality is the ease of working together with the rest of your development team.
  • full observability: since everything runs remotely within the Waldo infrastructure, rich artifacts are captured from every device session. These session replays can be accessed at any time in the future at https://app.waldo.com/applications/0/replays.

In this project we provide several examples of how to script end-to-end (E2E) mobile tests with Waldo Scripting.

Note

The sample scripts point to the open-source Wikipedia iOS app or Wikipedia Android app.

Tip

This project extends the WebdriverIO mobile automation test framework to communicate with Waldo Scripting. However, since Waldo Scripting implements the W3C WebDriver standard endpoints and most of the Appium extensions, you can use any automation test framework that targets these endpoints.

Requirements

Waldo account

Using Waldo Scripting requires you to have a Waldo account: sign up here.

Node.js

You also need to have the Node.js runtime installed on your machine. We recommend that you use the latest long-term support (LTS) version.

To check that Node.js is correctly installed, type the following command into your terminal client:

node -v

Refer to the nodejs.org installation instructions for more information.

Getting started

Important

The samples uses the @wdio/wdio-service package to communicate with Waldo Scripting. The package's README contains more information about the service, how to configure it and all the available commands.

The best way to discover scripting with Waldo is to follow our guide in the product.

It describes the instructions below, as well as shows you how to edit a script.

Setup

  1. Clone this repository:

    git clone https://github.com/waldoapp/waldo-programmatic-samples.git
  2. Navigate to the root directory:

    cd waldo-programmatic-samples
  3. Install the project dependencies:

    npm install
  4. Go to your settings page to find your API token; then run the following command:

    npx waldo-auth [YourToken]

Running the sample scripts

You can now run the sample scripts targeting the Wikipedia app.

For instance, you can run the iOS sample script:

SHOW_SESSION=1 npm run ios -- --spec onboarding.ts

Similarly, you can run the Android sample script:

SHOW_SESSION=1 npm run android -- --spec onboarding.ts

Exploring Waldo Scripting

Once you have run the sample scripts, you can explore the WebDriverIO API and the Waldo service documentation to learn more about how to interact with the device.

Editing the scripts

You can edit the sample scripts and re-run them to see the changes in action, but it's often faster to create a session and iterate without starting from a clean device each time.

To do so, you can use the live execution mode:

# iOS https://app.waldo.com/applications/ios/sessions?versionId=wiki
SESSION_ID=[SessionID] npm run ios -- --spec onboarding.ts

# Android https://app.waldo.com/applications/android/sessions?versionId=wiki
SESSION_ID=[SessionID] npm run android -- --spec onboarding.ts

Using you own application

If you want to use your own application, you need to upload a binary to Waldo first. Once this is done the version ID can be specified in the 'appium:app' capability inside the wdio.conf.js file.

More information can be found in the Specifying the application binary/build to target section of the service readme.

Integrating in your own project

If you already have a WebDriverIO project or want to start from scratch you can follow the corresponding sections of the service readme.

But you can also copy and reuse part of this sample project in your own project by copying the node and typescript configuration files (package.json, tsconfig.json) and one of the folder that contains the sample scripts (ios and android).