Commit b146a7dd authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'e2e-update-ci-file-with-editor' into 'master'

E2E - Update CI file with pipeline editor

See merge request gitlab-org/gitlab!77147
parents 2dd33400 36ffd10c
...@@ -142,6 +142,7 @@ export default { ...@@ -142,6 +142,7 @@ export default {
class="js-no-auto-disable" class="js-no-auto-disable"
category="primary" category="primary"
variant="confirm" variant="confirm"
data-qa-selector="commit_changes_button"
:disabled="submitDisabled" :disabled="submitDisabled"
:loading="isSaving" :loading="isSaving"
> >
......
...@@ -153,7 +153,9 @@ export default { ...@@ -153,7 +153,9 @@ export default {
<span class="gl-font-weight-bold"> <span class="gl-font-weight-bold">
<gl-sprintf :message="$options.i18n.pipelineInfo"> <gl-sprintf :message="$options.i18n.pipelineInfo">
<template #id="{ content }"> <template #id="{ content }">
<span data-testid="pipeline-id"> {{ content }}{{ pipelineId }} </span> <span data-testid="pipeline-id" data-qa-selector="pipeline_id_content">
{{ content }}{{ pipelineId }}
</span>
</template> </template>
<template #status>{{ status.text }}</template> <template #status>{{ status.text }}</template>
<template #commit> <template #commit>
......
...@@ -24,6 +24,14 @@ module QA ...@@ -24,6 +24,14 @@ module QA
element :source_editor_container, require: true element :source_editor_container, require: true
end end
view 'app/assets/javascripts/pipeline_editor/components/header/pipeline_status.vue' do
element :pipeline_id_content
end
view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do
element :commit_changes_button
end
def initialize def initialize
super super
...@@ -50,6 +58,28 @@ module QA ...@@ -50,6 +58,28 @@ module QA
find_element(:source_editor_container).text find_element(:source_editor_container).text
end end
def write_to_editor(text)
find_element(:source_editor_container).fill_in(with: text)
end
def submit_changes
click_element(:commit_changes_button)
wait_for_requests
end
def set_target_branch(name)
find_element(:target_branch_field).fill_in(with: name)
end
def current_branch
find_element(:branch_selector_button).text
end
def pipeline_id
find_element(:pipeline_id_content).text.delete!('#').to_i
end
private private
# If the page thinks user has never opened pipeline editor before # If the page thinks user has never opened pipeline editor before
......
# frozen_string_literal: true
module QA
RSpec.describe 'Verify' do
describe 'Update CI file with pipeline editor' do
let(:random_test_string) { SecureRandom.hex(10) }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'pipeline-editor-project'
end
end
let!(:commit) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files(
[
{
file_path: '.gitlab-ci.yml',
content: <<~YAML
test_job:
script:
- echo "Simple test!"
YAML
}
]
)
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 'creates new pipeline and target branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349005' do
Page::Project::PipelineEditor::Show.perform do |show|
show.write_to_editor(random_test_string)
show.set_target_branch(random_test_string)
show.submit_changes
aggregate_failures do
expect(show.target_branch_name).to eq(random_test_string)
expect(show.current_branch).to eq(random_test_string)
expect(show.editing_content).to have_content(random_test_string)
expect(show.pipeline_id).to eq(project.pipelines.first[:id])
end
end
expect(project).to have_branch(random_test_string)
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