diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-01-25 23:03:14 -0800 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-01-26 09:30:32 -0800 |
commit | 09a7a1f0767285d59855bc3722ed838672c78c7f (patch) | |
tree | 0e42f8106cece0a4c7a5e2ef34265e79c53ed2e6 /qa | |
parent | 6c978c8f287d2fc61c58ab59973e0015bfc2ac58 (diff) | |
download | gitlab-ce-09a7a1f0767285d59855bc3722ed838672c78c7f.tar.gz |
Fix intermittent click errorqa/mk-fix-element-is-not-clickable-at-point
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 6 | ||||
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 7 |
3 files changed, 19 insertions, 10 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 81ba80cdbaf..fa7a3760057 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -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) diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 9cff2c5c317..95880475ffa 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -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 diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index c7955124ef3..319cb1045b6 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -17,7 +17,12 @@ module QA def expand_section(name) page.within('#content-body') do page.within('section', text: name) do - click_button 'Expand' unless first('button', text: 'Collapse') + # 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 |