Detox: How to press / tap on an `ActionSheetIOS` item

Created on 28 Jul 2020  ·  7Comments  ·  Source: wix/Detox

How to press / tap on an ActionSheetIOS item,
the only way I can think of it to get the item by text, but that does not work ...

Note that I'm able to assert that the item is visible by text, but tapping it produces an error

Test Failed: Failed expectation: TOBEVISIBLE WITH MATCHER(identifier: == “singInScreen.screen”), Another view “<RCTView: 0x7fc96cd65520>” is visible at window point “{"x":207,"y":448.71497584541066}” TIP: To print view hierarchy on failed actions/matches, use loglevel verbose and above.

Screen Shot 2020-07-28 at 2 40 59 AM

questiostack overflow

All 7 comments

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visibility. We'll take a look at it.

For issues with Expo apps, it is most likely not an issue with Detox itself, but with the Expo runtime or with incorrect Detox setup. For support on how to use Detox with Expo, you should contact the Expo team or the Expo community.

For more information on bots in this repository, read this discussion.

this could be a bug with detox

It doesn't look like a bug in Detox. Your visibility assertion is failing, meaning your item is not visible.

@LeoNatan the visibility assertion is passing

getting element by label && then selecting the 0th index solves the issue for me

await getByLabel("Sign Out")().atIndex(0).tap()

"Sign Out" is the label in the action sheet?

Just be careful with using atIndex(), as it might break if your interface changes, or more items appear with the same label. Sadly, UIAlertController (implementation of action sheet in iOS) does not expose its buttons and does not allow setting an identifier on them.

will do, I'm new to the whole testing thing 😕 .
thank you @LeoNatan

Cheers!

Was this page helpful?
0 / 5 - 0 ratings