From 75173ba59b00fccbe5edebf5f115f52c3ad047a9 Mon Sep 17 00:00:00 2001 From: amolpati30 Date: Thu, 28 Mar 2024 17:30:26 +0530 Subject: [PATCH] add/update host_new entities & views --- airgun/entities/host_new.py | 20 +++++++++++++++++++- airgun/views/host_new.py | 9 +++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/airgun/entities/host_new.py b/airgun/entities/host_new.py index 230c1a61a..ed9fb745a 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -6,6 +6,7 @@ from airgun.navigation import NavigateStep, navigator from airgun.views.host_new import ( AllAssignedRolesView, + EditAnsibleRolesView, EditSystemPurposeView, EnableTracerView, InstallPackagesView, @@ -42,6 +43,7 @@ def get_details(self, entity_name, widget_names=None): view.wait_displayed() self.browser.plugin.ensure_page_safe() # Run this read twice to navigate to the page and load it before reading + time.sleep(1) view.read(widget_names=widget_names) return view.read(widget_names=widget_names) @@ -406,7 +408,9 @@ def get_ansible_roles(self, entity_name): view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) view.wait_displayed() self.browser.plugin.ensure_page_safe() - return view.ansible.roles.table.read() + result = view.ansible.roles + time.sleep(2) + return result.table.read() def get_ansible_roles_modal(self, entity_name): view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) @@ -418,6 +422,20 @@ def get_ansible_roles_modal(self, entity_name): self.browser.plugin.ensure_page_safe() return view.table.read() + def remove_ansible_roles(self, entity_name): + view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) + view.wait_displayed() + self.browser.plugin.ensure_page_safe() + view.ansible.roles.edit.click() + ansible = EditAnsibleRolesView(self.browser) + if ansible.is_displayed: + time.sleep(2) + ansible.hostAssignedAnsibleRoles.click() + time.sleep(2) + ansible.unselectRoles.click() + time.sleep(2) + ansible.confirm.click() + def enable_tracer(self, entity_name): view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) view.wait_displayed() diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index 889e71f10..f2b219a33 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -494,6 +494,7 @@ class roles(Tab): assignedRoles = Text('.//a[contains(@href, "roles/all")]') edit = Button(locator='.//button[@aria-label="edit ansible roles"]') + noRoleAssign = Text('.//h5[contains(@class, "pf-c-title pf-m-4xl")]') table = Table( locator='.//table[contains(@class, "pf-c-table")]', column_widgets={'Name': Text('.//a')}, @@ -792,8 +793,12 @@ def read(self): class EditAnsibleRolesView(View): """Edit Ansible Roles Modal""" - ROOT = '' - # No current representation for this Widget in Widgetastic + # ROOT = '' + confirm = Button(locator='.//button[@aria-label="submit ansible roles"]') + hostAssignedAnsibleRoles = Text( + './/button[@class="pf-c-dual-list-selector__item"]/span[1]//span[2]' + ) + unselectRoles = Button(locator='.//button[@aria-label="Remove selected"]') class ModuleStreamDialog(Pf4ConfirmationDialog):