Add start session command to increase speed of tests #1902
+125
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
feat:Add start session command to increase speed of tests
When running on lower end Android devices, Maestro can take a long time to start and to finish the test, since it's installing the APKs + uninstalling at the end (can take ~20s on low end devices)
For instance, we use Flashlight to generate e2e performance reports based on several e2e test iterations and we recommend heavily the use of Maestro.
However the time bottleneck of running multiple test iterations is those install/uninstall.
This PR introduces a
start-session
command:maestro test
in another tab, setup won't be done again, and the tests will be fast ⚡How it works
I was surprised by how easy it was to do and kudos for that 👏 You guys did a fantastic job there♥️
The
start-session
command allows us to keep an active session open. Subsequent test command will find the session active inSessionStore
and use it.Then
openDriver
will be set to false, and theAndroidDriver
won't run theopen()
function which does all the heavy setup.Sadly this isn't the case for iOS, so we don't have it working out of the box.
Potentially breaking shards?
For reference, I've run a "shard" test with
./maestro test -s 2 tests
including somelaunchApp
and it worked for me. Likely I've missed a use-case.Testing
Screen.Recording.2024-08-09.at.5.24.32.PM.mov
Screen.Recording.2024-08-09.at.5.29.50.PM.mov
Issues fixed
Fixes #1096