You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a breakdown of the variables and flags used in the example:
36
-
- ./path/to/tests - the root directory containing all your Maestro test files
37
-
- folder_or_file_to_execute - a space-separated list of specific folders and files you want to run within the test directory. **Note:** Marathon Cloud does not execute tests from subfolders when a folder is specified.
38
-
For iOS:
39
-
- --application your_application.app - path to the [iOS application](/intro/ios#application-and-test-application)
40
-
For Android:
41
-
- --application your_app.apk - path to the [Android application](/intro/android#application-and-test-application)
35
+
-`./path/to/tests` - the root directory containing all your Maestro test files
36
+
-`folder_or_file_to_execute` - a space-separated list of specific folders and files you want to run within the test directory.
37
+
**Note:** Marathon Cloud does not execute tests from subfolders when a folder is specified. To change this behaviour
38
+
use [Maestro inclusion patterns](https://docs.maestro.dev/cli/test-suites-and-reports#inclusion-patterns)
39
+
-`--application your_application.app` - path to the [iOS application](/intro/ios#application-and-test-application)
40
+
-`--application your_app.apk` - path to the [Android application](/intro/android#application-and-test-application)
42
41
43
42
### Maestro environment variables
44
-
If your Maestro tests rely on environment variables, you'll need to pass them to Marathon Cloud.
45
-
A common use case is referencing the application ID in a test flow, as shown in this example:
43
+
Maestro tests often require environment variables to handle
44
+
dynamic data like usernames, API keys or appId. To pass these variables to your tests on Marathon Cloud, you use the **--maestro-env** flag.
45
+
46
+
To pass a custom environment variable, reference it within your Maestro test using the ${VARIABLE\_NAME} syntax.
47
+
All variables must start with MAESTRO_.
48
+
For example, to use a username variable:
49
+
```shell
50
+
appId: your.app.id
51
+
---
52
+
- launchApp
53
+
- inputText: ${MAESTRO_USERNAME}
54
+
```
55
+
56
+
You pass variables as key-value pairs (KEY=VALUE). For instance, to set MAESTRO_USERNAME to MY_USER_NAME:
57
+
```shell
58
+
export MARATHON_CLOUD_API_KEY=generated_api_key
59
+
marathon-cloud run maestro android --application your_app.apk --test-application ./path/to/tests --maestro-env=MAESTRO_USERNAME=MY_USER_NAME folder_or_file_to_execute
60
+
61
+
```
62
+
**Important:**
63
+
When you need to reference the application ID (appId) within a Maestro test, you must use a special variable name.
64
+
If your test flow requires the **APP_ID** to be a variable:
46
65
```shell
47
66
# flow.yaml
48
67
@@ -51,12 +70,15 @@ appId: ${APP_ID}
51
70
- launchApp
52
71
- tapOn: "Text on the screen"
53
72
```
54
-
To provide the value for **APP_ID**, use the **--maestro-env**flag. For instance, to set **APP_ID** to **your.app.id**, you would execute the following command:
73
+
You must pass the application ID using the **MAESTRO_APP_ID**environment variable.
55
74
```shell
56
75
export MARATHON_CLOUD_API_KEY=generated_api_key
57
-
marathon-cloud run maestro android --application your_app.apk --test-application ./path/to/tests --maestro-env=APP_ID=your.app.id folder_or_file_to_execute
76
+
marathon-cloud run maestro android --application your_app.apk --test-application ./path/to/tests --maestro-env=MAESTRO_APP_ID=your.app.id folder_or_file_to_execute
58
77
59
78
```
79
+
This specific handling for appId is required to ensure predictable behavior and prevent unexpected test failures.
80
+
We invite you to leave a comment [here](https://github.com/mobile-dev-inc/Maestro/issues/1789)
81
+
if you agree that Maestro should support MAESTRO_APP_ID for the app ID.
60
82
61
83
### Maestro filtering
62
84
For more granular control over which tests run, you can use Maestro's tag-based filtering in addition to the recommended practice of organizing tests into folders.
@@ -81,3 +103,15 @@ Next, pass this filter file to your Marathon Cloud command using the **--filter-
To leverage this feature, structure your test suite by placing each flow in a separate, independent YAML file. Flows within a single file are executed sequentially as one test and will not be parallelized.
0 commit comments