Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detox

Package Overview
Dependencies
Maintainers
3
Versions
656
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detox

E2E tests and automation for mobile

  • 20.25.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101K
decreased by-58.37%
Maintainers
3
Weekly downloads
 
Created

What is detox?

Detox is an end-to-end testing and automation framework for mobile applications. It is designed to test mobile apps on both iOS and Android platforms, ensuring that the app works as expected from the user's perspective. Detox is known for its ability to handle asynchronous operations and its integration with popular mobile development frameworks like React Native.

What are detox's main functionalities?

End-to-End Testing

This code demonstrates a basic end-to-end test using Detox. It launches the app, checks for the visibility of a welcome screen, taps a button, and verifies that a 'Hello' screen is displayed.

const { device, expect, element, by } = require('detox');

beforeAll(async () => {
  await device.launchApp();
});

describe('Example', () => {
  it('should have welcome screen', async () => {
    await expect(element(by.id('welcome'))).toBeVisible();
  });

  it('should show hello screen after tap', async () => {
    await element(by.id('hello_button')).tap();
    await expect(element(by.text('Hello!!!'))).toBeVisible();
  });
});

Device Interaction

This code sample shows how to interact with the device using Detox. It includes actions like rotating the device to landscape mode and shaking the device.

const { device } = require('detox');

beforeAll(async () => {
  await device.launchApp();
});

describe('Device Interaction', () => {
  it('should rotate the device to landscape', async () => {
    await device.setOrientation('landscape');
  });

  it('should shake the device', async () => {
    await device.shake();
  });
});

Synchronization

This code demonstrates Detox's synchronization capabilities. It waits for a specific element to become visible within a given timeout period.

const { device, element, by } = require('detox');

beforeAll(async () => {
  await device.launchApp();
});

describe('Synchronization', () => {
  it('should wait for element to be visible', async () => {
    await waitFor(element(by.id('uniqueId'))).toBeVisible().withTimeout(2000);
  });
});

Other packages similar to detox

FAQs

Package last updated on 15 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc