Open asengmany opened 6 years ago
You can manually handle this alert using something like this:
...
# Turn off automatic alert dismissal
device_agent.dismiss_springboard_alerts_manually!
# Do whatever triggers the alert, then wait for the alert
# which may or may not appear.
begin
device_agent.wait_for_springboard_alert(10) # timeout is optional
device_agent.dismiss_springboard_alert("Continue")
rescue RuntimeError
# Alert did not appear, so there is nothing to do
end
...
# Turn automatic dismiss back on
dismiss_springboard_alerts_automatically!
Is this work-around supported when testing locally using a physical device?
Absolutely.
How would i achieve this within the actual .cs test file? (within the test project in our solution)
@jmoody Where in my UI test code to I add the code above to manually handle the alert?
You will have to write some client code to connect to the DeviceAgent server.
The sources for the server are here:
https://github.com/calabash/DeviceAgent.iOS/blob/develop/Server/Routes
The port is 27753.
POST 1.0/set-dismiss-springboard-alerts-automatically # MetaRoute GET 1.0/spring-alert # QueryRoute POST 1.0/dismiss-springboard-alert # GestureRoute
Here is an example client in ruby:
https://github.com/calabash/run_loop/blob/develop/lib/run_loop/device_agent/client.rb#L611
Where in my UI test code to I add the code above to manually handle the alert?
You probably have some idea where, in your tests, you encounter this alert.
Before the gesture that triggers the alert, follow the pattern I showed above.
If you are encountering this problem on Test Cloud, this solution will not work because the DeviceAgent port number is not stable on Test Cloud (like it is locally).
If you are encountering this problem on Test Cloud, I will put you in touch with my manager.
If you made a pull request on DeviceAgent to automatically dismiss this alert, I would merge it.
https://github.com/calabash/DeviceAgent.iOS/blob/develop/Server/Utilities/SpringBoardAlerts.m
Hello,
Using SFAuthenticationSession show an alert that require your authorization but calabash raise en error:
How do we touch the Continue button without having this error?
Thanks :)