Commit 1fa5a5a2 authored by Tomislav Nikic's avatar Tomislav Nikic

Adding a cherry pick test

Cherry picking a commit and creating a new merge request
based on the addition of that commit.
parent 13c671a0
......@@ -72,6 +72,7 @@ export default {
<gl-dropdown-item
v-if="canCherryPick"
data-testid="cherry-pick-link"
data-qa-selector="cherry_pick_button"
@click="showModal($options.openCherryPickModal)"
>
{{ s__('ChangeTypeAction|Cherry-pick') }}
......
......@@ -11,10 +11,17 @@ module QA
view 'app/assets/javascripts/projects/commit/components/commit_options_dropdown.vue' do
element :options_button
element :cherry_pick_button
element :email_patches
element :plain_diff
end
def cherry_pick_commit
click_element(:options_button)
click_element(:cherry_pick_button, Page::Component::CommitModal)
click_element(:submit_commit_button)
end
def select_email_patches
click_element :options_button
visit_link_in_element :email_patches
......
......@@ -22,7 +22,7 @@ module QA
Flow::Login.sign_in
end
it 'cherry picks a basic merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1616' do
it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1616' do
feature_mr.visit!
Page::MergeRequest::Show.perform do |merge_request|
......@@ -30,8 +30,11 @@ module QA
merge_request.cherry_pick!
end
Page::MergeRequest::New.perform do |merge_request|
expect(merge_request).to have_content('The merge request has been successfully cherry-picked')
Page::MergeRequest::New.perform(&:create_merge_request)
Page::MergeRequest::Show.perform do |merge_request|
merge_request.click_diffs_tab
expect(merge_request).to have_file(feature_mr.file_name)
end
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Cherry picking a commit' do
let(:file_name) { "secret_file.md" }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project'
project.initialize_with_readme = true
end
end
let(:commit) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.branch = "development"
commit.start_branch = project.default_branch
commit.commit_message = 'Add new file'
commit.add_files([
{ file_path: file_name, content: 'pssst!' }
])
end
end
before do
Flow::Login.sign_in
commit.visit!
end
it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1752' do
Page::Project::Commit::Show.perform(&:cherry_pick_commit)
Page::MergeRequest::New.perform(&:create_merge_request)
Page::MergeRequest::Show.perform do |merge_request|
merge_request.click_diffs_tab
expect(merge_request).to have_file(file_name)
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