From f1296f65004610dd4f3e2ed93259ce489eb26c22 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 27 Jun 2018 16:46:45 +0200 Subject: [PATCH] Stablized tests: Organization select in user create modal is stale. --- test/browser_test_helper.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index e34d43f31..2095ce1f5 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -2748,12 +2748,20 @@ wait untill text in selector disabppears element = instance.find_elements(css: '.modal input.searchableSelect-main')[0] element.clear element.send_keys(data[:organization]) - target = nil - until target - sleep 0.5 - target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0] + + begin + retries ||= 0 + target = nil + until target + sleep 0.5 + target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0] + end + target.click() + rescue Selenium::WebDriver::Error::StaleElementReferenceError + sleep retries + retries += 1 + retry if retries < 3 end - target.click() end check( browser: instance,