Commit ededa488 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Assert on pipeline jobs statuses in CI/CD QA tests

parent 2fe5d932
...@@ -109,6 +109,11 @@ module QA ...@@ -109,6 +109,11 @@ module QA
autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' autoload :DeployKeys, 'qa/page/project/settings/deploy_keys'
autoload :Runners, 'qa/page/project/settings/runners' autoload :Runners, 'qa/page/project/settings/runners'
end end
module Pipeline
autoload :Index, 'qa/page/project/pipeline/index'
autoload :Show, 'qa/page/project/pipeline/show'
end
end end
module Admin module Admin
......
...@@ -5,7 +5,7 @@ module QA ...@@ -5,7 +5,7 @@ module QA
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item element :settings_item
element :repository_link, "title: 'Repository'" 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' element :top_level_items, '.sidebar-top-level-items'
end end
...@@ -25,6 +25,12 @@ module QA ...@@ -25,6 +25,12 @@ module QA
end end
end end
def click_ci_cd_pipelines
within_sidebar do
click_link('CI / CD')
end
end
private private
def hover_settings def hover_settings
......
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
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
...@@ -44,13 +44,13 @@ module QA ...@@ -44,13 +44,13 @@ module QA
push.file_name = '.gitlab-ci.yml' push.file_name = '.gitlab-ci.yml'
push.commit_message = 'Add .gitlab-ci.yml' push.commit_message = 'Add .gitlab-ci.yml'
push.file_content = <<~EOF push.file_content = <<~EOF
echo-success-test: test-success:
tags: tags:
- qa - qa
- test - test
script: echo 'OK' script: echo 'OK'
echo-failure-test: test-failure:
tags: tags:
- qa - qa
- test - test
...@@ -58,7 +58,13 @@ module QA ...@@ -58,7 +58,13 @@ module QA
- echo 'FAILURE' - echo 'FAILURE'
- exit 1 - exit 1
echo-artifacts-test: test-tags:
tags:
- qa
- docker
script: echo 'NOOP'
test-artifacts:
tags: tags:
- qa - qa
- test - test
...@@ -72,6 +78,24 @@ module QA ...@@ -72,6 +78,24 @@ module QA
Page::Project::Show.act { wait_for_push } Page::Project::Show.act { wait_for_push }
expect(page).to have_content('Add .gitlab-ci.yml') 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 end
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