Fixed stuck CI env: Organization search results in endless loop while creating a user because ES is not ready yet.

This commit is contained in:
Thorsten Eckel 2018-10-08 15:51:58 +02:00
parent 3a5cd0bce5
commit 3d4d5414f1

View file

@ -2899,17 +2899,24 @@ wait untill text in selector disabppears
end end
if data[:organization] if data[:organization]
element = instance.find_elements(css: '.modal input.searchableSelect-main')[0]
element.clear
element.send_keys(data[:organization])
begin begin
target = nil
retries ||= 0 retries ||= 0
target = nil
until target 5.times do
sleep 0.5 element = instance.find_elements(css: '.modal input.searchableSelect-main')[0]
target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0] element.clear
element.send_keys(data[:organization])
10.times do
sleep 0.5
target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0]
break if target
end
break if target
end end
raise "Can't find organization #{data[:organization]}" if target.blank?
target.click() target.click()
rescue Selenium::WebDriver::Error::StaleElementReferenceError rescue Selenium::WebDriver::Error::StaleElementReferenceError
sleep retries sleep retries