Commit bcd22a6e authored by Tomislav Nikic's avatar Tomislav Nikic Committed by Sanad Liaquat

Adding a test that reverts a commit

This test reverts an existing commit on master
and creates a merge request based on the reverted
changes.
parent c6c3708a
......@@ -65,6 +65,7 @@ export default {
<gl-dropdown-item
v-if="canRevert"
data-testid="revert-link"
data-qa-selector="revert_button"
@click="showModal($options.openRevertModal)"
>
{{ s__('ChangeTypeAction|Revert') }}
......
......@@ -11,11 +11,18 @@ module QA
view 'app/assets/javascripts/projects/commit/components/commit_options_dropdown.vue' do
element :options_button
element :revert_button
element :cherry_pick_button
element :email_patches
element :plain_diff
end
def revert_commit
click_element(:options_button)
click_element(:revert_button, Page::Component::CommitModal)
click_element(:submit_commit_button)
end
def cherry_pick_commit
click_element(:options_button)
click_element(:cherry_pick_button, Page::Component::CommitModal)
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Reverting 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.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/1784' do
Page::Project::Commit::Show.perform(&:revert_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
after do
project.remove_via_api!
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