Skip to content

Commit

Permalink
issue #178 - retry on TimeoutException in AcceptanceHelpers.get_modal…
Browse files Browse the repository at this point in the history
…_parts
  • Loading branch information
jantman committed Mar 12, 2018
1 parent 96a279b commit 5c74ff1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions biweeklybudget/tests/acceptance_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,23 @@ def get_modal_parts(self, selenium, wait=True):
modalBody WebElement)
:rtype: tuple
"""
if wait:
self.wait_for_modal_shown(selenium)
modal = selenium.find_element_by_id('modalDiv')
title = selenium.find_element_by_id('modalLabel')
body = selenium.find_element_by_id('modalBody')
return modal, title, body
count = 0
while True:
count += 1
try:
if wait:
self.wait_for_modal_shown(selenium)
modal = selenium.find_element_by_id('modalDiv')
title = selenium.find_element_by_id('modalLabel')
body = selenium.find_element_by_id('modalBody')
return modal, title, body
except TimeoutException:
if count > 4:
raise
print('selenium.get(%s) timed out; trying again', url)
except Exception:
raise
return None, None, None

def assert_modal_displayed(self, modal, title, body):
"""
Expand Down

0 comments on commit 5c74ff1

Please sign in to comment.