Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for XCTest addUIInterruptionMonitor for iOS system alerts and dialogs #3017

Closed
antgly opened this issue Oct 13, 2021 · 11 comments
Closed

Comments

@antgly
Copy link

antgly commented Oct 13, 2021

I'm aware that the XCTest framework on iOS supports intercepting and interacting with system alerts, which is currently not a part of Detox.

It would be great if we could overload expect to await on an alert by text, instead of an element, passing in the text of the button to tap and/or the alert text to verify.

An example method call would look like this:

await expect(alert(by.text('This is an alert')).toBeVisible()

await alert(by.button('OK').tap()

If this has to be done as a setup step, then maybe an API like this could be useful:

beforeEach(async () => {
  // existing code
  await interceptAlert('This is an alert', buttons -> {
    buttons['OK'].tap()
  }
})

It could reject the promise if no button with label appears or if the alert doesn't appear within expect timeframe.

Apple's resource on the matter: https://developer.apple.com/documentation/xctest/xctestcase/handling_ui_interruptions

@d4vidi
Copy link
Collaborator

d4vidi commented Oct 18, 2021

Thanks for the suggestion, @antgly! We will keep this in mind in the context of our work on XCTest integ. in #2741.

@asafkorem FYI 😄

@lukebrandonfarrell
Copy link
Contributor

@antgly Currently, for system alerts such as permissions (it's not possible, yet) but... for system alerts triggered by Alert.alert this is possible, see: https://lukebrandonfarrell.medium.com/detecting-system-dialogs-with-detox-e2e-and-react-native-45e9b88e826b

@d4vidi
Copy link
Collaborator

d4vidi commented Oct 20, 2021

Nice blogpost, @lukebrandonfarrell! 😄

@stale
Copy link

stale bot commented Nov 19, 2021

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.

@stale stale bot added the 🏚 stale label Nov 19, 2021
@antgly
Copy link
Author

antgly commented Nov 22, 2021

Still interested in this (as are many following this project) 👍

@stale stale bot removed the 🏚 stale label Nov 22, 2021
@stale
Copy link

stale bot commented Dec 22, 2021

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.

@stale stale bot added the 🏚 stale label Dec 22, 2021
@stale
Copy link

stale bot commented Dec 29, 2021

The issue has been closed for inactivity.

@stale stale bot closed this as completed Dec 29, 2021
@antgly
Copy link
Author

antgly commented Jan 1, 2022

Can we keep this issue open as it’s a blocker for many apps’ system interactions?

@stale
Copy link

stale bot commented Feb 3, 2022

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.

@stale
Copy link

stale bot commented Feb 10, 2022

The issue has been closed for inactivity.

@asafkorem
Copy link
Contributor

Released with Detox v20.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants