SwiftUI Element matchers, visibility & actions (like tap) not working with detox 18.x


Detox 18.x can’t seem to match, view & interact with swiftUI elements.

  • I have tested this issue on the latest Detox release and it still reproduces


I found this closed issue in detox issues regarding swiftUI & forked this sample repo from there & added jest support for better logs, I also added an action to the button in that repo to show an alert & added a tap acton in detox tests.

Please see this repo for reproducing the issue, I have created branches for detox version 17.14.9 , 18.0.0 , 18.3.1 for test convenience.

  • Basically with version 17.14.9 detox can see the button & click it too (but after that it seems to be waiting on some event to sync up, have included test run logs below with debug-sync) & thus never runs the next step & fails

  • With version 18.0.0 & 18.3.1 , detox doesn’t seem to even see the button & is also unable to tap it (I even tried disableSync & no luck sadly).

  • Adding steps to reproduce below

  1. Run npm install
  2. Run npm run detox:ios:build
  3. Run npm run detox:ios:test (added various debug flags for convenience)

Please let me know if you need any more info 🙏🏼, also great work with detox!

Expected behavior

Detox should be able to match, view SwiftUI elements & interact with them


I have attached videos of the full test runs below for detox-17.14.9 & detox-18.3.1 (notice on 17.14.9 it sees the button & taps it as the alert pops up , but with version 18.3.1 it can’t even see the button)

Environment (please complete the following information):

  • Detox: 18.3.1
  • Node: v10.14.1
  • Device: iPhone 11 Pro
  • Xcode: Version 12.4 (12D4e)
  • iOS: 14.4
  • macOS: 11.2 (Big Sur)


If you are experiencing a timeout in your test

Device and verbose Detox logs

  • I have run my tests using the --loglevel trace argument and am providing the verbose log below:

Please see the logs of test run with various detox versions below

1 possible answer(s) on “SwiftUI Element matchers, visibility & actions (like tap) not working with detox 18.x