tweaselORG / appstraction

An abstraction layer for common instrumentation functions (e.g. installing and starting apps, setting preferences, etc.) on Android and iOS.
MIT License
4 stars 1 forks source link

Emulator: `ensure` -> `reset` workflow is inefficient #47

Open baltpeter opened 1 year ago

baltpeter commented 1 year ago

If you want to use an emulator, you would typically first call ensureDevice() and then resetDevice(), just like we do in the example:

https://github.com/tweaselORG/appstraction/blob/63a1c8ca1d1a25384c9e25a285042b7d95f841c1/examples/android-emulator.ts#L17-L18

However, that is quite inefficient. With #27, we're starting to do quite a bit of prep work in ensureDevice(), like installing WireGuard. It's pretty silly to do that only to then immediately reset the emulator to a snapshot (which itself will call ensureDevice()).

But you can't just skip the first ensureDevice() call either since we do want to assert that the device is ready. Maybe we want to add a prepare: boolean parameter that defaults to true?