diff --git a/airgun/entities/host_new.py b/airgun/entities/host_new.py index 98cf6a7f7..3878612ab 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -391,6 +391,19 @@ def get_ansible_roles_modal(self, entity_name): self.browser.plugin.ensure_page_safe() return view.table.read() + def remove_single_ansible_role(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() + wait_for(lambda: view.ansible.roles.edit.click(), timeout=5) + edit_view = EditAnsibleRolesView(self.browser) + edit_view.wait_displayed() + actions = [edit_view.hostAssignedAnsibleRoles, edit_view.unselectRoles, edit_view.confirm] + for action in actions: + action.click() + wait_for(lambda: view.ansible.roles.noRoleAssign.is_displayed, timeout=5) + 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 c32415aeb..d34145322 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -497,6 +497,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')}, @@ -801,7 +802,11 @@ class EditAnsibleRolesView(View): './/span[contains(text(),"RedHatInsights.insights-client") or contains(text(),"theforeman.foreman_scap_client")]' ) confirm = Button(locator='.//button[@aria-label="submit ansible roles"]') + hostAssignedAnsibleRoles = Text( + './/button[@class="pf-c-dual-list-selector__item"]/span[1]//span[2]' + ) selectRoles = Button(locator='.//button[@aria-label="Add selected"]') + unselectRoles = Button(locator='.//button[@aria-label="Remove selected"]') class ModuleStreamDialog(Pf4ConfirmationDialog):