Closed dsokal closed 2 years ago
**Goal** Document how to run tests on EAS Build, even though we haven't designed any affordances for this yet. If we encounter blockers to doing this, try to remove them. **Description** * Running unit tests (likely just recommend a build hook) * E2E testing (eg: detox and react-native-owl) using iOS simulators / Android emulators This task is pretty open ended. I think a good first step is to figure out how to get e2e tests (running inside of simulator/emulator) running at all on EAS Build.
Why
We've enabled nested virtualization for Android builds. Thanks to that, we can run Android emulator on EAS Build to run E2E tests.
How
adapter.afterAll();
inafterAll
hook in setup.js - https://github.com/expo/eas-tests-example/pull/3/files#diff-4d4a78dcedcf05fcf1221add78a46040125717a1b7aadf07f90669c026a8b487L12 I'm not sure why this was there. This doesn't seem to be necessary. Also, removing this line let me get rid of thepatch-package
module and the patch fortempfile
. @douglowderconst argparse = require('detox/src/utils/argparse');
, use theDETOX_CONFIGURATION
env var to detect the platform and target. IntroduceEXPO_USE_UPDATES
for selecting bundle source (this is much cleaner).e2e/testdeeplink.js
as I feel this doesn't belong to this repo.@config-plugins/detox
+ run prebuild to generateandroid/
(you can skip reviewing files in the directory as the files are auto-generated).android.debug
(I haven't been able to run tests with this config successfully; Detox is stuck at launching the app even though it is successfully launched in the emulator) andandroid.release
configuration to.detoxrc.json
.pre-install
hook + the pixel_4 emulator.on-success
hook. Running the emulator before running Detox seems to be fixing the problem where Detox is unable to launch the app for the first time 🤷Test plan
eas build -p all -e test
and see the builds finish successfully.Android: https://expo.dev/accounts/dsokal/projects/eas-tests-example/builds/5c179d94-ac93-47e7-8ab5-1778726a36ce