This repository contains an example of how to setup & run Detox end to end tests inside a TV app build with react-native-tvos
.
You can find the tests inside the e2e
folder.
There are 2 example screens within it, one containing a simple selectable list & details screen, and the other containing a form with a simulated network call.
Disclaimer: this example only works with Android TV at the moment. Apple tvOS instructions will be added once Detox/EarlGray supports it.
- Install dependencies by running
yarn install
in the project root. If on macOS, you can run:to install node andbrew update && brew install node
to install yarn.npm install --global yarn
- Install detox command line tools:
npm install -g detox-cli
. - Install Android SDK tools and create a TV test device emulator in Android Studio. The instructions are in the detox docs.
- Verify that
adb
is in your PATH by runningadb devices
in the terminal. If you're gettingcommand not found
, installadb
withbrew install android-platform-tools
(macOS).
- Start your emulator in Android Studio. Make sure you don't have any other connected Android devices.
- Run
yarn android
in the project root. It should build the app and start the React Native metro packager in another terminal window. - The app should start inside the emulator. You can navigate using the arrow keys on your keyboard.
Just run yarn e2eBuildAndroid
to create a test build.
For this step you need to create a test build first.
- Run
yarn start
to start the React Native metro server (if it's not already running). - Run
yarn e2eTestAndroid
to start up the emulator and run the tests.