Commit 7fe85afd authored by treagitlab's avatar treagitlab

Add new pipeline flow and refactor tests

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