Skip to content

Commit

Permalink
add/update host_new entities & views
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed Mar 28, 2024
1 parent 3c6ab7f commit 75173ba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
20 changes: 19 additions & 1 deletion airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from airgun.navigation import NavigateStep, navigator
from airgun.views.host_new import (
AllAssignedRolesView,
EditAnsibleRolesView,
EditSystemPurposeView,
EnableTracerView,
InstallPackagesView,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
9 changes: 7 additions & 2 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')},
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 75173ba

Please sign in to comment.