Merge branch '48779-qa-merge-request-squash-sometimes-fail' into 'master'

Resolve "QA: Merge request squash sometimes fail"

Closes #48779

See merge request gitlab-org/gitlab-ce!20375
This commit is contained in:
Sean McGivern 2018-07-05 09:04:57 +00:00
commit 3bdaeb94c0
2 changed files with 37 additions and 9 deletions

View file

@ -20,14 +20,6 @@ module QA
element :squash_checkbox element :squash_checkbox
end 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? def fast_forward_possible?
!has_text?('Fast-forward merge is not possible') !has_text?('Fast-forward merge is not possible')
end end
@ -38,7 +30,35 @@ module QA
has_selector?('.accept-merge-request') has_selector?('.accept-merge-request')
end 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! 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 click_element :merge_button
wait(reload: false) do wait(reload: false) do
@ -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

View file

@ -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!