diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-01-29 12:54:57 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-01-29 12:54:57 +0000 |
commit | 2cd5b6111f9897e8dfefa9d98e0a2d1bdc44a55b (patch) | |
tree | db57c2ec4a0c8385c7209237a52603e4ecb3ff3a | |
parent | 9e408ae8cc72608524298743347a6f3ed6471020 (diff) | |
parent | 09a7a1f0767285d59855bc3722ed838672c78c7f (diff) | |
download | gitlab-ce-2cd5b6111f9897e8dfefa9d98e0a2d1bdc44a55b.tar.gz |
Merge branch 'qa/mk-fix-element-is-not-clickable-at-point' into 'master'
[CE backport] Fix intermittent QA error -- Expand button not bound to JS
See merge request gitlab-org/gitlab-ce!16737
-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 |