Commit 0a9b6817 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'ni-fix-jenkins-spec' into 'master'

Jenkins spec: add check for the latest job build status in Jenkins logs

See merge request gitlab-org/gitlab!27681
parents ab9dbbb2 1338b3a3
...@@ -58,7 +58,11 @@ export default { ...@@ -58,7 +58,11 @@ export default {
</script> </script>
<template> <template>
<div class="table-section section-10 d-none d-sm-none d-md-block pipeline-tags"> <div class="table-section section-10 d-none d-sm-none d-md-block pipeline-tags">
<gl-link :href="pipeline.path" class="js-pipeline-url-link js-onboarding-pipeline-item"> <gl-link
:href="pipeline.path"
class="js-pipeline-url-link js-onboarding-pipeline-item"
data-qa-selector="pipeline_url_link"
>
<span class="pipeline-id">#{{ pipeline.id }}</span> <span class="pipeline-id">#{{ pipeline.id }}</span>
</gl-link> </gl-link>
<div class="label-container"> <div class="label-container">
......
...@@ -478,7 +478,7 @@ module QA ...@@ -478,7 +478,7 @@ module QA
autoload :Configure, 'qa/vendor/jenkins/page/configure' autoload :Configure, 'qa/vendor/jenkins/page/configure'
autoload :NewCredentials, 'qa/vendor/jenkins/page/new_credentials' autoload :NewCredentials, 'qa/vendor/jenkins/page/new_credentials'
autoload :NewJob, 'qa/vendor/jenkins/page/new_job' autoload :NewJob, 'qa/vendor/jenkins/page/new_job'
autoload :Job, 'qa/vendor/jenkins/page/job' autoload :LastJobConsole, 'qa/vendor/jenkins/page/last_job_console'
autoload :ConfigureJob, 'qa/vendor/jenkins/page/configure_job' autoload :ConfigureJob, 'qa/vendor/jenkins/page/configure_job'
end end
end end
......
...@@ -4,7 +4,7 @@ module QA::Page ...@@ -4,7 +4,7 @@ module QA::Page
module Project::Pipeline module Project::Pipeline
class Index < QA::Page::Base class Index < QA::Page::Base
view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do
element :pipeline_link, 'class="js-pipeline-url-link' # rubocop:disable QA/ElementWithPattern element :pipeline_url_link
end end
view 'app/assets/javascripts/pipelines/components/pipelines_table_row.vue' do view 'app/assets/javascripts/pipelines/components/pipelines_table_row.vue' do
...@@ -13,9 +13,7 @@ module QA::Page ...@@ -13,9 +13,7 @@ module QA::Page
end end
def click_on_latest_pipeline def click_on_latest_pipeline
css = '.js-pipeline-url-link' all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click
first(css, wait: 60).click
end end
def wait_for_latest_pipeline_success def wait_for_latest_pipeline_success
......
...@@ -41,13 +41,13 @@ module QA ...@@ -41,13 +41,13 @@ module QA
push.file_name = "file_#{SecureRandom.hex(4)}.txt" push.file_name = "file_#{SecureRandom.hex(4)}.txt"
end end
Vendor::Jenkins::Page::Job.perform do |job| Vendor::Jenkins::Page::LastJobConsole.perform do |job_console|
job.job_name = project_name job_console.job_name = project_name
job.visit! job_console.visit!
Support::Waiter.wait_until(sleep_interval: 1, reload_page: page) do Support::Waiter.wait_until(sleep_interval: 1, reload_page: page) do
job.has_successful_build? job_console.has_successful_build? && job_console.no_failed_status_update?
end end
end end
......
...@@ -18,6 +18,7 @@ module QA ...@@ -18,6 +18,7 @@ module QA
click_build_when_change_is_pushed_to_gitlab click_build_when_change_is_pushed_to_gitlab
set_publish_status_to_gitlab set_publish_status_to_gitlab
click_save click_save
wait_for_configuration_to_save
end end
private private
...@@ -55,6 +56,12 @@ module QA ...@@ -55,6 +56,12 @@ module QA
def select_publish_build_status_to_gitlab def select_publish_build_status_to_gitlab
click_link "Publish build status to GitLab" click_link "Publish build status to GitLab"
end end
def wait_for_configuration_to_save
QA::Support::Waiter.wait_until(sleep_interval: 1.0) do
!page.current_url.include?(@path)
end
end
end end
end end
end end
......
...@@ -6,15 +6,19 @@ module QA ...@@ -6,15 +6,19 @@ module QA
module Vendor module Vendor
module Jenkins module Jenkins
module Page module Page
class Job < Page::Base class LastJobConsole < Page::Base
attr_accessor :job_name attr_accessor :job_name
def path def path
"/job/#{@job_name}" "/job/#{@job_name}/lastBuild/console"
end end
def has_successful_build? def has_successful_build?
page.has_text?("Last successful build") page.has_text?('Finished: SUCCESS')
end
def no_failed_status_update?
page.has_no_text?('Failed to update Gitlab commit status')
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