Code Monkey home page Code Monkey logo

react-native-redux-e2e's Introduction

React Native Redux E2E

An example React Native project for Redux Toolkit CI that runs Detox end-to-end tests against a Metro bundler build.

App Screenshot

How to Setup Locally

  1. Clone the project git clone
  2. Install dependencies yarn install
  3. Setup a local Pixel 3a API 30 Android Virtual Device.
  4. Start the Pixel 3a API 30 Virtual Device
  5. Install the release packages with yarn adb:install (after virtual device has started)
  6. Redirect ADB ports to local mock server with yarn adb:redirect
  7. Run tests yarn test

After developing, to rerun the tests...

  1. Build new APK apps with yarn build
  2. Install the release packages with yarn adb:install
  3. Run the tests: yarn test

Notes

Jest Tests

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.

Android Device

The project uses Android emulation to run the Metro bundle. It is the most widely compatible for local development.

GitHub MacOS Runner

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.

Self installing APK

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.

ADB Process Errors

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.

Average Run Time

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.

react-native-redux-e2e's People

Contributors

eric-crowell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.