summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2018-12-26 09:43:27 +0000
committerRamya Authappan <rauthappan@gitlab.com>2018-12-26 09:43:27 +0000
commit8bee93b0e206fba89468419c52ad4162684cc49b (patch)
treea733e75d926939250b83dc9ee410c1008da02ca6
parentfddb47469e6d711a92bd513f4a60c615b38b2d94 (diff)
downloadgitlab-ce-8bee93b0e206fba89468419c52ad4162684cc49b.tar.gz
[CE] Speed up login page usage
-rw-r--r--app/views/layouts/devise.html.haml2
-rw-r--r--qa/qa/page/base.rb4
-rw-r--r--qa/qa/page/main/login.rb12
-rw-r--r--qa/qa/page/main/menu.rb8
-rw-r--r--qa/qa/support/page/logging.rb2
5 files changed, 16 insertions, 12 deletions
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 4f8db74382f..6003d973c88 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html.devise-layout-html{ class: system_message_class }
= render "layouts/head"
- %body.ui-indigo.login-page.application.navless{ data: { page: body_data_page } }
+ %body.ui-indigo.login-page.application.navless.qa-login-page{ data: { page: body_data_page } }
.page-wrap
= render "layouts/header/empty"
.login-page-broadcast
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb
index d6b763ed5fc..615d17bbcfe 100644
--- a/qa/qa/page/base.rb
+++ b/qa/qa/page/base.rb
@@ -108,8 +108,8 @@ module QA
element.select value.to_s.capitalize
end
- def has_element?(name)
- has_css?(element_selector_css(name))
+ def has_element?(name, wait: Capybara.default_max_wait_time)
+ has_css?(element_selector_css(name), wait: wait)
end
def has_no_text?(text)
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index 97ffe0e5716..cb83ace20b6 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -35,13 +35,21 @@ module QA
element :saml_login_button
end
+ view 'app/views/layouts/devise.html.haml' do
+ 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
- has_css?('.login-page') ||
- Page::Main::Menu.act { has_personal_area?(wait: 0) }
+ Page::Main::Menu.act { has_personal_area?(wait: 0) } ||
+ has_element?(:login_page)
end
end
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index cc2724618e9..6804cc8fb20 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -63,15 +63,11 @@ module QA
end
def has_personal_area?(wait: Capybara.default_max_wait_time)
- using_wait_time(wait) do
- page.has_selector?(element_selector_css(:user_avatar))
- end
+ has_element?(:user_avatar, wait: wait)
end
def has_admin_area_link?(wait: Capybara.default_max_wait_time)
- using_wait_time(wait) do
- page.has_selector?(element_selector_css(:admin_area_link))
- end
+ has_element?(:admin_area_link, wait: wait)
end
private
diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb
index 5765a8041cc..df3b794b14b 100644
--- a/qa/qa/support/page/logging.rb
+++ b/qa/qa/support/page/logging.rb
@@ -77,7 +77,7 @@ module QA
super
end
- def has_element?(name)
+ def has_element?(name, wait: Capybara.default_max_wait_time)
found = super
log("has_element? :#{name} returned #{found}")