expo / eas-tests-example

Demo of running E2E tests on EAS Build
33 stars 2 forks source link

[ENG-3865] Run Android E2E tests on EAS Build #3

Closed dsokal closed 2 years ago

dsokal commented 2 years ago

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

  1. Cleaned up code from https://github.com/expo/eas-tests-example/pull/2 - the PR hasn't been reviewed:
  2. Configure EAS Build to run E2E tests for Android:
    • Install @config-plugins/detox + run prebuild to generate android/ (you can skip reviewing files in the directory as the files are auto-generated).
    • Add 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) and android.release configuration to .detoxrc.json.
    • Install emulator system deps in pre-install hook + the pixel_4 emulator.
    • Run the emulator and then run Android tests in 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

linear[bot] commented 2 years ago
ENG-3865 Testing on EAS Build documentation

**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.