Commit 19af8158 authored by Mark Lapierre's avatar Mark Lapierre

Retry visiting URL if not successful

A test failed because it tried to perform an action before the page
had loaded. This shouldn't happen - the test shouldn't proceed until
navigation is complete.

This change adds logging to confirm that it attempted to visit the
given page, and it retries if navigation isn't successful.
parent b633727c
...@@ -64,7 +64,13 @@ module QA ...@@ -64,7 +64,13 @@ module QA
end end
def visit! def visit!
Runtime::Logger.debug("Visiting #{web_url}")
Support::Retrier.retry_until do
visit(web_url) visit(web_url)
wait { current_url == web_url }
end
end end
def populate(*attributes) def populate(*attributes)
...@@ -72,7 +78,9 @@ module QA ...@@ -72,7 +78,9 @@ module QA
end end
def wait(max: 60, interval: 0.1) def wait(max: 60, interval: 0.1)
QA::Support::Waiter.wait(max: max, interval: interval) QA::Support::Waiter.wait(max: max, interval: interval) do
yield
end
end end
private private
......
...@@ -269,6 +269,8 @@ describe QA::Resource::Base do ...@@ -269,6 +269,8 @@ describe QA::Resource::Base do
end end
it 'calls #visit with the underlying #web_url' do it 'calls #visit with the underlying #web_url' do
allow(resource).to receive(:current_url).and_return(subject.current_url)
resource.web_url = subject.current_url resource.web_url = subject.current_url
resource.visit! resource.visit!
......
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