summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-02-14 21:23:55 +0000
committerMark Lapierre <mlapierre@gitlab.com>2019-02-14 21:23:55 +0000
commite2a56bd1ae6af4166db108eca4455530d98f6aa8 (patch)
tree19f43dc2a2cc3dba7dbdf8e91f24dc69233ee824
parent701303a5dba78a217d8050316b0c6ea2f2c4c519 (diff)
parente5e57df61ccda241e23bd4f67fe9022cec6c8c57 (diff)
downloadgitlab-ce-e2a56bd1ae6af4166db108eca4455530d98f6aa8.tar.gz
Merge branch 'qa-ml-check-server-in-before-hook' into 'master'
[QA-CE] Move server responding check to scenario before hook See merge request gitlab-org/gitlab-ce!25257
-rw-r--r--qa/qa/ce/strategy.rb5
-rw-r--r--qa/qa/page/main/login.rb6
-rw-r--r--qa/qa/runtime/browser.rb2
-rw-r--r--qa/spec/spec_helper.rb14
4 files changed, 12 insertions, 15 deletions
diff --git a/qa/qa/ce/strategy.rb b/qa/qa/ce/strategy.rb
index 6d1601dfa48..e0fbbed2567 100644
--- a/qa/qa/ce/strategy.rb
+++ b/qa/qa/ce/strategy.rb
@@ -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
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index e476cbe29a2..e03fe9ab83a 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -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)
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index 0bcf5e693f0..0b805b855ac 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -8,6 +8,8 @@ module QA
class Browser
include QA::Scenario::Actable
+ NotRespondingError = Class.new(RuntimeError)
+
def initialize
self.class.configure!
end
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index f1b4203d422..20a153f3f63 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -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)