From c0c021219dc44605dbb1a406ef4722f8cc80c13a Mon Sep 17 00:00:00 2001 From: Jeff Hall Date: Tue, 24 Dec 2013 16:12:13 -0800 Subject: [PATCH] [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 --- .../features/step_definitions/shared_steps.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/ve-mw/test/browser/features/step_definitions/shared_steps.rb b/modules/ve-mw/test/browser/features/step_definitions/shared_steps.rb index b75fcda09f..10ea30ae58 100644 --- a/modules/ve-mw/test/browser/features/step_definitions/shared_steps.rb +++ b/modules/ve-mw/test/browser/features/step_definitions/shared_steps.rb @@ -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} ")