Commit 72eb3e5e authored by Tiffany Rea's avatar Tiffany Rea Committed by Anastasia McDonald

New E2E test pipeline editor commit can create merge request

Add new page element in commit_form.vue
Add new page element in pipeline_editor_empty_state.vue
Add new page object pipeline_editor/new.rb
Add new page action in pipeline_editor/show.rb
Add new E2E test pipeline editor can create MR
parent 6f86346d
......@@ -136,6 +136,7 @@ export default {
v-if="!isCurrentBranchTarget"
v-model="openMergeRequest"
data-testid="new-mr-checkbox"
data-qa-selector="new_mr_checkbox"
class="gl-mt-3"
>
<gl-sprintf :message="$options.i18n.startMergeRequest">
......
......@@ -41,7 +41,12 @@ export default {
</template>
</gl-sprintf>
</p>
<gl-button variant="confirm" class="gl-mt-3" @click="createEmptyConfigFile">
<gl-button
variant="confirm"
class="gl-mt-3"
data-qa-selector="create_new_ci_button"
@click="createEmptyConfigFile"
>
{{ $options.i18n.btnText }}
</gl-button>
</div>
......
......@@ -116,7 +116,7 @@ module QA
end
view 'app/views/projects/merge_requests/_mr_box.html.haml' do
element :title_content
element :title_content, required: true
end
view 'app/views/projects/merge_requests/_mr_title.html.haml' do
......@@ -124,9 +124,9 @@ module QA
end
view 'app/views/projects/merge_requests/show.html.haml' do
element :notes_tab
element :commits_tab
element :diffs_tab
element :notes_tab, required: true
element :commits_tab, required: true
element :diffs_tab, required: true
end
view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue' do
......
# frozen_string_literal: true
module QA
module Page
module Project
module PipelineEditor
class New < QA::Page::Base
view 'app/assets/javascripts/pipeline_editor/components/ui/pipeline_editor_empty_state.vue' do
element :create_new_ci_button, required: true
end
def create_new_ci
click_element(:create_new_ci_button, Page::Project::PipelineEditor::Show)
end
end
end
end
end
end
......@@ -6,13 +6,13 @@ module QA
module PipelineEditor
class Show < QA::Page::Base
view 'app/assets/javascripts/pipeline_editor/components/file_nav/branch_switcher.vue' do
element :branch_selector_button, require: true
element :branch_selector_button, required: true
element :branch_menu_item_button
element :branch_menu_container
end
view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do
element :target_branch_field, require: true
element :target_branch_field, required: true
end
view 'app/assets/javascripts/pipeline_editor/components/drawer/pipeline_editor_drawer.vue' do
......@@ -21,7 +21,7 @@ module QA
end
view 'app/assets/javascripts/vue_shared/components/source_editor.vue' do
element :source_editor_container, require: true
element :source_editor_container, required: true
end
view 'app/assets/javascripts/pipeline_editor/components/header/pipeline_status.vue' do
......@@ -30,6 +30,7 @@ module QA
view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do
element :commit_changes_button
element :new_mr_checkbox
end
view 'app/assets/javascripts/pipeline_editor/components/header/validation_segment.vue' do
......@@ -127,6 +128,18 @@ module QA
end
end
def has_new_mr_checkbox?
has_element?(:new_mr_checkbox, visible: true)
end
def has_no_new_mr_checkbox?
has_no_element?(:new_mr_checkbox, visible: true)
end
def select_new_mr_checkbox
check_element(:new_mr_checkbox, true)
end
private
def go_to_tab(name)
......
# frozen_string_literal: true
module QA
RSpec.describe 'Verify' do
describe 'Pipeline editor' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'pipeline-editor-project'
project.initialize_with_readme = true
end
end
before do
Flow::Login.sign_in
project.visit!
Page::Project::Menu.perform(&:go_to_pipeline_editor)
end
after do
project&.remove_via_api!
end
it(
'can create merge request',
test_case: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349130'
) do
Page::Project::PipelineEditor::New.perform(&:create_new_ci)
Page::Project::PipelineEditor::Show.perform do |show|
# Editor should display default content when project does not have CI file yet
# New MR checkbox should not be rendered when a new target branch is yet to be provided
aggregate_failures 'check editor default conditions' do
expect(show.editing_content).not_to be_empty
expect(show).to have_no_new_mr_checkbox
end
# The new MR checkbox is visible after a new target branch name is set
show.set_target_branch(SecureRandom.hex(10))
expect(show).to have_new_mr_checkbox
show.select_new_mr_checkbox
show.submit_changes
end
Page::MergeRequest::New.perform(&:create_merge_request)
Page::MergeRequest::Show.perform do |show|
expect(show).to have_title('Update .gitlab-ci.yml file')
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