summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-07-04 15:52:08 +0200
committerRémy Coutable <remy@rymai.me>2018-07-05 08:15:15 +0200
commitc97d8b8e8d9e6a3d085e82cc4a06be07c0327ee4 (patch)
tree0b7fe302ae376c5951bf2aa9f085b62931e65ec8
parentbaab4cddb091c0aa9649fecc340b8b343747ba83 (diff)
downloadgitlab-ce-c97d8b8e8d9e6a3d085e82cc4a06be07c0327ee4.tar.gz
[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>
-rw-r--r--qa/qa/page/merge_request/show.rb44
-rw-r--r--qa/qa/specs/features/merge_request/squash_spec.rb2
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!