Detox

Gray box end-to-end testing and automation framework for mobile apps

README


SWUbanner

Detox

  Detox

Gray box end-to-end testing and automation library for mobile apps.

Demo

[![NPM Version](https://img.shields.io/npm/v/detox.svg?style=flat)](https://www.npmjs.com/package/detox) [![NPM Downloads](https://img.shields.io/npm/dm/detox.svg?style=flat)](https://www.npmjs.com/package/detox) [![Build status](https://badge.buildkite.com/39afde30a964a6763de9753762bc80264ba141e1c1f41fc878.svg)](https://buildkite.com/wix-mobile-oss/detox) [![Coverage Status](https://coveralls.io/repos/github/wix/Detox/badge.svg?branch=master)](https://coveralls.io/github/wix/Detox?branch=master) [![Detox is released under the MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![PR's welcome!](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://wix.github.io/Detox/docs/contributing) [![Discord](https://img.shields.io/discord/957617863550697482?color=%235865F2\&label=discord)](https://discord.gg/CkD5QKheF5) [![Twitter Follow](https://img.shields.io/twitter/follow/detoxe2e?label=Follow\&style=social)](https://twitter.com/detoxe2e)

What Does a Detox Test Look Like?


This is a test for a login screen, it runs on a device/simulator like an actual user:

  1. ``` js
  2. describe('Login flow', () => {
  3.   it('should login successfully', async () => {
  4.     await device.reloadReactNative();

  5.     await element(by.id('email')).typeText('john@example.com');
  6.     await element(by.id('password')).typeText('123456');
  7.     await element(by.text('Login')).tap();

  8.     await expect(element(by.text('Welcome'))).toBeVisible();
  9.     await expect(element(by.id('email'))).toNotExist();
  10.   });
  11. });
  12. ```


About


High velocity native mobile development requires us to adopt continuous integration workflows, which means our reliance on manual QA has to drop significantly. Detox tests your mobile app while it’s running in a real device/simulator, interacting with it just like a real user.

The most difficult part of automated testing on mobile is the tip of the testing pyramid - E2E. The core problem with E2E tests is flakiness - tests are usually not deterministic. We believe the only way to tackle flakiness head on is by moving from black box testing to gray box testing. That’s where Detox comes into play.

- Cross Platform: Write cross-platform end-to-end tests in JavaScript. Currently supports iOS and Android.
- Debuggable: Modern async-await API allows breakpoints in asynchronous tests to work as expected.
- Automatically Synchronized: Stops flakiness at the core by monitoring asynchronous operations in your app.
- Made For CI: Execute your E2E tests on CI platforms like Travis CI, Circle CI or Jenkins without grief.
- Runs on Devices: Gain confidence to ship by testing your app on a device/simulator just like a real user (not yet supported on iOS).
- Test Runner Agnostic: Detox provides a set of APIs to use with any test runner without it. It comes with Jest integration out of the box.

Supported Versions


Environment


- OS: macOS 10.15 (Catalina) or higher; Ubuntu Linux 20.04 or higher; Windows 10 Version 1803 or higher
- Xcode: 11.0 or higher
  - iOS Simulator Runtime: iOS 13.0 or higher

React Native


Detox is built from the ground up to support React Native projects as well as pure native ones.

The following React Native versions have been tested:

iOSAndroid
----------------------------------------------------------------------------------------------------------------------------------------
0.68.x0.68.x

Future versions are most likely supported, but have not been tested yet. Please open issues if you find specific issues with newer React Native versions.

Get Started with Detox


Read the Getting Started Guide to get Detox running on your app in less than 10 minutes.

Documents Site


Explore further about using Detox from our new website.

Core Principles


We believe that the only way to address the core difficulties with mobile end-to-end testing is by rethinking some of the principles of the entire approach. See what Detox does differently.

Contributing to Detox


Detox has been open-source from the first commit. If you’re interested in helping out with our roadmap, please see issues tagged with the [](https://github.com/wix/Detox/labels/user%3A%20looking%20for%20contributors) label. If you have encountered a bug or would like to suggest a new feature, please open an issue.

Dive into Detox core by reading the Detox Contribution Guide.

License


- Detox is licensed under the MIT License

Non-English Resources (Community)