Skip to content

Commit

Permalink
Fixed stuck CI env: Organization search results in endless loop while…
Browse files Browse the repository at this point in the history
… creating a user because ES is not ready yet.
  • Loading branch information
thorsteneckel committed Oct 8, 2018
1 parent 3a5cd0b commit 3d4d541
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/browser_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2899,17 +2899,24 @@ def user_create(params = {})
end

if data[:organization]
element = instance.find_elements(css: '.modal input.searchableSelect-main')[0]
element.clear
element.send_keys(data[:organization])

begin
target = nil
retries ||= 0
target = nil
until target
sleep 0.5
target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0]

5.times do
element = instance.find_elements(css: '.modal input.searchableSelect-main')[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
raise "Can't find organization #{data[:organization]}" if target.blank?
target.click()
rescue Selenium::WebDriver::Error::StaleElementReferenceError
sleep retries
Expand Down

0 comments on commit 3d4d541

Please sign in to comment.