Commit 78dce56f authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'create-pipeline-flow-part2' into 'master'

Add new pipeline flow and refactor tests

See merge request gitlab-org/gitlab!49395
parents 538af119 7fe85afd
......@@ -8,7 +8,7 @@ module QA
module Index
extend QA::Page::PageConcern
def wait_for_latest_pipeline_replication
def wait_for_latest_pipeline_replicated
QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_latest_pipeline_replication])
wait_until(max_duration: Runtime::Geo.max_file_replication_time) do
within_element_by_index(:pipeline_commit_status, 0) { has_text?('passed') || has_text?('failed') }
......
......@@ -6,12 +6,17 @@ module QA
module_function
# In some cases we don't need to wait for anything, blocked, running or pending is acceptable
# Some cases only need pipeline to finish with different condition (completion, success or replication)
# Some cases only we do need pipeline to finish with expected condition (completed, succeeded or replicated)
def visit_latest_pipeline(pipeline_condition: nil)
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:"wait_for_latest_pipeline_#{pipeline_condition}") if pipeline_condition
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
end
def wait_for_latest_pipeline(pipeline_condition:)
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:"wait_for_latest_pipeline_#{pipeline_condition}")
end
end
end
end
......@@ -22,11 +22,11 @@ module QA
all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click
end
def wait_for_latest_pipeline_success
def wait_for_latest_pipeline_succeeded
wait_for_latest_pipeline_status { has_text?('passed') }
end
def wait_for_latest_pipeline_completion
def wait_for_latest_pipeline_completed
wait_for_latest_pipeline_status { has_text?('passed') || has_text?('failed') }
end
......
......@@ -34,7 +34,7 @@ module QA
add_included_files
add_main_ci_file
project.visit!
view_the_last_pipeline
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded')
end
after do
......@@ -78,12 +78,6 @@ module QA
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 main_ci_file
{
file_path: '.gitlab-ci.yml',
......
......@@ -41,7 +41,7 @@ module QA
add_ci_file(downstream_project, downstream_ci_file)
add_ci_file(upstream_project, upstream_ci_file)
upstream_project.visit!
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded')
end
after do
......
......@@ -25,7 +25,7 @@ module QA
Flow::Login.sign_in
add_ci_files
project.visit!
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded')
end
after do
......
......@@ -81,8 +81,7 @@ module QA
end
project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('publish')
......
......@@ -67,8 +67,7 @@ module QA
end
project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('upload')
......
......@@ -27,7 +27,7 @@ module QA
it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/751' do
add_ci_files(success_child_ci_file)
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed')
Page::Project::Pipeline::Show.perform do |parent_pipeline|
expect(parent_pipeline).to have_child_pipeline
......@@ -37,7 +37,7 @@ module QA
it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/752' do
add_ci_files(fail_child_ci_file)
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed')
Page::Project::Pipeline::Show.perform do |parent_pipeline|
expect(parent_pipeline).to have_child_pipeline
......
......@@ -27,7 +27,7 @@ module QA
it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/754' do
add_ci_files(success_child_ci_file)
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed')
Page::Project::Pipeline::Show.perform do |parent_pipeline|
expect(parent_pipeline).to have_child_pipeline
......@@ -37,7 +37,7 @@ module QA
it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/753' do
add_ci_files(fail_child_ci_file)
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed')
Page::Project::Pipeline::Show.perform do |parent_pipeline|
expect(parent_pipeline).to have_child_pipeline
......
......@@ -56,7 +56,7 @@ module QA
)
end.project.visit!
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed')
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('test-artifacts')
......
......@@ -65,7 +65,7 @@ module QA
dashboard.go_to_project(@project.name)
end
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'replication')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'replicated')
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.wait_for_pipeline_job_replication(@pipeline_job_name)
......@@ -94,7 +94,7 @@ module QA
dashboard.go_to_project(@project.name)
end
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'replication')
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'replicated')
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.wait_for_pipeline_job_replication(@pipeline_job_name)
......
......@@ -53,8 +53,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
merge_request.visit!
end
......
......@@ -37,8 +37,7 @@ module QA
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
before do
......@@ -103,8 +102,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
Page::Project::Menu.perform(&:click_on_license_compliance)
end
......@@ -116,8 +114,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_licenses
......
......@@ -36,8 +36,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
@merge_request = Resource::MergeRequest.fabricate_via_api! do |mr|
mr.project = @project
......@@ -95,8 +94,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
it 'manage licenses from the merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/575' do
......
......@@ -51,8 +51,7 @@ module QA
end
merge_request.merge!
end
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
after(:all) do
......
......@@ -41,8 +41,7 @@ module QA
push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
before do
......
......@@ -52,8 +52,7 @@ module QA
end
@project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
before do
......
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