I implemented Detox for e2e tests in my react-native application, I have 2 tests:
- Launch -> Not logged -> display login form -> Main screen
- Launch -> Logged -> Main screen
auth informations are stored with AsyncStorage, I implemented a mockup store.e2e.js using Repackager. Fine, but I need to start app with two different sets of data storage: one empty for test1 and another with username/password for test2.
So I add a hack with launchApp + url parameter or device.sendUrl, catched by Store mock at init using Linking.addEventListener('url', callback). Ok problem solved. But it forced me to activate deeplinking on Android and iOS, which I don't want in my app... Made a special case in the code only for testing, it is bad.
I understand it is a well known problem, and repackager was made for that: https://github.com/wix/detox/issues/91
But how to inject some parameters in app at launch for specific tests, is it possible ? What is your best practice for such problem ?