Detox
Detox copied to clipboard
How to interact with system alert dialogs
Description
Our app calls a Cancel/Continue
system alert dialog. The Matcher can't seem to locate the button to tap. Any ideas how to handle an element like this?
Detox version
19.4.5
React Native version
0.66.3
Node version
No response
Device model
iphone 11
Xcode version
13.2.1
iOS version
15.2
macOS version
12.2.1
Android version
No response
Test runner
jest-circus
Hi @davidjonesdialexa, unfortunately, Detox is not supporting interactions with system dialog, we are still working on this as part of XCUITest integration.
In the meanwhile, I can suggest to use a launch argument that will disable / fake the login while testing with Detox.
@davidjonesdialexa As a work around maybe you can you try something like this:
element(by.label("Continue")).atIndex(0).tap();
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this reporsitory, read this discussion.
@davidjonesdialexa As a work around maybe you can you try something like this:
element(by.label("Continue")).atIndex(0).tap();
Tried this but doesnt work.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this reporsitory, read this discussion.
The issue has been closed for inactivity.
Please what is the fix for this?
Is this still something that is being developed? Would be very helpful for a lot of projects I'm sure
This works sometimes for me:
await element(by.label('Continue').and(by.type('_UIAlertControllerActionView'))).tap();
Where Continue is the text in the button you want to tap :)
Is there a fix for this issue? Thanks!
Bump.
Is there any development or workaround here? Finding elements by.text
works in some cases but if there is a system alert on the screen nothing helps.
I have the same problem, I can't fix this, Does anyone have an idea?
Hi everyone, any update on this issue? How can we pass through this issue?
This is absolutely required, cannot login without this.
@codeyogi911 you need to press the button on that dialog with your finger or mouse pointer. detox cannot catch that layout dialog
_UIAlertControllerActionView
This is working fine for me on iOS simulator, but it doesn't for android emulator. I couldn't find an alternative for Android. Any solutions please ?
_UIAlertControllerActionView
This is working fine for me on iOS simulator, but it doesn't for android emulator. I couldn't find an alternative for Android. Any solutions please ?
I think the UIDevice API can come in handy for Android (also check the reference there to the Android dev guide). I think techniques relying on DPadDown
, DPadRight
etc. could work best here.
You can try it out regardless of Detox in "playground" mode using ADB, with commands such as:
adb shell input keyevent KEYCODE_DPAD_DOWN
Please report back if you manage to sort that out 🙏🏻
how is anyone ever building a useful test suite with this library 😢
Support for system interactions was released with Detox v20.22
Support for system interactions was released with Detox v20.22
Thank you for this functionality! Should it works with react-native Alert.alert
?
Support for system interactions was released with Detox v20.22
Thank you for this functionality! Should it works with react-native
Alert.alert
?
Thanks! Yes :)
Support for system interactions was released with Detox v20.22
Thank you for this functionality! Should it works with react-native
Alert.alert
?Thanks! Yes :)
@asafkorem For some reason it's doesn't works for me
I have tried both options:
const button = system.element(by.system.label("Continue"));
and const button = system.element(by.system.type("button")).atIndex(0);
Any ideas? 🤔
BTW, how DetoxXCUITestRunner
knows which app we need to use for queries?
Is it ok to see this path not related to my local machine?
I'm having the same issue that @vomchik reported. I tried the latest version 20.23.0 but I didn't see any difference. Any idea of what I may be missing? Thank you!