Skip to content
代码片段 群组 项目
未验证 提交 ebe1c50a 编辑于 作者: Sanad Liaquat's avatar Sanad Liaquat 提交者: GitLab
浏览文件

Merge branch '440833-e2e-run-component-in-pipeline' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -32,6 +32,7 @@ class Show < QA::Page::Base ...@@ -32,6 +32,7 @@ class Show < QA::Page::Base
view 'app/assets/javascripts/ci/pipeline_details/graph/components/stage_column_component.vue' do view 'app/assets/javascripts/ci/pipeline_details/graph/components/stage_column_component.vue' do
element 'job-item-container', required: true element 'job-item-container', required: true
element 'stage-column-title'
end end
def running?(wait: 0) def running?(wait: 0)
...@@ -134,6 +135,10 @@ def has_no_skipped_job_in_group? ...@@ -134,6 +135,10 @@ def has_no_skipped_job_in_group?
end end
end end
end end
def has_stage?(name)
has_element?('stage-column-title', text: name)
end
end end
end end
end end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner, :skip_live_env, product_group: :pipeline_authoring do
describe 'CI component' do
let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" }
let(:tag) { '1.0.0' }
let(:domain_name) { Runtime::Scenario.gitlab_address.split("/").last }
let(:test_stage) { 'test' }
let(:test_phrase) { 'this is NOT secret!!!!!!!' }
let(:component_project) do
create(:project, :with_readme, name: 'component-project', description: 'This is a project with CI component.')
end
let(:test_project) do
create(:project, :with_readme, name: 'project-to-test-component')
end
let!(:runner) do
Resource::ProjectRunner.fabricate! do |runner|
runner.project = test_project
runner.name = executor
runner.tags = [executor]
end
end
let(:component_content) do
<<~YAML
spec:
inputs:
secret-phrase:
default: 'this is secret'
stage:
default: "#{test_stage}"
---
my-component:
script: echo $[[ inputs.secret-phrase ]]
YAML
end
let(:ci_yml_content) do
<<~YAML
default:
tags: ["#{executor}"]
include:
- component: "#{domain_name}/#{component_project.full_path}/new-component@#{tag}"
inputs:
secret-phrase: #{test_phrase}
cat:
stage: deploy
script: echo 'Meow'
YAML
end
let(:pipeline) do
create(:pipeline, project: test_project, id: test_project.latest_pipeline[:id])
end
before do
Flow::Login.sign_in
enable_catalog_resource_feature
add_ci_file(component_project, 'templates/new-component.yml', component_content)
component_project.create_release(tag)
test_project.visit!
add_ci_file(test_project, '.gitlab-ci.yml', ci_yml_content)
end
after do
runner.remove_via_api!
end
it 'runs in project pipeline with correct inputs', :aggregate_failures,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/451582' do
Flow::Pipeline.visit_latest_pipeline(status: 'Passed')
Page::Project::Pipeline::Show.perform do |show|
expect(show).to have_stage(test_stage), "Expected pipeline to have stage #{test_stage} but not found."
end
Flow::Pipeline.visit_pipeline_job_page(job_name: 'my-component', pipeline: pipeline)
Page::Project::Job::Show.perform do |show|
expect(show.output).to have_content(test_phrase),
"Component job failed to use custom phrase #{test_phrase}."
end
end
private
def enable_catalog_resource_feature
component_project.visit!
Page::Project::Menu.perform(&:go_to_general_settings)
Page::Project::Settings::Main.perform do |settings|
settings.expand_visibility_project_features_permissions(&:enable_ci_cd_catalog_resource)
end
end
def add_ci_file(project, file_path, content)
create(:commit, project: project, commit_message: 'Add CI yml file', actions: [
{
action: 'create',
file_path: file_path,
content: content
}
])
end
end
end
end
...@@ -30,6 +30,7 @@ module HaveMatcher ...@@ -30,6 +30,7 @@ module HaveMatcher
security_configuration_history_link security_configuration_history_link
skipped_job_in_group skipped_job_in_group
snippet_description snippet_description
stage
system_note system_note
tag tag
variable variable
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册