From a16af8c37a57f7e94caa34eb2f9860981edefeb1 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 31 Aug 2022 23:52:26 -0700 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/templates/setup.html | 4 +++- plinth/tests/functional/__init__.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plinth/templates/setup.html b/plinth/templates/setup.html index 78a76fade..6d388ffc0 100644 --- a/plinth/templates/setup.html +++ b/plinth/templates/setup.html @@ -15,7 +15,9 @@ {% if setup_state.value == 'up-to-date' %} - {% trans "Application installed." %} +
+ {% trans "Application installed." %} +
{% elif not operations %} diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index e5880b0b9..2d2660fe6 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -342,7 +342,8 @@ def install(browser, app_name): install_button_css = '.form-install input[type=submit]' while True: 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): time.sleep(0.1) elif browser.is_element_present_by_css('.neterror'):