[Browser test] Retry loop for beta warning dismissal.

Tests run via SauceLabs do not always dismss beta warning
pop-up on the first attempt, so try and try again!

Change-Id: I074824c5f1c99d8e5408dcb1ada7b97a6d20ebe8
This commit is contained in:
Jeff Hall 2013-12-24 16:12:13 -08:00
parent 2b9e0cb1ff
commit c0c021219d

View file

@ -38,11 +38,15 @@ end
When(/^I edit the page with (.+)$/) do |input_string|
on(VisualEditorPage) do |page|
page.edit_ve_element.when_present.click
#This begin/rescue clause dismisses the VE warning message when it exists, and does not fail when it does not exist
begin
sleep 1 #Chrome seems to not honor when_present correctly as of 5 Dec 2013
page.beta_warning_element.when_present.click
rescue
# Attempt to dismiss "beta warning" pop-up multiple times, since SauceLabs sometimes fails on the first attempt to dismiss.
try = 10
try.times do
#This begin/rescue clause dismisses the VE warning message when it exists, and does not fail when it does not exist
begin
sleep 1 #Chrome seems to not honor when_present correctly as of 5 Dec 2013
page.beta_warning_element.when_present.click
rescue
end
end
page.content_element.fire_event("onfocus")
page.content_element.when_present.send_keys(input_string + " #{@random_string} ")