Move server responding check to scenario before hook
This checks that the server is responding before any other actions, including before trying to add a license.
This commit is contained in:
parent
bbd0a2ce91
commit
e5e57df61c
|
@ -8,7 +8,10 @@ module QA
|
|||
end
|
||||
|
||||
def perform_before_hooks
|
||||
# noop
|
||||
# The login page could take some time to load the first time it is visited.
|
||||
# We visit the login page and wait for it to properly load only once before the tests.
|
||||
QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login)
|
||||
QA::Page::Main::Login.perform(&:assert_page_loaded)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,6 +40,12 @@ module QA
|
|||
element :login_page
|
||||
end
|
||||
|
||||
def assert_page_loaded
|
||||
unless page_loaded?
|
||||
raise QA::Runtime::Browser::NotRespondingError, "Login page did not load at #{QA::Page::Main::Login.perform(&:current_url)}"
|
||||
end
|
||||
end
|
||||
|
||||
def page_loaded?
|
||||
wait(max: 60) do
|
||||
has_element?(:login_page)
|
||||
|
|
|
@ -8,6 +8,8 @@ module QA
|
|||
class Browser
|
||||
include QA::Scenario::Actable
|
||||
|
||||
NotRespondingError = Class.new(RuntimeError)
|
||||
|
||||
def initialize
|
||||
self.class.configure!
|
||||
end
|
||||
|
|
|
@ -5,20 +5,6 @@ require_relative '../qa'
|
|||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
ServerNotRespondingError = Class.new(RuntimeError)
|
||||
|
||||
# The login page could take some time to load the first time it is visited.
|
||||
# We visit the login page and wait for it to properly load only once at the beginning of the suite.
|
||||
config.before(:suite) do
|
||||
if QA::Runtime::Scenario.respond_to?(:gitlab_address)
|
||||
QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login)
|
||||
|
||||
unless QA::Page::Main::Login.perform(&:page_loaded?)
|
||||
raise ServerNotRespondingError, "Login page did not load at #{QA::Page::Main::Login.perform(&:current_url)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
config.before(:context) do
|
||||
if self.class.metadata.keys.include?(:quarantine)
|
||||
skip_or_run_quarantined_tests(self.class.metadata.keys, config.inclusion_filter.rules.keys)
|
||||
|
|
Loading…
Reference in New Issue