airbnb/okreplay

Push Ok Replay Tapes Gradle Task

christopherperry opened this issue · 4 comments

To create certain scenarios it's convenient to first run a test to record a tape, then pull it, modify it, then push it back to the device so it replays the modified tape. Would be great to have a task to push tapes from resources/tapes to the device. Or is there some other workflow I'm supposed to be using? It's not exactly clear from the documentation.

The tapes are loaded from the instrumentation APK assets folder actually. They are only written to external storage, but for reading, you don't need to push them to the device. Just rebuilding the instrumentation APK should be enough.

Thanks @felipecsl can you add this to the README?

This has been explained in the blog post:

For Android Espresso tests, tapes are stored by default in src/androidTest/assets/tapes 
and loaded (read) during test execution as regular assets using Android's AssetManager. 
For recording (writing), they are stored in the device's external storage directory and 
automatically pulled out of the device after the test execution using a simple 
Gradle Plugin that comes with OkReplay. 
This distinction happens because the test APK is not able to 
overwrite its own package contents to modify the YAML asset files during runtime, so our 
only option was to write it to external storage instead and overwrite the files using 
the Gradle plugin. The tapes should be easily readable and may be modified as needed.

Maybe we should add a link to the article in the Readme?

Sounds good.