Commit 31805a5a authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'check_pipeline_status_via_api' into 'master'

Check for pipeline status via API

See merge request gitlab-org/gitlab!39540
parents 584f531d 25cc2aeb
# frozen_string_literal: true
module QA
context 'Verify', :docker do
RSpec.describe 'Verify', :docker do
describe 'Operations Dashboard' do
let(:group) { Resource::Group.fabricate_via_api! }
let!(:runner) do
......@@ -63,46 +63,46 @@ module QA
'project-with-pending-run' => 'pending',
'project-without-ci' => nil
}.each do |project_name, status|
pipeline_status = nil
Support::Waiter.wait_until(sleep_interval: 3, reload_page: operation) do
project = operation.find_project_card_by_name(project_name)
if project_name == 'project-without-ci'
expect(project).to have_content('The branch for this project has no active pipeline configuration.')
break
else
expect(operation.pipeline_status(project)).to eq(status)
end
pipeline_status = operation.pipeline_status(project)
pipeline_status != 'running'
end
expect(pipeline_status).to eq(status)
end
end
end
private
def commit_ci_file(project, file)
def commit_ci_file(project, file, status)
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([file])
end
wait_for_pipeline(project, status)
end
def setup_projects
commit_ci_file(project_with_success_run, ci_file_with_tag)
commit_ci_file(project_with_pending_run, ci_file_without_existing_tag)
commit_ci_file(project_with_failed_run, ci_file_failed_run)
commit_ci_file(project_with_success_run, ci_file_with_tag, 'success')
commit_ci_file(project_with_pending_run, ci_file_without_existing_tag, 'pending')
commit_ci_file(project_with_failed_run, ci_file_failed_run, 'failed')
end
def wait_for_pipeline(project, status)
Support::Waiter.wait_until do
pipelines = project.pipelines
!pipelines.empty? && pipelines.last[:status] == status
end
end
def add_projects_to_board
[project_with_success_run, project_with_pending_run, project_without_ci, project_with_failed_run].each do |project|
EE::Page::OperationsDashboard.perform do |operation|
operation.add_project(project.name)
expect(operation).to have_project_card
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