Commit 1dbc25e8 authored by Mark Lapierre's avatar Mark Lapierre

DRY exception handling

Use `retry_on_exception` instead of duplicating code
parent 20bb0d66
...@@ -10,18 +10,11 @@ module QA ...@@ -10,18 +10,11 @@ module QA
end end
def perform_before_hooks def perform_before_hooks
retries ||= 0
# The login page could take some time to load the first time it is visited. # 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. # 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::Support::Retrier.retry_on_exception do
rescue QA::Page::Validatable::PageValidationError QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login)
if (retries += 1) < 3
Runtime::Logger.warn("The login page did not appear as expected. Retrying... (attempt ##{retries})")
retry
end end
raise
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment