Commit c97d8b8e authored by Rémy Coutable's avatar Rémy Coutable

[QA] Ensure we wait for the squash checbox to be clickable before clicking it...

[QA] Ensure we wait for the squash checbox to be clickable before clicking it in the squash scenario
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent baab4cdd
...@@ -20,7 +20,27 @@ module QA ...@@ -20,7 +20,27 @@ module QA
element :squash_checkbox element :squash_checkbox
end end
def fast_forward_possible?
!has_text?('Fast-forward merge is not possible')
end
def has_merge_button?
refresh
has_selector?('.accept-merge-request')
end
def rebase! 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 click_element :mr_rebase_button
wait(reload: false) do wait(reload: false) do
...@@ -28,17 +48,17 @@ module QA ...@@ -28,17 +48,17 @@ module QA
end end
end end
def fast_forward_possible? def merge!
!has_text?('Fast-forward merge is not possible') # The merge button is disabled on load
wait do
has_css?(element_selector_css(:merge_button))
end end
def has_merge_button? # The merge button is enabled via JS
refresh wait(reload: false) do
!first(element_selector_css(:merge_button)).disabled?
has_selector?('.accept-merge-request')
end end
def merge!
click_element :merge_button click_element :merge_button
wait(reload: false) do wait(reload: false) do
...@@ -47,10 +67,16 @@ module QA ...@@ -47,10 +67,16 @@ module QA
end end
def mark_to_squash def mark_to_squash
wait(reload: true) do # The squash checkbox is disabled on load
wait do
has_css?(element_selector_css(:squash_checkbox)) has_css?(element_selector_css(:squash_checkbox))
end end
# The squash checkbox is enabled via JS
wait(reload: false) do
!first(element_selector_css(:squash_checkbox)).disabled?
end
click_element :squash_checkbox click_element :squash_checkbox
end end
end end
......
...@@ -24,6 +24,8 @@ module QA ...@@ -24,6 +24,8 @@ module QA
merge_request.visit! merge_request.visit!
expect(page).to have_text('to be squashed')
Page::MergeRequest::Show.perform do |merge_request_page| Page::MergeRequest::Show.perform do |merge_request_page|
merge_request_page.mark_to_squash merge_request_page.mark_to_squash
merge_request_page.merge! merge_request_page.merge!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment