I’d like to end to end test my app, and for React Native app testing in general, detox (in combination with jest) seems to be the best solution out there. It looks like there was some work to support expo + detox, but that was done 2 years ago: GitHub - expo/detox-tools: Tools for the detox testing framework for expo apps
I’ve tried following the guidelines, but the tests timeout and I get the following warning
The warning is: detox[5697] WARN: [Client.js/PENDING_REQUESTS] App has not responded to the network requests below: (id = -1000) isReady: {}
Forking expo-detox-typescript-example and making the amends mentioned in this StackOverflow post I was able to get it to work with Expo SDK v40 and Detox v17.
I’ll try and get the patch made into a PR for detox-expo-helpers at some point.
I’ve been unable to to get tests running on an Expo app which uses a dynamic config (via app.config.js), as we get this error:
TypeError: Cannot read property 'detach' of null
at ../../../../../../xdl@51.6.4/src/UrlUtils.js:208:13
at step (../node_modules/xdl/build/UrlUtils.js:386:191)
at ../node_modules/xdl/build/UrlUtils.js:386:361
It seems @expo-cli/xdl only reads static configs (app.json) and not dynamic configs. Perhaps there’s a step missing on my side. expo-detox-helpers is using quite an old version (51.6.4) of xdl. Maybe Expo Team can shed some light on this.
I was able to fix the dynamic config issues by forking detox-expo-helpers and bumping xdl to v59. The other patches by lookitsatravis (Travis Vignon) · GitHub have also been applied to that branch, removing the need to use patch-package.