Problem
We have a quite complex application and we don't want in each test case to go through the whole process to get to specific screen to test it, alternatively we just want to jump to specific one with some state stored in redux store.
What I've tried
I made multiple initial states which loads specific screen so I can test it directly and for each run of detox test I load different mocha.opts to select this portion of test cases and used 'react-native-config' so I can load different state in each run so for example for loading a screen I will do the following:
- Create initialState for redux store that has all the details of the screen I'm currently testing.
- Create mocha.opts to run only this test case by specifying the -f flag in it.
- Create .env.test.screenX file which will tell the store which initial state to load according to which ENVFILE I select.
- Create different configuration to each screen in detox so it can load the correct mocha opts through the detox CLI.
- each time I run the command ENVFILE=env.test.screenX react-native run-ios so the project would be built using this configuration and I can then run the detox test -c .
Question
My method is so complex and require alot of setup and overhead to run test for each screen so I was wondering if any one had the same issue and how could I solve it? In general how can I deal with the react native thread in detox?