← 全部工具

detox-cli

热度 65 更新于 开发与构建

Optional wrapper for Detox CLI, meant to be installed globally

npmauto-collected

安装

npm
npm install -g detox-cli

通过 npm 安装。

<p align="center" <img alt="Detox" width=380 src="https://raw.githubusercontent.com/wix/Detox/master/docs/img/DetoxLogo.png"/ </p <h1 align="center" Detox </h1 <p align="center" <bGray box end-to-end testing and automation framework for mobile apps.</b </p <p align="center" <img alt="Demo" src="docs/img/Detox.gif"/ </p <h1</h1

<img src="https://user-images.githubusercontent.com/1962469/89655670-1c235c80-d8d3-11ea-9320-0f865767ef5d.png" alt="" height=24 width=1 [](https://www.npmjs.com/package/detox) [](https://www.npmjs.com/package/detox) [](https://buildkite.com/wix-mobile-oss/detox) [](https://coveralls.io/github/wix/Detox?branch=master) [](LICENSE) [](https://wix.github.io/Detox/docs/contributing) [](https://discord.gg/CkD5QKheF5) [](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:

describe('Login flow', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should login successfully', async () => {
    await element(by.id('email')).typeText('john@example.com');
    await element(by.id('password')).typeText('123456');

    const loginButton = element(by.text('Login'));
    await loginButton.tap();

await expect(element(by.label('Welcome'))).toBeVisible(); }); });


[Get started with Detox now!](https://wix.github.io/Detox/docs/introduction/getting-started)

## 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 end-to-end tests in JavaScript for React Native apps (Android & iOS).
- **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.
  • 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 React Native Versions

Detox was built from the ground up to support React Native projects.

While Detox should work out of the box with any React Native version of the latest minor releases, the official versions compatibility is provided according to the following:

  • RN v0.77.x - v0.84.x: Fully compatible with React Native's "New Architecture".

Newer RN versions might work with Detox, but they've not been thoroughly tested by the Detox team yet.

Although we do not officially support older React Native versions, we do our best to keep Detox compatible with them.

In case of a problem with an unsupported version of React Native, please submit an issue or write us in our Discord server and we will do our best to help out.

Known Issues with React Native

  • Visibility edge-case on Android: see this RN issue.

Get Started with Detox