CircleCI
Integrate Maestro Cloud into CircleCI pipelines to automate mobile testing. Set up API keys, organize flows, and configure your .circleci/config.yml.
Integrate Maestro Cloud into your CircleCI pipelines to automate your mobile testing. This guide walks you through setting up environment variables, organizing your flows, and configuring your .circleci/config.yml.
Save API key and Project ID
First, add your credentials as secret environment variables in your CircleCI Project Settings to keep them secure and accessible to your runners.
Navigate to your Project -> Project Settings -> Environment Variables.
Save your API Key (e.g.,
MDEV_API_KEY) and Project ID (e.g.,MDEV_PROJECT_ID).

Organize your Flows
Organize your test files in a dedicated directory within your repository. While you can use any folder name, it is important to point Maestro to this location during the upload step.
├── e2e-tests/
│ ├── subflows/
│ │ └── LoginSubflow.yaml
│ ├── Login.yaml
│ ├── Add to Cart.yaml
│ └── Search.yamlAdd the Maestro upload job
Integrate Maestro by adding a specific job to your .circleci/config.yml. This job installs the CLI and uploads your binary and Flows using the --app-file and --flows parameters for better reliability.
maestro-upload:
docker:
- image: cimg/openjdk:19.0.1
steps:
- attach_workspace:
at: .
- run:
name: Download maestro and run in the cloud
command: |
curl -Ls "https://get.maestro.mobile.dev" | bash
export PATH="$PATH":"$HOME/.maestro/bin"
# Using named parameters for better reliability
maestro cloud \
--apiKey $MDEV_API_KEY \
--projectId $MDEV_PROJECT_ID \
--app-file path_to_my_app.apk \
--flows e2e-testsConfiguration examples
This example builds an Android APK and uploads it to Maestro Cloud.
version: 2.1
orbs:
android: circleci/android@2.1.2
jobs:
build-android:
executor:
name: android/android-docker
tag: 2022.08.1
steps:
- checkout
- android/restore-gradle-cache
- run:
name: Assemble debug build
command: |
./gradlew :app:assembleDebug
- persist_to_workspace:
root: .
paths:
- .
maestro-upload:
docker:
- image: cimg/openjdk:19.0.1
steps:
- attach_workspace:
at: .
- run:
name: Upload to Maestro Cloud
command: |
curl -Ls "https://get.maestro.mobile.dev" | bash
export PATH="$PATH":"$HOME/.maestro/bin"
maestro cloud \
--apiKey $MDEV_API_KEY \
--projectId $MDEV_PROJECT_ID \
--app-file app/build/outputs/apk/debug/app-debug.apk \
--flows e2e-tests
workflows:
build-and-upload:
jobs:
- build-android
- maestro-upload:
requires:
- build-androidThis example builds an iOS .app simulator bundle and uploads it.
Advanced options
You can customize the upload behavior using additional CLI flags:
--name: Assign a custom name to the upload (e.g., "Pull Request #42").--async: Exit the CLI immediately after the upload is complete, without waiting for test results.-e: Pass environment variables (e.g.,-e STAGE=prod).
For a complete list of options, see the cloud subcommand options in the Maestro CLI documentation.
Next steps
Now that your CI pipeline is connected, consider optimizing your cloud runs:
Configure the operating system for your runs to match your application and dependency requirements.
Define locales and time zones to ensure consistent behavior across environments and regions.
Explore all the subcommand options for
cloud.
Last updated