Detox
Set up workflow to run Detox E2E tests for every Pull Request.
Learn more about Detox: wix.github.io/Detox
Usage
npx setup-ci --preset --detox
Detailed behavior
Below you can find detailed information about what the script does with your project when generating Detox workflow.
Installed dependencies
detox
(dev)jest
(dev)typescript
(dev)ts-jest
(dev)@types/jest
(dev)@config-plugins/detox
(dev) (if project uses Expo)
Manual native code patch
If your project is not using Expo, you will have to manually patch the native code to make Detox work. SCI will provide you with the necessary instructions. Specifically, it will ask you to follow step 4 from Detox project setup.
Release build workflow
To test the app with Detox, we need to first build the app in release mode. Therefore, apart from CI workflow to run Detox tests, SCI will generate workflows for building the app, on which the Detox workflow depends. You can read more about the release build workflow in Release build.
Modified and created files
File | Changes |
---|---|
.github/workflows/test-detox-android.yml | Contains the CI workflow for Detox on Android |
.github/workflows/test-detox-ios.yml | Contains the CI workflow for Detox on iOS |
package.json |
|
app.json | Add @config-plugins/detox to expo.plugins if project uses Expo (if app.config.js is detected instead, SCI will prompt you to add it manually) |
.detoxrc-ci.js | Created with Detox configuration for CI |
e2e/jest.config.js | Jest configuration for Detox, created if no e2e directory is detected |
e2e/starter.test.ts | Example Detox test, created if no e2e directory is detected |
Workflow details
test-detox-android
The following diagram represents the flow of test-detox-android
workflow:
test-detox-ios
The following diagram represents the flow of test-detox-ios
workflow:
Known issues and limitations
- Currently Detox tests are run on release builds. This means that the app will have to be built every time the code changes (native or JS). This can be time-consuming and if you would like to save this time, consider using Maestro workflow which is run on debug build. This allows for caching and rebuilding the app only if native code changes, which results in significant resource and time savings.