summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 00:07:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 00:07:49 +0000
commit5d32a7a175fd1a7a6c97019a022c11434ea637dc (patch)
tree8741a075a83a139de103915278b87e66da6efb03 /qa
parentd74fcc9b69746c4d9582299c370a95aafe2ac3ac (diff)
downloadgitlab-ce-5d32a7a175fd1a7a6c97019a022c11434ea637dc.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/base.rb17
-rw-r--r--qa/qa/page/main/login.rb2
-rw-r--r--qa/qa/page/main/menu.rb2
-rw-r--r--qa/qa/page/validatable.rb2
-rw-r--r--qa/qa/runtime/env.rb4
-rw-r--r--qa/spec/spec_helper.rb3
6 files changed, 29 insertions, 1 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb
index 22b0021ea77..4ccf9e2f168 100644
--- a/qa/qa/page/base.rb
+++ b/qa/qa/page/base.rb
@@ -16,6 +16,10 @@ module QA
def_delegators :evaluator, :view, :views
+ def initialize
+ @retry_later_backoff = QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME
+ end
+
def assert_no_element(name)
assert_no_selector(element_selector_css(name))
end
@@ -259,6 +263,19 @@ module QA
visit find_element(name)['href']
end
+ def wait_if_retry_later
+ return if @retry_later_backoff > QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME * 5
+
+ if has_css?('body', text: 'Retry later', wait: 0)
+ QA::Runtime::Logger.warn("`Retry later` error occurred. Sleeping for #{@retry_later_backoff} seconds...")
+ sleep @retry_later_backoff
+ refresh
+ @retry_later_backoff += QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME
+
+ wait_if_retry_later
+ end
+ end
+
def self.path
raise NotImplementedError
end
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index 72884e97185..0638097a7b7 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -152,6 +152,8 @@ module QA
private
def sign_in_using_gitlab_credentials(user:, skip_page_validation: false)
+ wait_if_retry_later
+
switch_to_sign_in_tab if has_sign_in_tab?
switch_to_standard_tab if has_standard_tab?
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index 8ad30632fa1..6af18cb1d2b 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -77,6 +77,8 @@ module QA
def sign_out
retry_until do
+ wait_if_retry_later
+
break true unless signed_in?
within_user_menu do
diff --git a/qa/qa/page/validatable.rb b/qa/qa/page/validatable.rb
index 3c4d9ad68aa..f09a9aa9943 100644
--- a/qa/qa/page/validatable.rb
+++ b/qa/qa/page/validatable.rb
@@ -8,6 +8,8 @@ module QA
def validate_elements_present!
base_page = self.new
+ base_page.wait_if_retry_later
+
elements.each do |element|
next unless element.required?
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index 722648857ea..d8a3fe93bc0 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -43,6 +43,10 @@ module QA
ENV['GITLAB_QA_ADMIN_ACCESS_TOKEN']
end
+ def ci_project_name
+ ENV['CI_PROJECT_NAME']
+ end
+
def debug?
enabled?(ENV['QA_DEBUG'], default: false)
end
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index 1336bea16bc..0f818b9f89a 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -63,8 +63,9 @@ RSpec.configure do |config|
config.display_try_failure_messages = true
if ENV['CI'] && !QA::Runtime::Env.disable_rspec_retry?
+ non_quarantine_retries = QA::Runtime::Env.ci_project_name =~ /staging|canary|production/ ? 3 : 2
config.around do |example|
- retry_times = example.metadata.key?(:quarantine) ? 1 : 2
+ retry_times = example.metadata.key?(:quarantine) ? 1 : non_quarantine_retries
example.run_with_retry retry: retry_times
end
end