Skip to content

Commit

Permalink
adding ansible role as per given input (#1542) (#1552)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3d741d2)

Co-authored-by: amolpati30 <151733635+amolpati30@users.noreply.github.com>
  • Loading branch information
Satellite-QE and amolpati30 authored Sep 26, 2024
1 parent 0e0ee5e commit 2931051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 3 additions & 5 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,16 @@ 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):
def add_single_ansible_role(self, entity_name, role=None):
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=10)
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()
edit_view.addAnsibleRole.select_and_move([role])
edit_view.confirm.click()

def get_ansible_roles(self, entity_name):
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
Expand Down
5 changes: 2 additions & 3 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from widgetastic_patternfly4 import (
Button,
Dropdown,
DualListSelector,
Pagination as PF4Pagination,
Select,
Tab,
Expand Down Expand Up @@ -834,9 +835,7 @@ def read(self):
class EditAnsibleRolesView(View):
"""Edit Ansible Roles Modal"""

addAnsibleRole = Text(
'.//span[contains(text(),"RedHatInsights.insights-client") or contains(text(),"theforeman.foreman_scap_client")]'
)
addAnsibleRole = DualListSelector('//div[@class = "pf-c-dual-list-selector"]')
confirm = Button(locator='.//button[@aria-label="submit ansible roles"]')
hostAssignedAnsibleRoles = Text(
'.//button[@class="pf-c-dual-list-selector__item"]/span[1]//span[2]'
Expand Down

0 comments on commit 2931051

Please sign in to comment.