Skip to main content
Docs
Blog Status Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Maestro tests

ew-cli maestro run runs your Maestro flows on emulator.wtf.

Info
Running maestro tests on emulator.wtf is currently in closed beta. Contact us at support@emulator.wtf if you want to try this out!

Quick start

Point ew-cli maestro run to your Maestro workspace and app apk:

ew-cli maestro run --workspace .maestro --app path/to/app.apk

Run with --help to see all the possible options:

ew-cli maestro run --help

Which flows run

The whole workspace directory is uploaded. Flows are selected the same way Maestro selects them locally:

  • Without a config.yaml, only flows at the top level of the workspace run.
  • With a config.yaml at the workspace root, its flows: globs decide which flows run.
  • Globs are relative to the workspace, not to the current directory.
  • Tags in config.yaml and on the command line are combined.

Declaring flows: replaces the default of running the top-level flows. To keep them, list "*" next to your other globs:

flows:
  - "*"
  - "smoke/*.yaml"

Subflows and scripts must be inside the workspace. Any absolute or relative reference outside the workspace will not work with emulator.wtf.

Common examples

Run flows with a specific tag

ew-cli maestro run --workspace .maestro --app path/to/app.apk --include-tags smoke

Use --exclude-tags to skip flows instead:

ew-cli maestro run --workspace .maestro --app path/to/app.apk --exclude-tags slow

Run specific flows

--flows takes the same format of globs as the flows: field in config.yaml and replaces it for this run:

ew-cli maestro run --workspace .maestro --app path/to/app.apk \
  --flows "login.yaml,smoke/*.yaml"

Use a different workspace config

ew-cli maestro run --workspace .maestro --app path/to/app.apk \
  --config .maestro/nightly/config.yaml

Pass variables and secrets to flows

Variables are passed to Maestro as --env KEY=VALUE, flows read them as ${KEY}. Secrets are passed the same way, but they won’t be visible in the emulator.wtf UI.

ew-cli maestro run --workspace .maestro --app path/to/app.apk \
  --environment-variables USERNAME=test@example.com \
  --secret-environment-variables PASSWORD=hunter2

Test against a backend running on the CI runner

Use the egress tunnel to make services running next to ew-cli reachable from the emulator. The following makes the runner’s localhost available to the emulator as 192.168.200.1, so a backend listening on localhost:8080 is reachable at 192.168.200.1:8080:

ew-cli maestro run --workspace .maestro --app path/to/app.apk \
  --egress-tunnel --egress-localhost-fwd-ip 192.168.200.1

Run flows with shards

Flows are split into shards by flow file. The following example splits the flows evenly into 3 shards:

ew-cli maestro run --workspace .maestro --app path/to/app.apk --num-shards 3

To assign flows to shards manually, repeat --flows-for-shard. This runs two shards, one with the smoke directory and one with login.yaml together with the checkout directory:

ew-cli maestro run --workspace .maestro --app path/to/app.apk \
  --flows-for-shard "smoke/*.yaml" \
  --flows-for-shard "login.yaml,checkout/*.yaml"

Only the listed flows run, a flow that is not matched by any --flows-for-shard is skipped.

Troubleshooting

