Detox driver

Drop-in replacement for import { by, element, expect, waitFor, device } from 'detox'. Runs Detox tests against SootSim’s canvas without native iOS.

Matchers

by.id(testId) // match by testID
by.text(text) // match by text content
by.label(label) // match by accessibility label
by.role(role) // match by accessibility role
by.type(componentType) // match by component type

Element actions

element(matcher).tap()
element(matcher).longPress()
element(matcher).typeText(text)
element(matcher).replaceText(text)
element(matcher).clearText()
element(matcher).scroll(pixels, direction)
element(matcher).swipe(direction)
element(matcher).takeScreenshot(name)
element(matcher).getAttributes()

Assertions

expect(element(matcher)).toExist()
expect(element(matcher)).toBeVisible()
expect(element(matcher)).toHaveText(text)
expect(element(matcher)).toHaveId(id)
expect(element(matcher)).toHaveLabel(label)
expect(element(matcher)).toHaveRole(role)
expect(element(matcher)).toBeEnabled()
expect(element(matcher)).toBePressed()
// all support .not prefix

waitFor

waitFor(element(matcher)).toExist().withTimeout(ms)
waitFor(element(matcher)).toBeVisible().withTimeout(ms)
waitFor(element(matcher)).toHaveText(text).withTimeout(ms)

Device

device.launchApp()
device.reloadReactNative()
device.terminateApp()