Created
September 19, 2016 14:51
-
-
Save jmoody/1b3cdd77774d7c412614baec6d7a8654 to your computer and use it in GitHub Desktop.
Wait for photo rollo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When(/^I touch the Photos row$/) do | |
expect_action_label_ready_for_next_alert | |
tap_row("photos") | |
end | |
Then(/^I see the Photos alert$/) do | |
if uia_available? | |
# Impossible to wait for the alert because it is automatically dismissed | |
else | |
# With DeviceAgent, we can wait for the alert. It is the next query or | |
# gesture that causes the alert to be automatically dismissed. | |
wait_for_springboard_alert | |
end | |
end | |
Then(/^I wait for the Photo Roll to finish animating on$/) do | |
# wait_for_animations will not work because the animation is outside the AUT | |
sleep(animation_sleep_for_env) | |
end | |
Then(/^the Photo Roll is visible behind the alert$/) do | |
# UIAutomation will dismiss the alert sometime between here and the last Step. | |
wait_for_view("* marked:'Cancel'") | |
end | |
And(/^for Calabash to dismiss the Photo Alert$/) do | |
# DeviceAgent will dismiss the alert by attempting to touch the Cancel button. | |
if !uia_available? | |
touch("* marked:'Cancel'") | |
end | |
end | |
And(/^I can dismiss the Photo Roll by touching Cancel$/) do | |
if uia_available? | |
# Waiting for no alert does not work. | |
sleep(timeout_for_env) | |
touch("* marked:'Cancel'") | |
sleep(timeout_for_env) | |
else | |
# DeviceAgent does not like interacting with the Photo Roll animations. | |
# Sleep for a long time to make sure the final touch actually happens. | |
sleep(timeout_for_env) | |
end | |
wait_for_alert_dismissed_text | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment