summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 00:06:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 00:06:22 +0000
commit5a3f1ba53bf875a73f800909e8559d15dfab4339 (patch)
treed59abd1b468ae972040f3c0b667877ffc26a61b5 /qa
parent3d5ad15d2bf62ca70b1628afb64c5476e408781c (diff)
downloadgitlab-ce-5a3f1ba53bf875a73f800909e8559d15dfab4339.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/page/admin/new_session.rb22
-rw-r--r--qa/qa/page/base.rb16
-rw-r--r--qa/qa/page/main/menu.rb15
-rw-r--r--qa/qa/resource/settings/hashed_storage.rb2
-rw-r--r--qa/qa/runtime/api/client.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb2
-rw-r--r--qa/qa/support/page/logging.rb16
-rw-r--r--qa/spec/page/logging_spec.rb2
9 files changed, 66 insertions, 12 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 6397e4216d9..902963a6ed2 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -331,6 +331,7 @@ module QA
module Admin
autoload :Menu, 'qa/page/admin/menu'
+ autoload :NewSession, 'qa/page/admin/new_session'
module Settings
autoload :Repository, 'qa/page/admin/settings/repository'
diff --git a/qa/qa/page/admin/new_session.rb b/qa/qa/page/admin/new_session.rb
new file mode 100644
index 00000000000..3d46bb7f186
--- /dev/null
+++ b/qa/qa/page/admin/new_session.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Admin
+ class NewSession < Page::Base
+ view 'app/views/admin/sessions/_new_base.html.haml' do
+ element :enter_admin_mode_button
+ element :password_field
+ end
+
+ def set_password(password)
+ fill_element :password_field, password
+ end
+
+ def click_enter_admin_mode
+ click_element :enter_admin_mode_button
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb
index ed4d33dc7a3..a080c4071ed 100644
--- a/qa/qa/page/base.rb
+++ b/qa/qa/page/base.rb
@@ -86,11 +86,19 @@ module QA
end
def check_element(name)
- find_element(name).set(true)
+ retry_until(sleep_interval: 1) do
+ find_element(name).set(true)
+
+ find_element(name).checked?
+ end
end
def uncheck_element(name)
- find_element(name).set(false)
+ retry_until(sleep_interval: 1) do
+ find_element(name).set(false)
+
+ !find_element(name).checked?
+ end
end
# replace with (..., page = self.class)
@@ -125,8 +133,8 @@ module QA
has_no_css?(element_selector_css(name, kwargs), wait: wait, text: text)
end
- def has_text?(text)
- page.has_text? text
+ def has_text?(text, wait: Capybara.default_max_wait_time)
+ page.has_text?(text, wait: wait)
end
def has_no_text?(text)
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index 49c48568e68..5f4b3946e6a 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -60,8 +60,15 @@ module QA
end
end
- def click_admin_area
- within_top_menu { click_element :admin_area_link }
+ def go_to_admin_area
+ click_admin_area
+
+ if has_text?('Enter Admin Mode', wait: 1.0)
+ Admin::NewSession.perform do |new_session|
+ new_session.set_password(Runtime::User.admin_password)
+ new_session.click_enter_admin_mode
+ end
+ end
end
def signed_in?
@@ -125,6 +132,10 @@ module QA
end
end
end
+
+ def click_admin_area
+ within_top_menu { click_element :admin_area_link }
+ end
end
end
end
diff --git a/qa/qa/resource/settings/hashed_storage.rb b/qa/qa/resource/settings/hashed_storage.rb
index 08bb95cfd4b..40c06768ffe 100644
--- a/qa/qa/resource/settings/hashed_storage.rb
+++ b/qa/qa/resource/settings/hashed_storage.rb
@@ -8,7 +8,7 @@ module QA
raise ArgumentError unless traits.include?(:enabled)
Page::Main::Login.perform(&:sign_in_using_credentials)
- Page::Main::Menu.perform(&:click_admin_area)
+ Page::Main::Menu.perform(&:go_to_admin_area)
Page::Admin::Menu.perform(&:go_to_repository_settings)
Page::Admin::Settings::Repository.perform do |setting|
diff --git a/qa/qa/runtime/api/client.rb b/qa/qa/runtime/api/client.rb
index 83fbb8f15d2..4f9fb586ee3 100644
--- a/qa/qa/runtime/api/client.rb
+++ b/qa/qa/runtime/api/client.rb
@@ -32,7 +32,7 @@ module QA
Runtime::Browser.visit(@address, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_admin_credentials)
- Page::Main::Menu.perform(&:click_admin_area)
+ Page::Main::Menu.perform(&:go_to_admin_area)
Page::Admin::Menu.perform(&:go_to_network_settings)
Page::Admin::Settings::Network.perform do |setting|
diff --git a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
index 187c4a2a248..167a68dab00 100644
--- a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
+++ b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
@@ -6,7 +6,7 @@ module QA
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_admin_credentials)
- Page::Main::Menu.perform(&:click_admin_area)
+ Page::Main::Menu.perform(&:go_to_admin_area)
Page::Admin::Menu.perform(&:go_to_metrics_and_profiling_settings)
Page::Admin::Settings::MetricsAndProfiling.perform do |setting|
diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb
index 6b6e12f86de..f1cb876222e 100644
--- a/qa/qa/support/page/logging.rb
+++ b/qa/qa/support/page/logging.rb
@@ -59,6 +59,18 @@ module QA
elements
end
+ def check_element(name)
+ log("checking :#{name}")
+
+ super
+ end
+
+ def uncheck_element(name)
+ log("unchecking :#{name}")
+
+ super
+ end
+
def click_element(name, page = nil, **kwargs)
msg = ["clicking :#{name}"]
msg << ", expecting to be at #{page.class}" if page
@@ -99,10 +111,10 @@ module QA
found
end
- def has_text?(text)
+ def has_text?(text, **kwargs)
found = super
- log(%Q{has_text?('#{text}') returned #{found}})
+ log(%Q{has_text?('#{text}', wait: #{kwargs[:wait] || Capybara.default_max_wait_time}) returned #{found}})
found
end
diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb
index 92a4f7b40e6..fb89bcd3ab4 100644
--- a/qa/spec/page/logging_spec.rb
+++ b/qa/spec/page/logging_spec.rb
@@ -117,7 +117,7 @@ describe QA::Support::Page::Logging do
allow(page).to receive(:has_text?).and_return(true)
expect { subject.has_text? 'foo' }
- .to output(/has_text\?\('foo'\) returned true/).to_stdout_from_any_process
+ .to output(/has_text\?\('foo', wait: #{QA::Runtime::Browser::CAPYBARA_MAX_WAIT_TIME}\) returned true/).to_stdout_from_any_process
end
it 'logs has_no_text?' do