IssueLikely cause
No flows to run: the workspace has no top-level flow files and no config declaring flowsThere’s no flows: field in the workspace config.yaml and no --flows argument was passed in either. To fix, add a flows: field to workspace config.
--flows entry matches no flow file in the workspaceFlows are paths relative to the workspace. If your workspace is .maestro then use login.yaml instead of .maestro/login.yaml.
Flows in a subdirectory do not runAdd a glob for the subdirectory to flows: in config.yaml, e.g. smoke/*.yaml. Keep "*" in the list as well, otherwise the top-level flows will not get run.
A subflow or script is found locally but not on emulator.wtfMove it inside the workspace, references outside the workspace via absolute or relative paths (i.e. ../) are not picked up by emulator.wtf.
The app cannot reach your backendUse --egress-tunnel, see testing against a backend running on the CI runner.

Options reference

Authentication

--token

Your API token. Can alternatively use the EW_API_TOKEN environment variable to pass this in.


Files

--workspace

Directory holding your Maestro flows (the Maestro workspace). Required.


--config

Workspace config file to use instead of the config.yaml at the workspace root.


--include-tags [tag1,tag2,...]

Only run flows that have at least one of the given tags.


--exclude-tags [tag1,tag2,...]

Skip flows that have any of the given tags.


--flows [glob1,glob2,...]

Comma-separated list of flows to run, in the same format as the flows: entries in config.yaml. Paths are relative to the workspace. Cannot be used together with --flows-for-shard.


--app

Application APK to test.


--additional-apks

A list of additional APKs to install.


--file-cache-ttl VALUE

Max time to keep cached files in the remote cache followed by an unit (d, h, m or s), with the maximum value being 7d and minimum value being 5m (default: 1h)


--no-file-cache / --file-cache

Don’t use / use remote file cache to skip uploading APKs or test data that hasn’t changed.


Test configuration

--display-name TEXT

Display name of the test run in the web results UI


--device [key1=value1,key2=value2]

Specify device(s) to run flows with, use repeated values to run the flows on a combination of devices. Possible keys:

  • model - the device profile to use (list of supported models)
  • version - the API version to use (list of supported versions)
  • locale - device locale to use (default: en_US)
  • gpu - control if the emulator should use hardware-accelerated GPU (default: auto). Possible values:
    • auto: use hardware-accelerated GPU if available
    • software: use software rendering

--timeout [value]

Fail if the maestro execution exceeds the given timeout value. Values are in the format of number + suffix where suffix is either s, m or h (seconds, minutes or hours). Examples: 10m, 2h. Defaults to 15m.


--environment-variables [key1=value1,key2=value2]

A comma-separated list of key-value pairs that are passed to maestro as --env KEY=VALUE, accessible in flows as ${KEY}.


--secret-environment-variables [key1=value1,key2=value2]

A comma-separated list of key-value pairs passed to maestro as --env KEY=VALUE.

These will be passed to maestro in the same way as --environment-variables, but won’t be visible in the emulator.wtf UI. Use this for secrets (tokens, passwords, credentials, etc.).


--no-test-cache / --test-cache

Don’t use / use remote test cache to skip running flows if the exact same flow with the exact same apk was run before.


--side-effects / --no-side-effects

Indicates that the flows have side effects, i.e. they hit external resources and might be a part of a bigger test suite. Adding this flag means that the run will not use the test cache and will not be automatically retried in case of errors.

Defaults to --no-side-effects.


Sharding

--num-balanced-shards [value]

Splits your flows across multiple emulator instances by runtime. Emulator.wtf will try to assign flows to devices based on their historical runtime. This will give you the most even spread between shards for large test suites.

If historical data is not available then falls back to --num-shards (heuristic sharding so that each emulator instance has roughly the same number of flows).


--shard-target-runtime [value]

Split the flows automatically into multiple shards so that the target runtime for each shard would be around the given time target. This is done based on historical flow timing data on a best effort basis and subsequent maestro runs will be sharded more accurately.

Example:
Split flows into multiple shards so that every shard would take around 3 minutes: --shard-target-runtime 3m.


--testcase-duration-hint [value]

Hint for the average runtime for each flow expressed by a number followed by a unit (h, m, s or ms), with the maximum value being 3h and the minimum value being 1ms (default 10s). Useful when historical runtime data is missing for tests alongside with --shard-target-runtime or --num-balanced-shards.


--num-shards [value]

Splits your flows evenly across multiple devices. Emulator.wtf will try to balance the number of flows in each shard. Individual flow times are not taken into account so this can lead to uneven shard times.


--flows-for-shard [glob1,glob2,...]

Specify --flows-for-shard multiple times to spread flows into shards manually, every occurrence creates one shard. Takes the same format as --flows. Flows listed in more than one shard will run more than once.


Outputs

--record-video

Enable recording video during the maestro run. Use --no-record-video to disable recording.


--directories-to-pull

A comma-separated list of directories to pull from the device and store in the path specified by --outputs-dir. The path in --outputs-dir will have the same relative path as the absolute path on the device, i.e. --directories-to-pull /sdcard/acmeapp/screenshots --outputs-dir out will pull the contents of /sdcard/acmeapp/screenshots on the device to out/sdcard/acmeapp/screenshots.


--outputs

Specifies what to download into the path specified by --outputs-dir.

Available options:

  • summary - machine-readable summary about test results and outputs, similar output to --json
  • merged_results_xml - merged JUnit XML from all emulator instances (devices and shards)
  • pulled_dirs - pulled directories from emulator instances
  • results_xml - all JUnit XML files, separate per emulator instance
  • logcat - logcat files, separate per emulator instance
  • captured_video - captured test video, separate per emulator instance

Default: merged_results_xml,pulled_dirs


--outputs-dir

Path to collect test run outputs to (JUnit report, logcat, any pulled directories).

CLI execution


--quiet

Suppress any logging (sent to STDERR), use this together with --json to only get json output in STDOUT.


--json

Print machine-readable test result into STDOUT, useful when wrapping ew-cli with your own scripts.


Emulator networking

--dns-server [ipv4-address]

IPv4 address of a DNS server to use for the emulator. This argument can be repeated multiple times (up to 4) to specify multiple DNS servers. Can be used together with --egress-tunnel to use DNS servers otherwise not visible to the emulator.

If omitted emulator.wtf will use an unspecified public DNS service by default.


--dns-override [host]=[ipv4-address]

Explicitly override DNS records used by the emulator. Useful for instance with --egress-localhost-fwd-ip to divert traffic going to a specific domain into the host machine running ew-cli instead. Can be repeated to override multiple domain resolutions.


--egress-tunnel

Redirects all network traffic from the emulator instance to ew-cli as if you were running the emulator locally. You can use this to test your app with a local server or an internal environment only accessible to your local machine or CI runner.

Read more about the egress tunnel here.


--egress-localhost-fwd-ip [ipv4-address]

Makes ew-cli’s localhost available to the emulator instance under the specified IP address when using the egress tunnel. This is useful for testing local servers. NOTE: this should NOT be a public IP, loopback IP or a broadcast IP address.


Source control

--scm-url

Source control repository URL of the current run, on popular CI integrations this will be guessed from env variables.


--scm-commit TEXT

Commit identifier of the current run (hash), on popular CI integrations this will be guessed from env variables.


--scm-pr-url TEXT

Pull request URL for the current run, on popular CI integrations this will be guessed from env variables.


--scm-ref-name TEXT

Current branch/tag name, on popular CI integrations this will be guessed from env variables


CLI networking

--proxy-host

Configure an HTTP proxy host to use for all requests.


--proxy-port

Configure an HTTP proxy port to use for all requests.


--proxy-user

Set the HTTP proxy username to use for authentication.


--proxy-password

Set the HTTP proxy password to use for authentication.