calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Provide a notification that loading is complete. #1418

Open SittenSpynne opened 4 years ago

SittenSpynne commented 4 years ago

My Xamarin Forms application interacts with some hardware and needs permission to use Bluetooth and/or USB to function at all, so we end up triggering a permissions dialog at startup. It caused me to bump into this issue, but I think this is an inelegant solution.

If there are things that can go wrong if the application does them before Calabash finishes loading, I feel like loading Calabash should either block until it finishes or provide some mechanism to notify me it is finished. For example, I wouldn't mind inserting a loading page to my application and have "Calabash is complete" part of the criteria for that page's dismissal. That would allow me to notify the things that communicate with hardware it's OK for them to progress.

A delay works, but is inelegant. I have to guess how long, and environmental changes could make this problem rear its head again.

SittenSpynne commented 4 years ago

Whoops, upon further investigation I decided to post this to Xamarin Forms since I need it surfaced there, but I had this window open and got confused when I picked a tab.

jmoody commented 4 years ago

so we end up triggering a permissions dialog at startup. It caused me to bump into this issue, but I think this is an inelegant solution.

Permissions dialogs no longer block automation. That document describes the behavior under UIAutomation which has not been used since Xcode 7.

I have updated the wiki page.

jmoody commented 4 years ago

To help you understand what was happening under UIAutomation, here is some more context.

Calabash (the ruby client), asked UIAutomation (Apple tool) to launch your application for automation (testing). If your application generated a SpringBoard alert too soon, UIAutomation could not take control of your application. The same thing would happen if you used UIAutomation directly (not through Calabash). That is just how UIAutomation worked.

Now we use DeviceAgent (based on XCUITest) + xcodebuild to launch your application for automation. We have not observed that SpringBoard alerts can block DeviceAgent + xcodebuild automation.