summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-02-07 19:44:16 +0000
committerMark Lapierre <mlapierre@gitlab.com>2019-02-07 19:44:16 +0000
commit439bde0052a3e3f36e420a83d80345f911ac955c (patch)
tree26cc007aec137429b53d123bf5d8a0b0ecfc00fd
parent82423ac34ac90e3ff3443495a14af0105feff67d (diff)
parent621b92120e133e1fa8e29a51ece8b850302a6a63 (diff)
downloadgitlab-ce-439bde0052a3e3f36e420a83d80345f911ac955c.tar.gz
Merge branch 'qa-check-server-responding-before-suit' into 'master'
Wait for login page to load at the beginning of QA suite See merge request gitlab-org/gitlab-ce!24991
-rw-r--r--qa/qa/page/main/login.rb14
-rw-r--r--qa/spec/spec_helper.rb14
2 files changed, 17 insertions, 11 deletions
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index d5377f1d1c1..e476cbe29a2 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -40,17 +40,9 @@ module QA
element :login_page
end
- def initialize
- # The login page is usually the entry point for all the scenarios so
- # we need to wait for the instance to start. That said, in some cases
- # we are already logged-in so we check both cases here.
- # Check if we're already logged in first. If we don't then we have to
- # wait 10 seconds for the check for the login page to fail every time
- # we use this class when we're already logged in (E.g., whenever we
- # create a personal access token to use for API access).
- wait(max: 500) do
- Page::Main::Menu.act { has_personal_area?(wait: 0) } ||
- has_element?(:login_page)
+ def page_loaded?
+ wait(max: 60) do
+ has_element?(:login_page)
end
end
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index 3537ba7c235..0f3cf5f4408 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -3,6 +3,20 @@ 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
+ 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 do |example|
QA::Runtime::Logger.debug("Starting test: #{example.full_description}") if QA::Runtime::Env.debug?