Instruments 4.6: Automation script fails to start when alert obscures app

Originator:lingyi.kung
Number:rdar://14625824 Date Originated:08/01/2013
Status:Open Resolved:
Product:Developer Tools Product Version:4.6
Classification:Serious Bug Reproducible:Always
 
Summary:
UI testing using Automation is not possible for apps that show an alert immediately upon launch (e.g. an app that has a location services popup after fresh install). The Automation script never starts, since the "target application is not frontmost."

Steps to Reproduce:
1. Build an app that has a location services popup immediately when the app is launched.
2. Launch the app using Automation (e.g. Profile using Xcode).
3. Create a new script (the default, "var target = UIATarget.localTarget();" is fine).
4. Run the script.

Expected Results:
The script runs (i.e. the script is able to start and the alert is able to be clicked on).

Actual Results:
The script fails to start.
Log Type: Fail
Log Message: Could not start script, target application is not frontmost.

Workaround:
1. Build the app.
2. Launch in the Simulator.
3. Wait.
4. osascript -e "tell application \"System Events\" to tell process \"iOS Simulator\" to click button \"OK\" of window 1"
5. Close the app.
6. Run the Automation script.

Regression:
No regression testing was performed, but this seems to be a problem that other people have faced in the past. This is the root cause of a bug in Appium (see https://github.com/appium/appium/issues/955).

Notes:
Thanks!

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!