summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-13 09:08:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-13 09:08:27 +0000
commit15ae4a8da83661f2b714d804721001a53b354d28 (patch)
tree91080b2b969a66857d78fb9008c1d0c367132a8d /qa
parent8f71e69fdbb65d2cf95cf16ef5a0add0919edb45 (diff)
downloadgitlab-ce-15ae4a8da83661f2b714d804721001a53b354d28.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/project/pipeline/show.rb15
-rw-r--r--qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb109
2 files changed, 121 insertions, 3 deletions
diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb
index 57ab7fb4480..95759d3b603 100644
--- a/qa/qa/page/project/pipeline/show.rb
+++ b/qa/qa/page/project/pipeline/show.rb
@@ -16,8 +16,9 @@ module QA
end
view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do
- element :job_component, /class.*ci-job-component.*/ # rubocop:disable QA/ElementWithPattern
+ element :job_item_container
element :job_link
+ element :action_button
end
view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do
@@ -40,10 +41,12 @@ module QA
end
def has_build?(name, status: :success, wait: nil)
- within('.pipeline-graph') do
- within('.ci-job-component', text: name) do
+ if status
+ within_element(:job_item_container, text: name) do
has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact)
end
+ else
+ has_element?(:job_item_container, text: name)
end
end
@@ -78,6 +81,12 @@ module QA
def click_on_first_job
first('.js-pipeline-graph-job-link', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).click
end
+
+ def click_job_action(job_name)
+ within_element(:job_item_container, text: job_name) do
+ click_element(:action_button)
+ end
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb
new file mode 100644
index 00000000000..39d5fbaba6b
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb
@@ -0,0 +1,109 @@
+# frozen_string_literal: true
+
+require 'faker'
+
+module QA
+ RSpec.describe 'Verify', :runner, :requires_admin do
+ # [TODO]: Developer to remove :requires_admin once FF is removed in follow up issue
+
+ describe "Trigger child pipeline with 'when:manual'" do
+ let(:feature_flag) { :ci_manual_bridges } # [TODO]: Developer to remove when feature flag is removed
+ let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" }
+
+ let(:project) do
+ Resource::Project.fabricate_via_api! do |project|
+ project.name = 'project-with-pipeline'
+ end
+ end
+
+ let!(:runner) do
+ Resource::Runner.fabricate! do |runner|
+ runner.project = project
+ runner.name = executor
+ runner.tags = [executor]
+ end
+ end
+
+ before do
+ Runtime::Feature.enable(feature_flag) # [TODO]: Developer to remove when feature flag is removed
+ Flow::Login.sign_in
+ add_ci_files
+ project.visit!
+ view_the_last_pipeline
+ end
+
+ after do
+ Runtime::Feature.disable(feature_flag) # [TODO]: Developer to remove when feature flag is removed
+ runner.remove_via_api!
+ end
+
+ it 'can trigger bridge job', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1049' do
+ Page::Project::Pipeline::Show.perform do |parent_pipeline|
+ expect(parent_pipeline).not_to have_child_pipeline
+
+ parent_pipeline.click_job_action('trigger')
+ Support::Waiter.wait_until { parent_pipeline.has_child_pipeline? }
+ parent_pipeline.expand_child_pipeline
+
+ expect(parent_pipeline).to have_build('child_build', status: nil)
+ end
+ end
+
+ private
+
+ def add_ci_files
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.commit_message = 'Add parent and child pipelines CI files.'
+ commit.add_files(
+ [
+ child_ci_file,
+ parent_ci_file
+ ]
+ )
+ end
+ end
+
+ def view_the_last_pipeline
+ Page::Project::Menu.perform(&:click_ci_cd_pipelines)
+ Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
+ Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
+ end
+
+ def parent_ci_file
+ {
+ file_path: '.gitlab-ci.yml',
+ content: <<~YAML
+ build:
+ stage: build
+ tags: ["#{executor}"]
+ script: echo build
+
+ trigger:
+ stage: test
+ when: manual
+ trigger:
+ include: '.child-pipeline.yml'
+
+ deploy:
+ stage: deploy
+ tags: ["#{executor}"]
+ script: echo deploy
+ YAML
+ }
+ end
+
+ def child_ci_file
+ {
+ file_path: '.child-pipeline.yml',
+ content: <<~YAML
+ child_build:
+ stage: build
+ tags: ["#{executor}"]
+ script: echo build
+ YAML
+ }
+ end
+ end
+ end
+end