maestro icon indicating copy to clipboard operation
maestro copied to clipboard

runFlow command's path argument doesn't allow for interpolation of JavaScript values

Open AnaLuisaFav opened this issue 1 year ago • 4 comments

Use case

It should be simpler to Maestro read variable values. For example, for aesthetic and organizational reasons, I want to access flows that are in another folder. So I have to write - runFlow: ...Ubuntu\home\ana\app-syndic-automation\tests\login.yaml - runFlow:...Ubuntu\home\ana\app-syndic-automation\flows\subflows\accessPixComponent.yaml - runFlow:...Ubuntu\home\ana\app-syndic-automation\flows\subflows\accessPixKeyArea.yaml

This visually looks ugly and gives an impression of disorganization. So I didn't sit still until I found a way to do it, having to write a variable processing script in python. See, something that seems so simple, I had to make a SCRIPT for it.

And this is how it is now:

- runFlow: {{ LOGIN }}/login.yaml - runFlow: {{ CONDOMINIUM }}/accessPixComponent.yaml - runFlow: {{ CONDOMINIUM }}/accessPixKeyArea.yaml

So my suggestion is to find an easier way to do this.

Proposal

image

Anything else?

No response

AnaLuisaFav avatar Sep 03 '24 18:09 AnaLuisaFav

Hey @AnaLuisaFav 👋🏻 Thanks for taking time to share this feature request with us.

I thought you could already do something similar with JavaScript and output object, but turns out it's not possible.

.maestro/demo.yaml

appId: com.example.example
---
- launchApp:
- runScript: setVars.js
- runFlow: ${output.FLOW_DIR}/fill_form.yaml

.maestro/setVars.js

output.FLOW_DIR = './my/very/deep/dir/structure'

.maestro/my/very/deep/dir/structure/fill_form.yaml

appId: com.example.example
---
- launchApp

It fails with:

$ maestro test .maestro/demo.yaml

Failed to parse file: /Users/bartek/projects/maestro/e2e/workspaces/demo_app/demo.yaml
Flow file does not exist: file:///Users/bartek/projects/maestro/e2e/workspaces/demo_app/$%7Boutput.FLOW_DIR%7D/fill_form.yaml

bartekpacia avatar Sep 03 '24 21:09 bartekpacia

I'm gonna change title to make it possibe to allow JS variables interpolation within runFlow's path argument.

bartekpacia avatar Sep 03 '24 21:09 bartekpacia

I also need this, implementation would be much appreciated!

InkAndSteel avatar Sep 17 '24 10:09 InkAndSteel

#1314 requests the same but for environment variables. Essentially it's one feature request. I'm also interested in this

nalexn avatar Oct 14 '24 10:10 nalexn

I'm assuming this would apply to commands like startRecording so we can interpolate env vars as well. Thanks for taking this on!

shekharkhedekar avatar Dec 01 '24 01:12 shekharkhedekar

Yeah, and same with runScript as well!

Dambakk avatar Jun 17 '25 08:06 Dambakk

I'd love this as well

Hazer avatar Jul 08 '25 15:07 Hazer