Skip to content

Commit c914fa8

Browse files
Fix TaskDetailsView and SatFlashMessages for PF5 UI updates
TaskDetailsView: The task details page no longer uses a "Task" tab. Metadata (Result, State, etc.) is now in an overview section using <small> labels. Progress bar disappears on completion. Result text is now capitalized ("Success" instead of "success"). Changes: - Change task from PF5Tab to plain View with overview section ROOT - Update TaskReadOnlyEntry locator for <small> label pattern - Normalize TaskReadOnlyEntry.read() to lowercase for compatibility - Remove progressbar.is_displayed check from wait_for_result - Update state, progressbar, output, dynflow_console locators SatFlashMessages: The flash container <ul> gained an extra class (foreman-toast-group), breaking the exact @Class= match. Changes: - Use contains() instead of exact class match in ROOT locator Test commands: pytest tests/foreman/ui/test_hostcollection.py::test_negative_hosts_limit pytest tests/foreman/ui/test_hostcollection.py::test_positive_change_assigned_content pytest tests/foreman/ui/test_product.py::test_positive_bulk_action_advanced_sync pytest tests/foreman/ui/test_repository.py::test_positive_sync_yum_repo_and_verify_content_checksum Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8394b2c commit c914fa8

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

airgun/views/task.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from wait_for import wait_for
22
from widgetastic.widget import Table, Text, View
33
from widgetastic_patternfly import BreadCrumb, Button
4-
from widgetastic_patternfly5 import Pagination as PF5Pagination, Tab as PF5Tab
4+
from widgetastic_patternfly5 import Button as PF5Button, Pagination as PF5Pagination
55

66
from airgun.views.common import BaseLoggedInView, SearchableViewMixinPF4
77
from airgun.widgets import (
@@ -21,10 +21,12 @@
2121

2222
class TaskReadOnlyEntry(ReadOnlyEntry):
2323
BASE_LOCATOR = (
24-
"//span[contains(., '{}') and contains(@class, 'list-group-item-heading')]//parent::div"
25-
'/following-sibling::div/span'
24+
"//small[normalize-space(.)='{}']/parent::div/following-sibling::div"
2625
)
2726

27+
def read(self):
28+
return super().read().lower()
29+
2830

2931
class TaskReadOnlyEntryError(ReadOnlyEntry):
3032
BASE_LOCATOR = "//span[contains(., '{}')]//parent::div/following-sibling::pre"
@@ -90,27 +92,31 @@ def is_displayed(self):
9092
)
9193

9294
@View.nested
93-
class task(PF5Tab):
94-
name = TaskReadOnlyEntry(name='Name')
95+
class task(View):
96+
ROOT = '//section[contains(@class, "task-details-overview-section")]'
9597
result = TaskReadOnlyEntry(name='Result')
9698
triggered_by = TaskReadOnlyEntry(name='Triggered by')
9799
execution_type = TaskReadOnlyEntry(name='Execution type')
98100
start_at = TaskReadOnlyEntry(name='Start at')
99101
started_at = TaskReadOnlyEntry(name='Started at')
100102
ended_at = TaskReadOnlyEntry(name='Ended at')
101-
start_before = TaskReadOnlyEntry(name='Start before')
102-
state = Text("//div[contains(@class, 'progress-description')]")
103-
progressbar = ProgressBar(locator='//div[contains(@class,"progress__bar")]')
104-
output = TaskReadOnlyEntry(name='Output')
103+
state = Text(
104+
"//p[@data-ouia-component-id='task-info-running-state-summary']"
105+
)
106+
progressbar = ProgressBar(
107+
locator='//div[contains(@class,"pf-v5-c-progress__bar")]'
108+
)
109+
output = ReadOnlyEntry(
110+
locator="//strong[normalize-space(.)='Output']/parent::div/following-sibling::div"
111+
)
105112
errors = TaskReadOnlyEntryError(name='Errors')
106-
dynflow_console = Button('Dynflow console')
113+
dynflow_console = PF5Button('Dynflow console')
107114

108115
def wait_for_result(self, timeout=60, delay=1):
109116
"""Wait for invocation job to finish"""
110117
wait_for(
111118
lambda: (
112119
self.is_displayed
113-
and self.task.progressbar.is_displayed
114120
and self.task.result.read() == 'success'
115121
),
116122
timeout=timeout,

airgun/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ class SatFlashMessages(FlashMessages):
11301130
11311131
"""
11321132

1133-
ROOT = '//ul[@class="pf-v5-c-alert-group pf-m-toast"]'
1133+
ROOT = '//ul[contains(@class, "pf-v5-c-alert-group") and contains(@class, "pf-m-toast")]'
11341134
MSG_LOCATOR = f'{ROOT}//div[contains(@class, "foreman-toast")]'
11351135
msg_class = SatFlashMessage
11361136

0 commit comments

Comments
 (0)