Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Sep 20, 2023
1 parent 6086dce commit 3989dac
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions projectroles/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,22 +1705,19 @@ def test_submit_button(self):
By.CLASS_NAME, 'sodar-pr-btn-submit-once'
)
self.assertEqual(element.text, 'Create')

self.assertTrue(element.is_enabled())

# Define timeout and retry interval
timeout = 10 # Maximum time to wait in seconds
retry_interval = 0.5 # Time between retries in seconds

start_time = time.time()
# Define maximum number of retries and retry interval
max_retries = 50
retry_interval = 0.2
element.click()
while True:
for i in range(max_retries):
try:
if element.is_enabled() and time.time() - start_time >= timeout:
if element.is_enabled() and i < max_retries - 1:
time.sleep(retry_interval)
else:
self.fail(
"Element did not become enabled within the timeout"
)
time.sleep(retry_interval)
except StaleElementReferenceException:
break

Expand Down

0 comments on commit 3989dac

Please sign in to comment.