mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-22 10:01:45 +00:00
tor: tests: functional: Fix to wait properly on progress page
- Fix the condition for checking if we are on progress page by ensuring that the page is loaded fully before checking if it is that progress loader. Avoid a race condition writing a single atomic JS script to check both conditions. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
ae73b296de
commit
399a132bac
@ -184,7 +184,16 @@ def change_checkbox_status(browser, app_name, checkbox_id,
|
||||
|
||||
|
||||
def wait_for_config_update(browser, app_name):
|
||||
while browser.is_element_present_by_css('.running-status.loading'):
|
||||
"""Wait until the configuration update progress goes away.
|
||||
|
||||
Perform an atomic check that page is fully loaded and that progress icon is
|
||||
not present at the same time to avoid race conditions due to automatic page
|
||||
reloads.
|
||||
|
||||
"""
|
||||
script = 'return (document.readyState == "complete") && ' \
|
||||
'(!Boolean(document.querySelector(".running-status.loading")));'
|
||||
while not browser.execute_script(script):
|
||||
time.sleep(0.1)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user