tests: functional: Wait for installation to complete fully

- There is a special page which is served when race condition occurs between the
setup middleware and setup view soon after an installation. In this case, a
special page is shown with 'App installed' as message but this is still the
setup view. Detect this case and wait for page to refresh.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-31 23:52:26 -07:00 committed by James Valleroy
parent 38610d8eb8
commit a16af8c37a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 2 deletions

View File

@ -15,7 +15,9 @@
{% if setup_state.value == 'up-to-date' %} {% if setup_state.value == 'up-to-date' %}
{% trans "Application installed." %} <div class="app-just-installed">
{% trans "Application installed." %}
</div>
{% elif not operations %} {% elif not operations %}

View File

@ -342,7 +342,8 @@ def install(browser, app_name):
install_button_css = '.form-install input[type=submit]' install_button_css = '.form-install input[type=submit]'
while True: while True:
script = 'return (document.readyState == "complete") && ' \ script = 'return (document.readyState == "complete") && ' \
'(!Boolean(document.querySelector(".app-operation")));' '(!Boolean(document.querySelector(".app-operation"))) &&' \
'(!Boolean(document.querySelector(".app-just-installed")));'
if not browser.execute_script(script): if not browser.execute_script(script):
time.sleep(0.1) time.sleep(0.1)
elif browser.is_element_present_by_css('.neterror'): elif browser.is_element_present_by_css('.neterror'):