Skip to content
Merged
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
19 changes: 11 additions & 8 deletions airgun/entities/all_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
DisassociateHostsModal,
HostDeleteDialog,
HostgroupDialog,
ManageCVEModal,
ManageErrataModal,
ManagePackagesModal,
ManageRepositorySetsModal,
ManageSystemPurposeModal,
ManageTracesModal,
)
from airgun.views.host_new import ManageMultiCVEnvModal
from airgun.views.job_invocation import JobInvocationCreateView


Expand Down Expand Up @@ -107,11 +107,11 @@ def change_hostgroup(self, name):
view.hostgroup_dropdown.item_select(name)
view.save_button.click()

def manage_cve(self, lce=None, cv=None):
def manage_cve(self, lce_name=None, cv_name=None):
"""Bulk reassign Content View Environments through the All Hosts page
args:
lce (str): Lifecycle Environment to swap the hosts to.
cv (str): CV within that LCE to assign the hosts to.
lce_name (str): Lifecycle Environment to swap the hosts to.
cv_name (str): CV within that LCE to assign the hosts to.
"""
view = self.navigate_to(self, 'All')
self.browser.plugin.ensure_page_safe(timeout='5s')
Expand All @@ -120,10 +120,13 @@ def manage_cve(self, lce=None, cv=None):
view.bulk_actions_kebab.click()
self.browser.move_to_element(view.bulk_actions_menu.item_element('Manage content'))
view.bulk_actions_manage_content_menu.item_select('Content view environments')
view = ManageCVEModal(self.browser)
view.lce_selector.fill({lce: True})
view.content_source_select.item_select(cv)
view.save_btn.click()
modal = ManageMultiCVEnvModal(self.browser)
assignment_section = modal.new_assignment_section(lce_name=lce_name)
assignment_section.lce_selector.wait_displayed(timeout=5)
assignment_section.lce_selector.click()
assignment_section.content_source_select.item_select(cv_name)
modal.save_btn.click()
wait_for(lambda: not modal.is_displayed, timeout=10)

def manage_table_columns(self, values: dict):
"""
Expand Down
18 changes: 12 additions & 6 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class CVESelect(Select):
ITEM_LOCATOR = '//button[contains(@class, "pf-v5-c-select__menu-item") and contains(normalize-space(.), {})]'
SELECTED_ITEM_LOCATOR = './/span[contains(@class, "ins-c-conditional-filter")]'
TEXT_LOCATOR = './/div[contains(@class, "pf-v5-c-select") and child::button]'
DEFAULT_LOCATOR = './/div[contains(@class,"pf-v5-c-expandable-section") and contains(@class,"pf-m-expanded")]//div[contains(@class, "pf-v5-c-select") and @data-ouia-component-id="select-content-view"]'
DEFAULT_LOCATOR = './/div[contains(@class, "pf-v5-c-select") and @data-ouia-component-id="select-content-view"]'
SEARCH_INPUT_LOCATOR = (
'.//input[@type="text" and contains(@class, "pf-v5-c-select__toggle-typeahead")]'
)
Expand Down Expand Up @@ -1217,13 +1217,15 @@ def submit(self):
class NewCVEnvAssignmentSection(PF5LCESelectorGroup):
# Generic ROOT that works for both new and existing assignments
# Don't check for "Select a content view" text - just find the assignment-section div
ROOT = './/div[@class="attached-content-views"]'
ROOT = (
'.//div[contains(@class,"pf-v5-c-expandable-section") and contains(@class,"pf-m-expanded")]'
)

PARAMETERS = ('lce_name',)

lce_selector = PF5LCESelector(
locator=ParametrizedLocator(
'.//div[contains(@class,"pf-v5-c-expandable-section") and contains(@class,"pf-m-expanded")]//input[@type="radio"][following-sibling::label//span[normalize-space(.)="{lce_name}"]]'
'.//input[@type="radio"][following-sibling::label//span[normalize-space(.)="{lce_name}"]]'
)
)
content_source_select = CVESelect()
Expand All @@ -1235,12 +1237,16 @@ class ManageMultiCVEnvModal(PF5Modal):
when the 'Allow multiple content views' setting is enabled.
"""

ROOT = './/div[@data-ouia-component-id="assign-cv-modal"]'
ROOT = './/div[@data-ouia-component-id="assign-cv-modal" or @data-ouia-component-id="bulk-assign-cves-modal"]'

title = Text('//span[normalize-space(.)="Assign content view environments"]')
assign_cv_btn = PF5OUIAButton('assign-another-cv-button')
save_btn = PF5OUIAButton('assign-cv-modal-save-button')
cancel_btn = PF5OUIAButton('assign-cv-modal-cancel-button')
save_btn = PF5Button(
locator='.//button[@data-ouia-component-id="assign-cv-modal-save-button" or @data-ouia-component-id="bulk-assign-cves-modal-save-button"]'
)
cancel_btn = PF5Button(
locator='.//button[@data-ouia-component-id="assign-cv-modal-cancel-button" or @data-ouia-component-id="bulk-assign-cves-modal-cancel-button"]'
)
new_assignment_section = ParametrizedView.nested(NewCVEnvAssignmentSection)

@property
Expand Down