E2E Tests in React Native w/ Detox

Glauber Brack Castro
4 min readJun 8, 2022

In my last article, I explained about Unit Tests and how to setup it in a React Native project. But do you know what's the difference between each of them?

Before we talk about the difference, at this point you must know that a E2E (end-to-end) is a kind of test that will test all the user flow.

  • This type of test is time consuming
  • Are more complex to setup and to write
  • Are fragile (flaky), because they can broken every time
  • Is usually done by QA testers

If you google about tools for E2E tests, you probably will find out Detox. This is one of the most popular tools for this kind of tests in React Native.

I will use the same repository of the last article, creating a new branch called feat/e2e-setup from ```bash feat/mocked-tests```.

If you want, you can read the official documentation from Detox by clicking on here, but I also will do this with you.

Setting up Detox

First of all, you need to have the Node.js in your computer. After that, you need to install the Detox CLI.

npm install -g detox-cli

You need to make some steps to use Detox for iOS and Android. On iOS, your Homebrew must be in the…

--

--