Commit 43685720 authored by Tomislav Nikić's avatar Tomislav Nikić Committed by Dan Davison

Adding the page objects

Adding the page object to be able to interact
with the cherry pick button.
parent 6a96e3a5
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
{ variant: 'success' }, { variant: 'success' },
{ category: 'primary' }, { category: 'primary' },
{ 'data-testid': 'submit-commit' }, { 'data-testid': 'submit-commit' },
{ 'data-qa-selector': 'submit_commit_button' },
], ],
}, },
actionCancel: { actionCancel: {
......
...@@ -151,6 +151,7 @@ export default { ...@@ -151,6 +151,7 @@ export default {
v-gl-tooltip.hover v-gl-tooltip.hover
:title="cherryPickTitle" :title="cherryPickTitle"
size="small" size="small"
data-qa-selector="cherry_pick_button"
@click="openCherryPickModal" @click="openCherryPickModal"
> >
{{ cherryPickLabel }} {{ cherryPickLabel }}
......
...@@ -500,6 +500,7 @@ module QA ...@@ -500,6 +500,7 @@ module QA
autoload :Wiki, 'qa/page/component/wiki' autoload :Wiki, 'qa/page/component/wiki'
autoload :WikiSidebar, 'qa/page/component/wiki_sidebar' autoload :WikiSidebar, 'qa/page/component/wiki_sidebar'
autoload :WikiPageForm, 'qa/page/component/wiki_page_form' autoload :WikiPageForm, 'qa/page/component/wiki_page_form'
autoload :CommitModal, 'qa/page/component/commit_modal'
module Issuable module Issuable
autoload :Common, 'qa/page/component/issuable/common' autoload :Common, 'qa/page/component/issuable/common'
......
# frozen_string_literal: true
module QA
module Page
module Component
class CommitModal < Page::Base
view 'app/assets/javascripts/projects/commit/components/form_modal.vue' do
element :submit_commit_button, required: true
end
end
end
end
end
...@@ -107,6 +107,10 @@ module QA ...@@ -107,6 +107,10 @@ module QA
element :suggestion_button element :suggestion_button
end end
view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue' do
element :cherry_pick_button
end
def start_review def start_review
click_element(:start_review_button) click_element(:start_review_button)
...@@ -359,6 +363,11 @@ module QA ...@@ -359,6 +363,11 @@ module QA
def apply_suggestions_batch def apply_suggestions_batch
all_elements(:apply_suggestions_batch_button, minimum: 1).first.click all_elements(:apply_suggestions_batch_button, minimum: 1).first.click
end end
def cherry_pick!
click_element(:cherry_pick_button, Page::Component::CommitModal)
click_element(:submit_commit_button)
end
end end
end end
end end
......
...@@ -35,7 +35,7 @@ module QA ...@@ -35,7 +35,7 @@ module QA
attribute :target do attribute :target do
Repository::ProjectPush.fabricate! do |resource| Repository::ProjectPush.fabricate! do |resource|
resource.project = project resource.project = project
resource.branch_name = project.default_branch resource.branch_name = target_branch
resource.new_branch = @target_new_branch resource.new_branch = @target_new_branch
resource.remote_branch = target_branch resource.remote_branch = target_branch
end end
...@@ -62,6 +62,7 @@ module QA ...@@ -62,6 +62,7 @@ module QA
@labels = [] @labels = []
@file_name = "added_file-#{SecureRandom.hex(8)}.txt" @file_name = "added_file-#{SecureRandom.hex(8)}.txt"
@file_content = "File Added" @file_content = "File Added"
@target_branch = "master"
@target_new_branch = true @target_new_branch = true
@no_preparation = false @no_preparation = false
@wait_for_merge = true @wait_for_merge = true
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Cherry picking from a merge request' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project'
project.initialize_with_readme = true
end
end
let(:feature_mr) do
Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.project = project
merge_request.target_branch = 'development'
merge_request.target_new_branch = true
end
end
before do
Flow::Login.sign_in
end
it 'cherry picks a basic merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1616' do
feature_mr.visit!
Page::MergeRequest::Show.perform do |merge_request|
merge_request.merge!
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')
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