An example React Native project for Redux Toolkit CI that runs Detox end-to-end tests against a Metro bundler build.
- Clone the project
git clone
- Install dependencies
yarn install
- Setup a local Pixel 3a API 30 Android Virtual Device.
- Start the Pixel 3a API 30 Virtual Device
- Install the release packages with
yarn adb:install
(after virtual device has started) - Redirect ADB ports to local mock server with
yarn adb:redirect
- Run tests
yarn test
After developing, to rerun the tests...
- Build new APK apps with
yarn build
- Install the release packages with
yarn adb:install
- Run the tests:
yarn test
The tests run with jest
since Detox supplies setup and takedown scripts compatible with that tool. It might be possible to run with vitest
with more experimentation and custom configurations/scripts.
The project uses Android emulation to run the Metro bundle. It is the most widely compatible for local development.
Android Debug Bridge (ADB) service for emulation does not reliably run on Ubuntu Linux (from experience); therefore, MacOS is the preferred runner. Not sure if it's due to how reactivecircus/android-emulator-runner@v2
is setup or something else.
Letting Detox handle the installation of the APK app on emulator results in the following error in the workflow...
ChildProcessError: '/Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk' failed with code null
The solution is to install the APK app in the emulator before running the Detox tests. This is the purpose of the yarn adb:install
and yarn adb:install:test
scripts.
In the GitHub Action workflow, there'll be a repeating output of...
/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
adb: device offline
This is normal. The action is waiting on the emulator to boot.
Without cache on the first run, the workflow takes about 30 - 40 minutes to complete. With all cache, the workflow takes about 10 - 15 minutes.