Skip to content
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@rotemmiz @simonracz @LeoNatan @DanielMSchmidt
78 lines (55 sloc) 2.22 KB


Detox uses Matchers to find UI elements in your app, Actions to emulate user interaction with those elements and Expectations to verify values on those elements.

Expect verifies if a certain value is as expected to be.



Expect the view to be at least 75% visible.

await expect(element('UniqueId204'))).toBeVisible();


Expect the view to not be visible.

await expect(element('UniqueId205'))).toBeNotVisible();


Expect the view to exist in the UI hierarchy.

await expect(element('UniqueId205'))).toExist();


Expect the view to not exist in the UI hierarchy.

await expect(element('RandomJunk959'))).toNotExist();


  • In React Native apps, expect UI component of type <Text> to have text.

  • In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text.

await expect(element('UniqueId204'))).toHaveText('I contain some text');


  • It searches by accessibilityLabel on iOS, or by contentDescription on Android.

  • In React Native it can be set for both platforms by defining an accessibilityLabel on the view.

await expect(element('UniqueId204'))).toHaveLabel('Done');


  • In React Native apps, expect UI component to have testID with that id.
  • In native iOS apps, expect UI element to have accesibilityIdentifier with that id.
await expect(element(by.text('I contain some text'))).toHaveId('UniqueId204');


Expect components like a Switch to have a value ('0' for off, '1' for on).

await expect(element('UniqueId533'))).toHaveValue('0');
You can’t perform that action at this time.