From 8ac2f2cad93840ebd3fb11bd3ac781e51cf408eb Mon Sep 17 00:00:00 2001 From: Adarsh dubey Date: Tue, 7 Mar 2023 19:28:55 +0530 Subject: [PATCH] Cherry-picking Ansible UI fixes (#815) Signed-off-by: Adarsh Dubey (cherry picked from commit d09210d3f2eefdd1e52dbaad566e94060275e379) --- airgun/entities/ansible_role.py | 7 +++---- airgun/views/ansible_role.py | 4 ++-- airgun/views/ansible_variable.py | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/airgun/entities/ansible_role.py b/airgun/entities/ansible_role.py index 966e0ac5a..cc26f200d 100644 --- a/airgun/entities/ansible_role.py +++ b/airgun/entities/ansible_role.py @@ -39,10 +39,9 @@ def imported_roles_count(self): view = self.navigate_to(self, 'All') # Before any roles have been imported, no table or pagination widget are # present on the page - if not view.pagination.is_displayed: - return 0 - else: - return int(view.total_imported_roles.read()) + # Applying wait_displayed for the page to get rendered properly + view.wait_displayed() + return int(view.total_imported_roles.read()) def import_all_roles(self): """Import all available roles and return the number of roles diff --git a/airgun/views/ansible_role.py b/airgun/views/ansible_role.py index e5d240bac..c9d367669 100644 --- a/airgun/views/ansible_role.py +++ b/airgun/views/ansible_role.py @@ -21,10 +21,10 @@ class AnsibleRolesView(BaseLoggedInView, SearchableViewMixin): is present, without the search widget or table. """ - title = Text("//h1") + title = Text("//h1[contains(normalize-space(.),'Ansible Roles')]") import_button = Text("//a[contains(@href, '/ansible_roles/import')]") submit = Button('Submit') - total_imported_roles = Text("//span[@class='pf-c-options-menu__toggle-text']/b[2]") + total_imported_roles = Text("//span[@class='pf-c-options-menu__toggle-text']//b[2]") table = Table( './/table', column_widgets={ diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index dd0100f44..0f4b446ce 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -17,9 +17,9 @@ class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixin): """Main Ansible Variables view""" - title = Text("//h1[contains(., text()='Ansible Variables')") + title = Text("//h1[contains(normalize-space(.),'Ansible Variables')]") new_variable = Text("//a[contains(@href, '/ansible/ansible_variables/new')]") - total_variables = Text("//span[@class='pf-c-options-menu__toggle-text']/b[2]") + total_variables = Text("//span[@class='pf-c-options-menu__toggle-text']//b[2]") table = SatTable( './/table', column_widgets={