Skip to content

PF5 migration of Settings page - #1934

Merged
lhellebr merged 4 commits into
SatelliteQE:masterfrom
lhellebr:pf5_settings
Jul 28, 2025
Merged

PF5 migration of Settings page#1934
lhellebr merged 4 commits into
SatelliteQE:masterfrom
lhellebr:pf5_settings

Conversation

@lhellebr

@lhellebr lhellebr commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Migrate the Settings page and related components to PF5 by introducing a new editable field widget, updating view mixins and multi-select, replacing legacy widgets, and adding a navbar locator, along with a navigation tweak for nightly builds

New Features:

  • Add FieldWithEditBtn widget for PF5 editable fields

Bug Fixes:

  • Adjust ShowAllTasks navigation to handle Foreman vs Satellite in nightly builds

Enhancements:

  • Replace PopOverWidget with FieldWithEditBtn in SettingsView
  • Switch SettingsView to PF5-compatible SearchableViewMixin
  • Update BaseMultiSelect to use PF5 OUIA dropdown
  • Add product locator in BaseLoggedInView for PF5 navbar

@lhellebr
lhellebr requested review from pnovotny and pondrejk July 22, 2025 13:25
@lhellebr lhellebr added the No-CherryPick PR doesnt need CherryPick to previous branches label Jul 22, 2025
@sourcery-ai

sourcery-ai Bot commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Migrates the Settings page and underlying widgets to PF5 by introducing a new editable-field widget, updating select component inheritance, and revising SettingsView imports and column widgets; also enhances navigation logic to handle nightly builds by exposing and using the product identifier.

Sequence diagram for FieldWithEditBtn fill interaction

sequenceDiagram
    participant User as actor User
    participant Widget as FieldWithEditBtn
    User->>Widget: fill(item)
    Widget->>Widget: editBtn.click()
    alt textinput is displayed
        Widget->>Widget: textinput.fill(item)
    else textarea is displayed
        Widget->>Widget: textarea.fill(item)
    else dropdown is displayed
        Widget->>Widget: dropdown.fill(item)
    end
    Widget->>Widget: confirmBtn.click()
Loading

Sequence diagram for ShowAllTasks navigation logic update

sequenceDiagram
    participant ShowAllTasks
    participant View
    participant Menu
    ShowAllTasks->>View: check product.is_displayed
    alt Foreman is displayed
        ShowAllTasks->>Menu: select('Monitor', 'Foreman Tasks', 'Tasks')
    else Satellite is displayed
        ShowAllTasks->>Menu: select('Monitor', 'Satellite Tasks', 'Tasks')
    end
Loading

Class diagram for new FieldWithEditBtn widget

classDiagram
    class FieldWithEditBtn {
        +TextInput textinput
        +TextInput textarea
        +FormSelect dropdown
        +PF5Button editBtn
        +PF5Button confirmBtn
        +PF5Button cancelBtn
        +Text text
        +fill(item)
        +read()
    }
    Widget <|-- FieldWithEditBtn
Loading

Class diagram for SettingsView migration to PF5

classDiagram
    class SettingsView {
        +Text title
        +Table table
    }
    BaseLoggedInView <|-- SettingsView
    SearchableViewMixin <|-- SettingsView
    Table o-- FieldWithEditBtn : column_widgets["Value"]
Loading

Class diagram for BaseMultiSelect inheritance update

classDiagram
    class BaseMultiSelect {
        "PF5BaseSelect, PF5OUIADropdown"
    }
    PF5BaseSelect <|-- BaseMultiSelect
    PF5OUIADropdown <|-- BaseMultiSelect
Loading

Class diagram for BaseLoggedInView product attribute addition

classDiagram
    class BaseLoggedInView {
        +Text permission_denied
        +Text product
        +select_logout()
    }
Loading

File-Level Changes

Change Details Files
Introduced a new FieldWithEditBtn widget for PF5 editable fields
  • Added FieldWithEditBtn class
  • Defined locators for input, textarea, dropdown, edit/confirm/cancel buttons, and static text
  • Implemented fill method to toggle edit mode and apply value
  • Implemented read method to return displayed text
airgun/widgets.py
Refined multi-select inheritance to use OUIA-based PF5 dropdown
  • Replaced PF5Dropdown base with PF5OUIADropdown in BaseMultiSelect
airgun/widgets.py
Upgraded SettingsView to use PF5 mixin and new editable-field widget
  • Swapped SearchableViewMixinPF4 for the generic PF5 SearchableViewMixin
  • Imported FieldWithEditBtn instead of PopOverWidget
  • Replaced table’s Value column widget with FieldWithEditBtn
airgun/views/settings.py
Added dynamic task navigation for nightly builds
  • Introduced a product Text locator in BaseLoggedInView
  • Updated ShowAllTasks.step to detect displayed product name
  • Adjusted menu.select call to use either 'Foreman Tasks' or 'Satellite Tasks'
