-
Notifications
You must be signed in to change notification settings - Fork 744
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
How to confirm system alert like allow notification #55
Comments
|
Thank you for your reply. |
@346285234, you should typically be mocking notifications and other data requests in order to prevent the dialogs from coming up. You could also accept the notification manually and re-run your tests. We experimented with using the private UIAutomation framework for this and saw we could achieve this with it. For example, for pressing the left alert button.
|
Thank you for your help. I'll have a try. |
@346285234, were you able to find a solution for your issue? |
@tirodkar @346285234's screenshot is not from an iOS simulator, so the code snippet above won't work (as far as I know) unless his iOS device is jailbroken, he adds entitlement com.apple.private.hid.client.event-dispatch to his app and uses fake code signing. @346285234 Is your phone jailbroken? |
@346285234, were you able to test the solution out? |
thoughts on integrating with Facebook's WebDriverAgentLib which provides alert methods, among other useful features? |
Briefly looked at the implementation. It's using XCUITest APIs. Doesn't that boil down to #63 ? |
Kind of, the difference is they reimplemented a bunch of the APIs that are broken in XCUITest and have additional features. |
I just got the Facebook lib working with EarlGrey and I think it's quite powerful.
This is all within the unit testing target, no need for a multi-process model. |
I am hitting the same issue where I am unable to automate interacting with SystemAlerts on a real device. It complains saying UIAutomation isn't enabled even though I have enabled it in settings. Looks like I need a jailbroken device to be able to change the setting. |
I ended up using TCC.db modifications to prevent system alerts from showing up on simulators. |
neat. does that work for all types of system alerts? |
I think it works for all of them? These are the ones calabash added: {
:calendar => "kTCCServiceCalendar",
:camera => "kTCCServiceCamera",
:contacts => "kTCCServiceAddressBook",
:microphone => "kTCCServiceMicrophone",
:motion => "kTCCServiceMotion",
:photos => "kTCCServicePhotos",
:reminders => "kTCCServiceReminders",
:twitter => "kTCCServiceTwitter"
} Updating to include new services is easy. I also figured out how to auto configure the simulator keyboard to use the Facebook recommendations. |
Thanks. But as you specified this also works only on a simulator. Any idea On Wed, Jul 13, 2016 at 12:24 PM, bootstraponline notifications@github.com
Aishwarya Sundar |
I'd expect WebDriverAgentLib to work on real non-jailbroken devices. I haven't verified that though. |
It didnt not work the last time I tried to get this going on a device. So On Wed, Jul 13, 2016 at 2:13 PM, bootstraponline notifications@github.com
Aishwarya Sundar |
I only test on simulators since physical devices don't scale. If WebDriverAgentLib isn't working on physical devices then you might want to open an issue on their repo since Facebook tests on physical devices. |
@tirodkar Which private UIAutomation framework, Apple's private UIAutomation framework? How do you access it? |
@ArielSD Yes the same. It is still available in Xcode. You'd need to import the headers as is shown in the comment here. I'd prefer waiting on this feature though, since we plan to have it as part of EarlGrey's next major release version, which should support XCUITest. |
@bootstraponline I tried integrating WebDriverAgentLib into my project. But control never returns from 2nd line of code. The test completes but none of the print statements get executed. Did you also face such issue ? |
WebDriverAgentLib has changed quite a bit since last year. It wouldn't surprise me if this no longer works. Each Xcode release seems to break things. I recommend posting an issue to their tracker and asking if this is a supported use case or not.
|
Also, this might seem a little hacky but in iOS 10+, you need to have "Privacy - Locations Usage Description" in your Info Plist or so added to be able to throw up System Dialogs. You could remove these keys for your test rig and see what the result is. |
https://github.com/wix/AppleSimulatorUtils looks interesting. |
Has anyone found a consistent solution for this? Requiring someone to click on the button every time the resources are reloaded to execute tests as well as modifying production code to do so do not sound as a very good solution for automated testing... I know those are workarounds but still... This just makes UI testing kind of impossible if you're trying to follow best practices and building a consistent app where testing should not influence the core architecture. I'll keep my research but isn't there any other known solution for this? |
I found a solution for automated UI testing using Appium: |
@vbutzke Happy that you found a solution. Sounds like what you're looking for is a pure black-box testing framework. A white-box framework like EarlGrey gives the test author more control over the AUT by running inside app under test so we usually advise using fakes (or mocks in certain cases) and encourage designing the app with testability in mind. Just as a quick heads up -- we've already added support for handling system dialogs in EarlGrey 2.0 (based off of XCUITest) which is being developed internally until we've alpha tested it next month. |
hi @khandpur is handling system dialogs supported on the master branch now? |
Not yet, will be in 2.0 (estimated for Q1 2018). |
@bootstraponline i see. Any work around for the moment? I see that there is a XCUITest's addUIInterruptionMonitor(withDescription:handler:) |
As @bootstraponline we're planning to open source EarlGrey 2.0 very soon. In the mean time you could work around the system dialog issue either through mocking or accepting it manually on the device which you should only need to do once. |
Any progress with this? Looking for a robust solution to dismissing UIAlerts for notification requests for all EarlGrey tests - any help is appreciated! |
I don't think there will be a great solution until EarlGrey 2 is released. |
EarlGrey 2 is released! |
If the app is installed at the first time, need to allow notification, how can I confirm it? Is someone encountered?
The text was updated successfully, but these errors were encountered: