diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-23 12:55:44 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-23 12:56:06 +0100 |
commit | ededa488f2c94d1d132d974476f38e668c44e4ee (patch) | |
tree | 1062ec0a3332ce845a7b8b93d5222fdbf9654374 | |
parent | 2fe5d9327965cb18fe800a0c7bd3f83c44a70efb (diff) | |
download | gitlab-ce-ededa488f2c94d1d132d974476f38e668c44e4ee.tar.gz |
Assert on pipeline jobs statuses in CI/CD QA tests
-rw-r--r-- | qa/qa.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/menu/side.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/index.rb | 13 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/show.rb | 23 | ||||
-rw-r--r-- | qa/qa/specs/features/project/pipelines_spec.rb | 30 |
5 files changed, 75 insertions, 4 deletions
@@ -109,6 +109,11 @@ module QA autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' autoload :Runners, 'qa/page/project/settings/runners' end + + module Pipeline + autoload :Index, 'qa/page/project/pipeline/index' + autoload :Show, 'qa/page/project/pipeline/show' + end end module Admin diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index e666d570172..7f0f924c5e8 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -5,7 +5,7 @@ module QA view 'app/views/layouts/nav/sidebar/_project.html.haml' do element :settings_item element :repository_link, "title: 'Repository'" - element :repository_link, "title: 'CI / CD'" + element :pipelines_settings_link, "title: 'CI / CD'" element :top_level_items, '.sidebar-top-level-items' end @@ -25,6 +25,12 @@ module QA end end + def click_ci_cd_pipelines + within_sidebar do + click_link('CI / CD') + end + end + private def hover_settings diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb new file mode 100644 index 00000000000..32c108393b9 --- /dev/null +++ b/qa/qa/page/project/pipeline/index.rb @@ -0,0 +1,13 @@ +module QA::Page + module Project::Pipeline + class Index < QA::Page::Base + view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do + element :pipeline_link, 'class="js-pipeline-url-link"' + end + + def go_to_latest_pipeline + first('.js-pipeline-url-link').click + end + end + end +end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb new file mode 100644 index 00000000000..309d9e75ea2 --- /dev/null +++ b/qa/qa/page/project/pipeline/show.rb @@ -0,0 +1,23 @@ +module QA::Page + module Project::Pipeline + class Show < QA::Page::Base + view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do + element :pipeline_header, /header class.*ci-header-container.*/ + end + + def running? + within('.ci-header-container') do + return page.has_content?('running') + end + end + + def has_build?(name, status: :success) + within('.pipeline-graph') do + within('.ci-job-component', text: name) do + return has_selector?(".ci-status-icon-#{status}") + end + end + end + end + end +end diff --git a/qa/qa/specs/features/project/pipelines_spec.rb b/qa/qa/specs/features/project/pipelines_spec.rb index 3a6c93cd903..6760605df72 100644 --- a/qa/qa/specs/features/project/pipelines_spec.rb +++ b/qa/qa/specs/features/project/pipelines_spec.rb @@ -44,13 +44,13 @@ module QA push.file_name = '.gitlab-ci.yml' push.commit_message = 'Add .gitlab-ci.yml' push.file_content = <<~EOF - echo-success-test: + test-success: tags: - qa - test script: echo 'OK' - echo-failure-test: + test-failure: tags: - qa - test @@ -58,7 +58,13 @@ module QA - echo 'FAILURE' - exit 1 - echo-artifacts-test: + test-tags: + tags: + - qa + - docker + script: echo 'NOOP' + + test-artifacts: tags: - qa - test @@ -72,6 +78,24 @@ module QA Page::Project::Show.act { wait_for_push } expect(page).to have_content('Add .gitlab-ci.yml') + + Page::Menu::Side.act { click_ci_cd_pipelines } + + expect(page).to have_content('All 1') + expect(page).to have_content('Add .gitlab-ci.yml') + + puts 'Waiting for the runner to process the pipeline' + sleep 15 # Runner should process all jobs within 15 seconds. + + Page::Project::Pipeline::Index.act { go_to_latest_pipeline } + + Page::Project::Pipeline::Show.perform do |pipeline| + expect(pipeline).to be_running + expect(pipeline).to have_build('test-success', status: :success) + expect(pipeline).to have_build('test-failure', status: :failed) + expect(pipeline).to have_build('test-tags', status: :pending) + expect(pipeline).to have_build('test-artifacts', status: :failed) + end end end end |