From 14ce3f3830a6374d346055d9b3f393241596a197 Mon Sep 17 00:00:00 2001 From: Jan Jasek Date: Mon, 21 Jul 2025 07:21:58 +0200 Subject: [PATCH] pytest-based selenium test wait for angular timeout Timeout for script for waiting on angular to be ready seems to be not enough sometimes (10s). As this async script is working as checking the state of angular, increasing the timeout should not bring any negative effects, only positive. Now the timeout for the script will be dependent on the page timeout variable. Change-Id: I32067bf1451b48536a5ca96e5cee24a4b80158c2 Signed-off-by: Jan Jasek --- .../test/selenium/integration/test_images.py | 8 ++++---- .../test/selenium/integration/test_instances.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openstack_dashboard/test/selenium/integration/test_images.py b/openstack_dashboard/test/selenium/integration/test_images.py index 1d637143fd..a2f16c0bd0 100644 --- a/openstack_dashboard/test/selenium/integration/test_images.py +++ b/openstack_dashboard/test/selenium/integration/test_images.py @@ -122,8 +122,8 @@ def wait_for_steady_state_of_unprotected_image(openstack, image_name): time.sleep(2) -def wait_for_angular_readiness(driver): - driver.set_script_timeout(10) +def wait_for_angular_readiness(driver, config): + driver.set_script_timeout(config.selenium.page_timeout) driver.execute_async_script(""" var callback = arguments[arguments.length - 1]; var element = document.querySelector('div.btn-group[name="protected"]'); @@ -388,7 +388,7 @@ def test_remove_protected_image_admin(login, driver, image_names, pytest.fail("Delete option should not exist") actions_column.find_element_by_xpath( ".//*[normalize-space()='Edit Image']").click() - wait_for_angular_readiness(driver) + wait_for_angular_readiness(driver, config) image_form = driver.find_element_by_css_selector(".ng-wizard") image_form.find_element_by_xpath(".//label[text()='No']").click() image_form.find_element_by_xpath( @@ -427,7 +427,7 @@ def test_edit_image_description_admin(login, driver, image_names, actions_column = rows[0].find_element_by_xpath( ".//ancestor::tr/td[contains(@class,'actions_column')]") widgets.select_from_dropdown(actions_column, "Edit Image") - wait_for_angular_readiness(driver) + wait_for_angular_readiness(driver, config) image_form = driver.find_element_by_css_selector(".ng-wizard") desc_field = image_form.find_element_by_css_selector( "#imageForm-description") diff --git a/openstack_dashboard/test/selenium/integration/test_instances.py b/openstack_dashboard/test/selenium/integration/test_instances.py index 4ddd93afd1..462b6c8fde 100644 --- a/openstack_dashboard/test/selenium/integration/test_instances.py +++ b/openstack_dashboard/test/selenium/integration/test_instances.py @@ -56,8 +56,8 @@ def clear_instance_admin(instance_name, openstack_admin): ) -def wait_for_angular_readiness_instance_source(driver): - driver.set_script_timeout(10) +def wait_for_angular_readiness_instance_source(driver, config): + driver.set_script_timeout(config.selenium.page_timeout) driver.execute_async_script(""" var callback = arguments[arguments.length - 1]; var element = document.querySelector(\ @@ -158,7 +158,7 @@ def test_create_instance_demo(complete_default_test_network, login, driver, ) widgets.select_from_transfer_table(flavor_table, flavor) navigation.find_element_by_link_text("Source").click() - wait_for_angular_readiness_instance_source(driver) + wait_for_angular_readiness_instance_source(driver, config) source_table = wizard.find_element_by_css_selector( "ng-include[ng-form=launchInstanceSourceForm]" ) @@ -213,7 +213,7 @@ def test_create_instance_from_volume_demo(complete_default_test_network, login, ) widgets.select_from_transfer_table(flavor_table, flavor) navigation.find_element_by_link_text("Source").click() - wait_for_angular_readiness_instance_source(driver) + wait_for_angular_readiness_instance_source(driver, config) source_table = wizard.find_element_by_css_selector( "ng-include[ng-form=launchInstanceSourceForm]" ) @@ -466,7 +466,7 @@ def test_create_instance_admin(complete_default_test_network, login, driver, ) widgets.select_from_transfer_table(flavor_table, flavor) navigation.find_element_by_link_text("Source").click() - wait_for_angular_readiness_instance_source(driver) + wait_for_angular_readiness_instance_source(driver, config) source_table = wizard.find_element_by_css_selector( "ng-include[ng-form=launchInstanceSourceForm]" )