BigW Consortium Gitlab

Commit 09a7a1f0 by Michael Kozono

Fix intermittent click error

parent 6c978c8f
......@@ -13,16 +13,18 @@ module QA
visit current_url
end
def wait(css = '.application', time: 60)
Time.now.tap do |start|
while Time.now - start < time
break if page.has_css?(css, wait: 5)
def wait(max: 60, time: 1, reload: true)
start = Time.now
refresh
end
while Time.now - start < max
return true if yield
sleep(time)
refresh if reload
end
yield if block_given?
false
end
def scroll_to(selector, text: nil)
......
......@@ -10,12 +10,14 @@ module QA
view 'app/views/devise/sessions/_new_base.html.haml' do
element :login_field, 'text_field :login'
element :passowrd_field, 'password_field :password'
element :password_field, 'password_field :password'
element :sign_in_button, 'submit "Sign in"'
end
def initialize
wait('.application', time: 500)
wait(max: 500) do
page.has_css?('.application')
end
end
def sign_in_using_credentials
......
......@@ -17,8 +17,13 @@ module QA
def expand_section(name)
page.within('#content-body') do
page.within('section', text: name) do
# Because it is possible to click the button before the JS toggle code is bound
wait(reload: false) do
click_button 'Expand' unless first('button', text: 'Collapse')
page.has_content?('Collapse')
end
yield if block_given?
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment