Adds infra to support recording Maestro tests#2876
Adds infra to support recording Maestro tests#2876JayShortway wants to merge 2 commits intomaestro-play-store-purchasefrom
Conversation
| # Kotlin error logs | ||
| .kotlin/errors/ | ||
| # Kotlin compiler | ||
| .kotlin |
There was a problem hiding this comment.
The shell-over-http project caused some more files being created in this folder. Ignoring this entire folder is recommended anyway:
Do not commit the .kotlin directory to version control. For example, if you are using Git, add .kotlin to your project's .gitignore file.
rickvdl
left a comment
There was a problem hiding this comment.
Nice work! This should really help with debugging failures :)
I'm going back and forth wondering if being able to run any shell code over the HTTP server is a security risk, but I can't really think of an example that would make it any different from running the same code in a circle CI config file for example. In the end it's a local webserver so the code has to be in git for it to be able to execute it on the machine locally, which is ephemeral by design anyways. So I think we're good on that front. But happy to hear it if anyone thinks differently about it :)
| function start(filename) { | ||
| var name = normalizeFilename(filename); | ||
|
|
||
| var pid = output.shell.start('adb shell screenrecord /sdcard/' + name); |
There was a problem hiding this comment.
This is nice to be able to run full commands through the webserver 👏
tonidero
left a comment
There was a problem hiding this comment.
It looks great! my only question is whether we need to run the shell-over-http server before starting to execute the maestro flows in order for this to work?
| function start(filename) { | ||
| var name = normalizeFilename(filename); | ||
|
|
||
| var pid = output.shell.start('adb shell screenrecord /sdcard/' + name); |
There was a problem hiding this comment.
Hmm I'm not sure, is the /sdcard/ folder always guaranteed to exist? Not sure if we should record in a documents folder or something like...
|
|
||
| function run(cmd) { | ||
| if (!isServerRunning()) { | ||
| return { exitCode: -1, stdout: '', stderr: 'shell-over-http server not running' }; |
There was a problem hiding this comment.
I'm probably missing something... but do we need to start the server for shell-over-http in the circleci job/fastlane lane before running the tests?
Description
Note: based on #2866.
This adds the ability to record individual Maestro tests.
New infra
Here's the new infra:
ShellServer, which can run arbitrary shell commands on the (CI) host.maestro/shell/shell.jsscript to make it easier to run shell commands through this server.record/scripts/android.jsscript that callsshell.jsand runs the correct ADB commands to control screen recording.record/start.ymlandrecord/stop.ymlwhich make it convenient to start and stop screen recording from Maestro flows.Can be shared with iOS in the future
The above can be shared with iOS too, if we create
record/scripts/ios.jswhich runs something like(We can pre-compile the
ShellServerand run it as jar or something.)How it's used
And this is how it's used:
maestro/test_paywall_v2.yamlstarts recording inonFlowStartand stops recording inonFlowComplete.onFlowCompleteruns regardless of success, I addedconventions/mark-successful.ymlto mark the flow successful. This should be run at the end of the regular flow steps.