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 {
</script>
<template>
<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>
</gl-link>
<div class="label-container">
......
......@@ -478,7 +478,7 @@ module QA
autoload :Configure, 'qa/vendor/jenkins/page/configure'
autoload :NewCredentials, 'qa/vendor/jenkins/page/new_credentials'
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'
end
end
......
......@@ -4,7 +4,7 @@ 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' # rubocop:disable QA/ElementWithPattern
element :pipeline_url_link
end
view 'app/assets/javascripts/pipelines/components/pipelines_table_row.vue' do
......@@ -13,9 +13,7 @@ module QA::Page
end
def click_on_latest_pipeline
css = '.js-pipeline-url-link'
first(css, wait: 60).click
all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click
end
def wait_for_latest_pipeline_success
......
......@@ -41,13 +41,13 @@ module QA
push.file_name = "file_#{SecureRandom.hex(4)}.txt"
end
Vendor::Jenkins::Page::Job.perform do |job|
job.job_name = project_name
Vendor::Jenkins::Page::LastJobConsole.perform do |job_console|
job_console.job_name = project_name
job.visit!
job_console.visit!
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
......
......@@ -18,6 +18,7 @@ module QA
click_build_when_change_is_pushed_to_gitlab
set_publish_status_to_gitlab
click_save
wait_for_configuration_to_save
end
private
......@@ -55,6 +56,12 @@ module QA
def select_publish_build_status_to_gitlab
click_link "Publish build status to GitLab"
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
......
......@@ -6,15 +6,19 @@ module QA
module Vendor
module Jenkins
module Page
class Job < Page::Base
class LastJobConsole < Page::Base
attr_accessor :job_name
def path
"/job/#{@job_name}"
"/job/#{@job_name}/lastBuild/console"
end
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
......
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