From c9a2bbd4075fa7176d6d0d16273ee018c35614a9 Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Wed, 2 Aug 2023 14:25:57 +0200 Subject: [PATCH] improve ProjectZoneView ui test fix (#1732) --- landingzones/tests/test_ui.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/landingzones/tests/test_ui.py b/landingzones/tests/test_ui.py index d82a5d2a..dfc28c50 100644 --- a/landingzones/tests/test_ui.py +++ b/landingzones/tests/test_ui.py @@ -58,14 +58,10 @@ def _assert_btn_enabled(self, element, expected=True): def _wait_for_status_update(self): """Wait for JQuery landing zone status updates to finish""" - max_retries = 5 - retry = 0 - while ( - not self.selenium.execute_script('return window.zoneStatusUpdated') - and retry < max_retries - ): + for i in range(0, 5): + if self.selenium.execute_script('return window.zoneStatusUpdated'): + return time.sleep(0.5) - retry += 1 def setUp(self): super().setUp() @@ -363,9 +359,12 @@ def test_zone_locked_buttons_superuser(self): By.CLASS_NAME, 'sodar-lz-zone-tr-existing' )[0] dropdown_div = zone.find_element(By.CLASS_NAME, 'sodar-lz-zone-buttons') - attr = dropdown_div.find_element( - By.CLASS_NAME, 'sodar-list-dropdown' - ).get_attribute('disabled') + try: + attr = dropdown_div.find_element( + By.CLASS_NAME, 'sodar-list-dropdown' + ).get_attribute('disabled') + except AssertionError: + attr = None self.assertIsNone(attr) self.assertNotIn( 'text-muted',