From c97d8b8e8d9e6a3d085e82cc4a06be07c0327ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 4 Jul 2018 15:52:08 +0200 Subject: [QA] Ensure we wait for the squash checbox to be clickable before clicking it in the squash scenario MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- qa/qa/page/merge_request/show.rb | 44 ++++++++++++++++++----- qa/qa/specs/features/merge_request/squash_spec.rb | 2 ++ 2 files changed, 37 insertions(+), 9 deletions(-) (limited to 'qa') 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! -- cgit v1.2.1