Merge branch 'sl-stablise-basic-login-spec' into 'master'
Fix basic login test stability Closes gitlab-org/quality/staging#57 See merge request gitlab-org/gitlab-ce!30446
This commit is contained in:
commit
2233e27b31
|
@ -24,4 +24,4 @@
|
|||
- if current_user_menu?(:sign_out)
|
||||
%li.divider
|
||||
%li
|
||||
= link_to _("Sign out"), destroy_user_session_path, class: "sign-out-link"
|
||||
= link_to _("Sign out"), destroy_user_session_path, class: "sign-out-link qa-sign-out-link"
|
||||
|
|
|
@ -25,19 +25,10 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
def retry_until(max_attempts: 3, reload: false)
|
||||
attempts = 0
|
||||
|
||||
while attempts < max_attempts
|
||||
result = yield
|
||||
return result if result
|
||||
|
||||
refresh if reload
|
||||
|
||||
attempts += 1
|
||||
def retry_until(max_attempts: 3, reload: false, sleep_interval: 0)
|
||||
QA::Support::Retrier.retry_until(max_attempts: max_attempts, reload: reload, sleep_interval: sleep_interval) do
|
||||
yield
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def retry_on_exception(max_attempts: 3, reload: false, sleep_interval: 0.5)
|
||||
|
|
|
@ -5,7 +5,7 @@ module QA
|
|||
module Main
|
||||
class Menu < Page::Base
|
||||
view 'app/views/layouts/header/_current_user_dropdown.html.haml' do
|
||||
element :user_sign_out_link, 'link_to _("Sign out")' # rubocop:disable QA/ElementWithPattern
|
||||
element :sign_out_link
|
||||
element :settings_link, 'link_to s_("CurrentUser|Settings")' # rubocop:disable QA/ElementWithPattern
|
||||
end
|
||||
|
||||
|
@ -53,7 +53,7 @@ module QA
|
|||
|
||||
def sign_out
|
||||
within_user_menu do
|
||||
click_link 'Sign out'
|
||||
click_element :sign_out_link
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'logger'
|
||||
require 'forwardable'
|
||||
|
||||
module QA
|
||||
module Runtime
|
||||
|
|
|
@ -11,8 +11,10 @@ module QA
|
|||
expect(menu).to have_personal_area
|
||||
end
|
||||
|
||||
Page::Main::Menu.perform do |menu|
|
||||
menu.sign_out
|
||||
Support::Retrier.retry_until(reload: false, sleep_interval: 0.5) do
|
||||
Page::Main::Menu.perform(&:sign_out)
|
||||
|
||||
Page::Main::Login.perform(&:has_sign_in_tab?)
|
||||
end
|
||||
|
||||
Page::Main::Login.perform do |form|
|
||||
|
|
|
@ -23,6 +23,25 @@ module QA
|
|||
raise
|
||||
end
|
||||
end
|
||||
|
||||
def retry_until(max_attempts: 3, reload: false, sleep_interval: 0)
|
||||
QA::Runtime::Logger.debug("with retry_until: max_attempts #{max_attempts}; sleep_interval #{sleep_interval}; reload:#{reload}")
|
||||
attempts = 0
|
||||
|
||||
while attempts < max_attempts
|
||||
QA::Runtime::Logger.debug("Attempt number #{attempts + 1}")
|
||||
result = yield
|
||||
return result if result
|
||||
|
||||
sleep sleep_interval
|
||||
|
||||
refresh if reload
|
||||
|
||||
attempts += 1
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue