Commit 405fe733 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-add-custom-mr-template-e2e-spec' into 'master'

Add e2e test for custom merge request template

See merge request gitlab-org/gitlab!52827
parents 94741be5 2f6106eb
......@@ -19,7 +19,8 @@ module QA
:file_name,
:file_content
attr_writer :no_preparation,
:wait_for_merge
:wait_for_merge,
:template
attribute :merge_when_pipeline_succeeds
attribute :merge_status
......@@ -73,7 +74,8 @@ module QA
Page::Project::Show.perform(&:new_merge_request)
Page::MergeRequest::New.perform do |new_page|
new_page.fill_title(@title)
new_page.fill_description(@description)
new_page.choose_template(@template) if @template
new_page.fill_description(@description) unless @template
new_page.choose_milestone(@milestone) if @milestone
new_page.assign_to_me if @assignee == 'me'
labels.each do |label|
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Merge request custom templates' do
let(:template_name) { 'custom_merge_request_template'}
let(:template_content) { 'This is a custom merge request template test' }
let(:template_project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'custom-mr-template-project'
project.initialize_with_readme = true
end
end
let(:merge_request_title) { 'One merge request to rule them all' }
before do
Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = template_project
commit.commit_message = 'Add custom merge request template'
commit.add_files([
{
file_path: ".gitlab/merge_request_templates/#{template_name}.md",
content: template_content
}
])
end
end
it 'creates a merge request via custom template', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1230' do
Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.project = template_project
merge_request.title = merge_request_title
merge_request.template = template_name
merge_request.target_new_branch = false
end
Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_title(merge_request_title)
expect(merge_request).to have_description(template_content)
end
end
end
end
end
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