Commit 446756b7 authored by Mark Lapierre's avatar Mark Lapierre

Update merge results/trains pipelines QA test

Handles the new popup that appears when merging immediately.

Uses a unique branch name so that retries don't try to reuse the same
branch. Reusing the same branch causes git errors like "Updates were
rejected because the tip of your current branch is behind its remote
counterpart."

Unquarantines the test.
parent 40d7fc1c
...@@ -62,9 +62,12 @@ export default { ...@@ -62,9 +62,12 @@ export default {
<p>{{ __('Are you sure you want to merge immediately?') }}</p> <p>{{ __('Are you sure you want to merge immediately?') }}</p>
<template v-slot:modal-footer> <template v-slot:modal-footer>
<gl-button ref="cancelButton" @click="cancel">{{ __('Cancel') }}</gl-button> <gl-button ref="cancelButton" @click="cancel">{{ __('Cancel') }}</gl-button>
<gl-button variant="danger" @click="mergeImmediately">{{ <gl-button
__('Merge immediately') variant="danger"
}}</gl-button> data-qa-selector="merge_immediately_button"
@click="mergeImmediately"
>{{ __('Merge immediately') }}</gl-button
>
</template> </template>
</gl-modal> </gl-modal>
</template> </template>
...@@ -59,6 +59,10 @@ module QA ...@@ -59,6 +59,10 @@ module QA
element :approvals_summary_content element :approvals_summary_content
end end
view 'ee/app/assets/javascripts/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue' do
element :merge_immediately_button
end
view 'ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue' do view 'ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue' do
element :vulnerability_modal_content element :vulnerability_modal_content
end end
...@@ -252,6 +256,16 @@ module QA ...@@ -252,6 +256,16 @@ module QA
approvals_content.match(/Requires (\d+) more approvals/)[1].to_i approvals_content.match(/Requires (\d+) more approvals/)[1].to_i
end end
def merge_merge_train_immediately
click_element :merge_moment_dropdown
click_element :merge_immediately_option
# Wait for the warning modal dialog to appear
wait_for_animated_element :merge_immediately_button
click_element :merge_immediately_button
end
def merge_via_merge_train def merge_via_merge_train
raise ElementNotFound, "Not ready to merge" unless ready_to_merge? raise ElementNotFound, "Not ready to merge" unless ready_to_merge?
......
# frozen_string_literal: true # frozen_string_literal: true
require 'securerandom'
module QA module QA
# Failure issue: https://gitlab.com/gitlab-org/gitlab/issues/36824 context 'Release', :docker do
context 'Release', :docker, :quarantine do
describe 'Pipelines for merged results and merge trains' do describe 'Pipelines for merged results and merge trains' do
before(:context) do before(:context) do
@project = Resource::Project.fabricate_via_api! do |project| @project = Resource::Project.fabricate_via_api! do |project|
...@@ -49,17 +50,19 @@ module QA ...@@ -49,17 +50,19 @@ module QA
end end
it 'creates a pipeline with merged results' do it 'creates a pipeline with merged results' do
branch_name = "merged-results-#{SecureRandom.hex(8)}"
# Create a branch that will be merged into master # Create a branch that will be merged into master
Resource::Repository::ProjectPush.fabricate! do |project_push| Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project project_push.project = @project
project_push.new_branch = true project_push.new_branch = true
project_push.branch_name = 'merged-results' project_push.branch_name = branch_name
end end
# Create a merge request to merge the branch we just created # Create a merge request to merge the branch we just created
Resource::MergeRequest.fabricate_via_api! do |merge_request| Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.project = @project merge_request.project = @project
merge_request.source_branch = 'merged-results' merge_request.source_branch = branch_name
merge_request.no_preparation = true merge_request.no_preparation = true
end.visit! end.visit!
...@@ -72,7 +75,7 @@ module QA ...@@ -72,7 +75,7 @@ module QA
# The default option is to merge via merge train, # The default option is to merge via merge train,
# but that will be covered by another test # but that will be covered by another test
show.merge_immediately show.merge_merge_train_immediately
end end
merged = Page::MergeRequest::Show.perform(&:merged?) merged = Page::MergeRequest::Show.perform(&:merged?)
...@@ -81,11 +84,13 @@ module QA ...@@ -81,11 +84,13 @@ module QA
end end
it 'merges via a merge train' do it 'merges via a merge train' do
branch_name = "merge-train-#{SecureRandom.hex(8)}"
# Create a branch that will be merged into master # Create a branch that will be merged into master
Resource::Repository::ProjectPush.fabricate! do |project_push| Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project project_push.project = @project
project_push.new_branch = true project_push.new_branch = true
project_push.branch_name = 'merge-train' project_push.branch_name = branch_name
project_push.file_name = "another_file.txt" project_push.file_name = "another_file.txt"
project_push.file_content = "merge me" project_push.file_content = "merge me"
end end
...@@ -93,7 +98,7 @@ module QA ...@@ -93,7 +98,7 @@ module QA
# Create a merge request to merge the branch we just created # Create a merge request to merge the branch we just created
Resource::MergeRequest.fabricate_via_api! do |merge_request| Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.project = @project merge_request.project = @project
merge_request.source_branch = 'merge-train' merge_request.source_branch = branch_name
merge_request.no_preparation = true merge_request.no_preparation = true
end.visit! end.visit!
......
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