Commit a113ecef authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-shl-fix-jenkins-spec' into 'master'

Fix Jenkins spec by asserting on logs in .console-output element

Closes #213953

See merge request gitlab-org/gitlab!29918
parents 3ed77673 bbf3b0c8
......@@ -46,7 +46,7 @@ module QA
job_console.visit!
Support::Waiter.wait_until(sleep_interval: 1, reload_page: page) do
Support::Waiter.wait_until(sleep_interval: 2, reload_page: page) do
job_console.has_successful_build? && job_console.no_failed_status_update?
end
end
......@@ -91,6 +91,7 @@ module QA
end
Vendor::Jenkins::Page::ConfigureJob.perform do |configure_job|
configure_job.job_name = project_name
configure_job.configure(scm_url: patch_host_name(project.repository_http_location.git_uri, 'gitlab'))
end
end
......
......@@ -9,16 +9,19 @@ module QA
class ConfigureJob < Page::Base
attr_accessor :job_name
def initialize
@path = "/job/#{@job_name}/configure"
def path
"/job/#{@job_name}/configure"
end
def configure(scm_url:)
set_git_source_code_management_url(scm_url)
click_build_when_change_is_pushed_to_gitlab
set_publish_status_to_gitlab
click_save
wait_for_configuration_to_save
Support::Retrier.retry_until(sleep_interval: 0.5) do
click_save
wait_for_configuration_to_save
end
end
private
......@@ -58,8 +61,8 @@ module QA
end
def wait_for_configuration_to_save
QA::Support::Waiter.wait_until(sleep_interval: 1.0) do
!page.current_url.include?(@path)
QA::Support::Waiter.wait_until(max_duration: 10, raise_on_failure: false) do
!page.current_url.include?(path)
end
end
end
......
......@@ -9,6 +9,8 @@ module QA
class LastJobConsole < Page::Base
attr_accessor :job_name
CONSOLE_OUTPUT_SELECTOR = '.console-output'
def path
"/job/#{@job_name}/lastBuild/console"
end
......@@ -17,13 +19,23 @@ module QA
# Retry on errors such as:
# Selenium::WebDriver::Error::JavascriptError:
# javascript error: this.each is not a function
Support::Retrier.retry_on_exception(reload_page: page) do
page.has_text?('Finished: SUCCESS')
Support::Retrier.retry_on_exception(reload_page: page, sleep_interval: 1) do
has_console_output? && console_output.include?('Finished: SUCCESS')
end
end
def no_failed_status_update?
page.has_no_text?('Failed to update Gitlab commit status')
!console_output.include?('Failed to update Gitlab commit status')
end
private
def has_console_output?
page.has_selector?(CONSOLE_OUTPUT_SELECTOR, wait: 1)
end
def console_output
page.find(CONSOLE_OUTPUT_SELECTOR).text
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