calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Touch not working on _UIAlertControllerActionView #1288

Closed dasarijit95 closed 7 years ago

dasarijit95 commented 7 years ago

I can issue a touch from the calabash console, but this step always fails when used as a part of scenario, with the following "INFO: Embed is not available in this context. Will not embed."

Step definition:

Then(/^I wait for the alert to show up and tap Virtual Agent$/) do
  wait_for_elements_exist(["view:'_UIAlertControllerActionView' marked:'Virtual Agent'"], :timeout => Integer(5)) 
  touch("view:'_UIAlertControllerActionView' marked:'Virtual Agent'") 
end

My setup:

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.2.1
Build version 8C1002

$ calabash-ios version
0.20.4

$ curl http://10.88.32.254:37265/version
{  
   "device_family":"iPhone",
   "outcome":"SUCCESS",
   "server_port":37265,
   "simulator_device":"",
   "simulator":"",
   "app_name":"",
   "app_version":"9",
   "screen_dimensions":{  
      "native_scale":2,
      "sample":1,
      "height":1136,
      "width":640,
      "scale":2
   },
   "git":{  
      "revision":"dc15597",
      "remote_origin":"git@github.com:calabash\/calabash-ios-server.git",
      "branch":"master"
   },
   "device_name":"Rohini’s iPhone",
   "4inch":true,
   "app_id":"com.microsoft.mseg-tasks",
   "form_factor":"iphone 4in",
   "system":"iPhone8,4",
   "version":"0.20.4",
   "iOS_version":"10.1.1",
   "short_version_string":"1.0",
   "ios_version":"10.1.1",
   "iphone_app_emulated_on_ipad":false,
   "model_identifier":"iPhone8,4",
   "app_base_sdk":"iphoneos10.2"
}
jmoody commented 7 years ago

Try using wait_for_none_animating before the touch.

dasarijit95 commented 7 years ago

Thank you for your quick response. This works fine locally and on test cloud. I wonder why checking for existence is not enough in this case.

jmoody commented 7 years ago

Alerts are animated on. If a gesture happens during the animation, it is ignored.

It is common that elements are visible before animations are complete.