Add support for string interpolation in runScript file names
Proposed changes
Will enable runScript commands to have js string interpolation in their file names. Example:
appId: com.example.app
env:
SCRIPT_FILE: 125_myScript.js
---
- runScript: 125_myScript.js
- runScript:
file: ${SCRIPT_FILE}
- runScript: ${ (120 + 5) + '_myScript.js' }
- evalScript: ${ output.somePath = "125_myScript.js" }
- runScript: ${ output.somePath }
This change moves some file handling from the orchestra module to the orchestra-models module (including the corresponding InvalidFlowFile exception), to be able to read the script files after the jsEngine has done its magic and applied any string interpolation. This, however, means that any "file not found" issues are now not reported until runtime instead of when the maestro command is ran. After quick discussion with Dan Caseley, we figured this would be an acceptable tradeoff.
Testing
I've added a test to the integration test suite, and built the Maestro CLI locally and tested on some sample flow.
Issues fixed
This change does not fully fix a single issue, but is a partial fix or the beginning on a fix to the following issues:
- Discussing runFlow and runScript: https://github.com/mobile-dev-inc/Maestro/issues/2012
- Discussing runFlow: https://github.com/mobile-dev-inc/Maestro/issues/1314
Thanks for having a look at this, hope we can get it merged soon! 🙏
@Dambakk You'll note that I moved the tests from 125 to 131 in my previous rebase, and that the next rebase will need to increment them further. I hate the sequencing in that file...
Yeah, that looks like a bit of a hazzle..
Is there anything I can do to help get this through? @Fishbowler