airgun/views/common.py
airgun/entities/task.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lhellebr - I've reviewed your changes - here's some feedback:

  • FieldWithEditBtn.fill checks widget.is_displayed without calling it and doesn’t handle the case where no editable widget is found; invoke widget.is_displayed() properly and add an error if none match.
  • The ROOT locator for FieldWithEditBtn is hardcoded to '//td[2]' and may break if column positions change; consider targeting a more stable attribute or using the column header text.
  • The product detection in ShowAllTasks.step mixes UI presence checks with business logic; extract this into a small helper or mapping to make the logic clearer and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- FieldWithEditBtn.fill checks widget.is_displayed without calling it and doesn’t handle the case where no editable widget is found; invoke widget.is_displayed() properly and add an error if none match.
- The ROOT locator for FieldWithEditBtn is hardcoded to '//td[2]' and may break if column positions change; consider targeting a more stable attribute or using the column header text.
- The product detection in ShowAllTasks.step mixes UI presence checks with business logic; extract this into a small helper or mapping to make the logic clearer and easier to maintain.

## Individual Comments

### Comment 1
<location> `airgun/widgets.py:2704` </location>
<code_context>
+    cancelBtn = PF5Button(locator=".//button[@data-ouia-component-id='cancel-edit-btn']")
+    text = Text(locator=".//span")
+
+    def fill(self, item):
+        self.editBtn.click()
+        for widget_name in ['textinput', 'textarea', 'dropdown']:
+            widget = getattr(self, widget_name)
+            if widget.is_displayed:
+                widget.fill(item)
+                break
+        self.confirmBtn.click()
+
+    def read(self):
</code_context>

<issue_to_address>
Potential issue with widget.is_displayed being a property or method.

Please verify whether `is_displayed` is a property or a method and update the check accordingly to prevent logical errors.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread airgun/widgets.py Outdated
Comment on lines +2704 to +2711
def fill(self, item):
self.editBtn.click()
for widget_name in ['textinput', 'textarea', 'dropdown']:
widget = getattr(self, widget_name)
if widget.is_displayed:
widget.fill(item)
break
self.confirmBtn.click()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Potential issue with widget.is_displayed being a property or method.

Please verify whether is_displayed is a property or a method and update the check accordingly to prevent logical errors.

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 22, 2025
@LadislavVasina1
LadislavVasina1 self-requested a review July 23, 2025 11:48
Comment thread airgun/widgets.py Outdated
"""

ROOT = '//td[2]'
textinput = TextInput(locator=".//input[@data-ouia-component-type='PF5/TextInput']")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this TextInput have some data-ouia-component-id?
If so we could use from widgetastic_patternfly5.ouia import TextInput as PF5OUIATextInput

and then
text_input = PF5OUIATextInput('componentID')

also please use snake_case for all class variables if possible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but it changes. For example, there are inputs with ids setting-input-login_text, setting-input-proxy_request_timeout... and while it would be possible to use these, I think it would require greater changes than I intended to do.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, in that case omit my comment

Comment thread airgun/widgets.py Outdated

ROOT = '//td[2]'
textinput = TextInput(locator=".//input[@data-ouia-component-type='PF5/TextInput']")
textarea = TextInput(locator=".//textarea")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above with the OUIA component, if applicable...

Comment thread airgun/widgets.py Outdated
ROOT = '//td[2]'
textinput = TextInput(locator=".//input[@data-ouia-component-type='PF5/TextInput']")
textarea = TextInput(locator=".//textarea")
dropdown = FormSelect(locator=".//select[@data-ouia-component-type='PF5/FormSelect']")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above with the OUIA component, but with formSelect if compontent-id applies

Comment thread airgun/widgets.py Outdated

@LadislavVasina1 LadislavVasina1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lhellebr Thank you for the addition, changes look good overall, just small changes requested.
Please look at the usage of OUIA components and the naming.

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

2 similar comments
@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

Comment thread airgun/widgets.py Outdated
Comment thread airgun/widgets.py
@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@LadislavVasina1 LadislavVasina1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK from my side

@lhellebr

Copy link
Copy Markdown
Contributor Author

Rerunning to see why tests.foreman.ui.test_settings.test_positive_update_email_delivery_method_sendmail failed.

tests.foreman.ui.test_settings.test_negative_validate_foreman_url_error_message[foreman_url is https://issues.redhat.com/browse/SAT-36218

@lhellebr

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_settings.py
robottelo: 19043

@lhellebr

Copy link
Copy Markdown
Contributor Author

test_positive_update_email_delivery_method_sendmail passed, this should be good to merge

@lhellebr
lhellebr merged commit a8e3f2c into SatelliteQE:master Jul 28, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-CherryPick PR doesnt need CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed for the PR Stream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants