diff options
author | Rémy Coutable <remy@rymai.me> | 2018-07-04 16:52:08 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-07-05 09:15:15 +0300 |
commit | c97d8b8e8d9e6a3d085e82cc4a06be07c0327ee4 (patch) | |
tree | 0b7fe302ae376c5951bf2aa9f085b62931e65ec8 /qa | |
parent | baab4cddb091c0aa9649fecc340b8b343747ba83 (diff) |
[QA] Ensure we wait for the squash checbox to be clickable before clicking it in the squash scenario
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 44 | ||||
-rw-r--r-- | qa/qa/specs/features/merge_request/squash_spec.rb | 2 |
2 files changed, 37 insertions, 9 deletions
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 9507f92f4b2..c200f14f4fb 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -20,14 +20,6 @@ module QA element :squash_checkbox end - def rebase! - click_element :mr_rebase_button - - wait(reload: false) do - has_text?('Fast-forward merge without a merge commit') - end - end - def fast_forward_possible? !has_text?('Fast-forward merge is not possible') end @@ -38,7 +30,35 @@ module QA has_selector?('.accept-merge-request') end + def rebase! + # The rebase button is disabled on load + wait do + has_css?(element_selector_css(:mr_rebase_button)) + end + + # The rebase button is enabled via JS + wait(reload: false) do + !first(element_selector_css(:mr_rebase_button)).disabled? + end + + click_element :mr_rebase_button + + wait(reload: false) do + has_text?('Fast-forward merge without a merge commit') + end + end + def merge! + # The merge button is disabled on load + wait do + has_css?(element_selector_css(:merge_button)) + end + + # The merge button is enabled via JS + wait(reload: false) do + !first(element_selector_css(:merge_button)).disabled? + end + click_element :merge_button wait(reload: false) do @@ -47,10 +67,16 @@ module QA end def mark_to_squash - wait(reload: true) do + # The squash checkbox is disabled on load + wait do has_css?(element_selector_css(:squash_checkbox)) end + # The squash checkbox is enabled via JS + wait(reload: false) do + !first(element_selector_css(:squash_checkbox)).disabled? + end + click_element :squash_checkbox end end diff --git a/qa/qa/specs/features/merge_request/squash_spec.rb b/qa/qa/specs/features/merge_request/squash_spec.rb index b68704154cf..5402a6fcda0 100644 --- a/qa/qa/specs/features/merge_request/squash_spec.rb +++ b/qa/qa/specs/features/merge_request/squash_spec.rb @@ -24,6 +24,8 @@ module QA merge_request.visit! + expect(page).to have_text('to be squashed') + Page::MergeRequest::Show.perform do |merge_request_page| merge_request_page.mark_to_squash merge_request_page.merge! |