Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add/update host_new entities & views #1324

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import time

from navmazing import NavigateToSibling
from wait_for import wait_for

from airgun.entities.host import HostEntity
from airgun.navigation import NavigateStep, navigator
from airgun.views.host_new import (
AllAssignedRolesView,
EditAnsibleRolesView,
EditSystemPurposeView,
EnableTracerView,
InstallPackagesView,
Expand Down Expand Up @@ -402,10 +404,24 @@ def bulk_override_repo_sets(self, entity_name, repo_type, action):
view.flash.assert_no_error()
view.flash.dismiss()

def add_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()
wait_for(lambda: view.ansible.roles.edit.is_displayed, timeout=5)
view.ansible.roles.edit.click()
wait_for(lambda: EditAnsibleRolesView(self.browser).addAnsibleRole.is_displayed, timeout=5)
edit_view = EditAnsibleRolesView(self.browser)
actions = [edit_view.addAnsibleRole, edit_view.selectRoles, edit_view.confirm]
for action in actions:
wait_for(lambda: edit_view.is_displayed, timeout=5)
action.click()

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()
wait_for(lambda: view.ansible.roles.table.is_displayed, timeout=5)
return view.ansible.roles.table.read()

def get_ansible_roles_modal(self, entity_name):
Expand All @@ -418,6 +434,18 @@ def get_ansible_roles_modal(self, entity_name):
self.browser.plugin.ensure_page_safe()
return view.table.read()

def remove_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)
actions = [edit_view.hostAssignedAnsibleRoles, edit_view.unselectRoles, edit_view.confirm]
for action in actions:
wait_for(lambda: edit_view.is_displayed, timeout=5)
action.click()

def enable_tracer(self, entity_name):
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
Expand Down
10 changes: 8 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,13 @@ def read(self):
class EditAnsibleRolesView(View):
"""Edit Ansible Roles Modal"""

ROOT = ''
# No current representation for this Widget in Widgetastic
addAnsibleRole = Text('.//span[contains(text(),"RedHatInsights.insights-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):
Expand Down