diff options
author | Sanad Liaquat <sliaquat@gitlab.com> | 2019-02-07 10:00:51 +0500 |
---|---|---|
committer | Sanad Liaquat <sliaquat@gitlab.com> | 2019-02-07 10:00:51 +0500 |
commit | 784eb9a4302ae78393efabcf8851fc991c93a7c0 (patch) | |
tree | 474f2633d555ff8973c82843ddf580946185aaa4 /qa/spec | |
parent | 2cea4fd067e2b78600b93202e0e71b58bccbe3d1 (diff) | |
download | gitlab-ce-784eb9a4302ae78393efabcf8851fc991c93a7c0.tar.gz |
Wait for login page to load at the beginning of QA suite
Diffstat (limited to 'qa/spec')
-rw-r--r-- | qa/spec/spec_helper.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 3537ba7c235..50e6168ec8c 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -3,6 +3,18 @@ require_relative '../qa' Dir[::File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f } 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 + 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 + config.before do |example| QA::Runtime::Logger.debug("Starting test: #{example.full_description}") if QA::Runtime::Env.debug? |