runScript
Last updated
Was this helpful?
Last updated
Was this helpful?
The runScript
command runs a provided JavaScript file.
A script would typically perform some action and set an output value that could be accessed later. See Outputs for more information.
For more information regarding JavaScript, please refer to the JavaScript section:
Paths can be relative or absolute. Relative paths are required for cloud running. Relative paths are relative to the calling flow, not to the directory running the command.
In a directory structure like this:
The flow test.yaml
would look like this:
runScript
accepts env
parameters, in the same way as runFlow
does (see Nested Flows).
Console logging is supported from the JavaScript files provided in runScript
command. Logs from JavaScript are redirected to the console when using Maestro CLI.
Remember that when running in the cloud and requiring another file, you must specify a folder on the command line not just the flow file, e.g. maestro cloud myApp.apk ./myTestsFolder
else Maestro won't have the files required to run your tests, and you'll receive a 'Failed to parse file' error.
You can use conditionals to run a JavaScript file when some condition is true. For more information, please refer to the documentation.