Skip to content

Commit 9fd8ce9

Browse files
authored
Update RH Cloud locators for PF3 > PF5 (#2473)
This PR updates locators for the RH Lightspeed Inventory and Recommendations pages to support the recent migration of those pages from PatternFly 3 to PatternFly 5.
1 parent de46324 commit 9fd8ce9

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

airgun/views/cloud_insights.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@ def is_displayed(self):
5252
return self.title.is_displayed
5353

5454

55+
class InsightsActionDropdown(PF5Menu):
56+
"""The three-dot actions menu on the Recommendations page.
57+
58+
Uses a CSS class selector scoped to the 'title-dropdown' class set by ToolbarDropdown.js,
59+
avoiding reliance on OUIA component type attributes that change across PatternFly versions."""
60+
61+
IS_ALWAYS_OPEN = False
62+
BUTTON_LOCATOR = './/button[@aria-label="Recommendations actions"]'
63+
ROOT = f'{BUTTON_LOCATOR}/..'
64+
65+
5566
class CloudInsightsView(BaseLoggedInView, SearchableViewMixinPF4):
5667
"""Main Red Hat Lightspeed view."""
5768

5869
title = Text('//h1[normalize-space(.)="Red Hat Lightspeed"]')
5970
insights_sync_switcher = PF5OUIASwitch('foreman-rh-cloud-switcher')
6071
remediate = PF5Button('Remediate')
61-
insights_dropdown = PF5OUIADropdown('title-dropdown')
72+
insights_dropdown = InsightsActionDropdown()
6273
select_all = Checkbox(locator='.//input[@aria-label="Select all rows"]')
6374
table = PF5OUIAPatternflyTable(
6475
component_id='rh-cloud-recommendations-table',

airgun/views/cloud_inventory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class DataCollectionMenu(Menu):
1515
""" """
1616

1717
IS_ALWAYS_OPEN = False
18-
BUTTON_LOCATOR = ".//button[contains(@class, '-c-menu-toggle')]"
18+
BUTTON_LOCATOR = (
19+
".//button[contains(@class, '-c-menu-toggle') and contains(@class, 'pf-m-full-width')]"
20+
)
1921
ROOT = f'{BUTTON_LOCATOR}/..'
2022

2123

0 commit comments

Comments
 (0)