Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-02-14 20:06:39 +0300
committerMark Lapierre <mlapierre@gitlab.com>2019-02-14 20:06:39 +0300
commite5e57df61ccda241e23bd4f67fe9022cec6c8c57 (patch)
tree60303e00c0b23d66c6582525fb520dba15ca409e /qa
parentbbd0a2ce91f2d43350382c7ce83729f33c39c125 (diff)
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.
Diffstat (limited to 'qa')
-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)