Skip to content

Disassociate Hosts Coverage [SAT-31029] - #1909

Merged
vsedmik merged 4 commits into
SatelliteQE:masterfrom
LadislavVasina1:disassociateHostsCoverage
Jul 8, 2025
Merged

Disassociate Hosts Coverage [SAT-31029]#1909
vsedmik merged 4 commits into
SatelliteQE:masterfrom
LadislavVasina1:disassociateHostsCoverage

Conversation

@LadislavVasina1

@LadislavVasina1 LadislavVasina1 commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

This PR adds airgun coverage for Disassociate hosts function coming to stream on All hosts page.
See SAT-31029.
Needed by: SatelliteQE/robottelo#18859

Summary by Sourcery

Add Airgun test coverage for the Disassociate Hosts function on the All hosts page, including navigation, selection logic, and modal interactions.

New Features:

  • Add disassociate_hosts action to automate disassociating hosts from the All hosts page
  • Introduce DisassociateHostsModal view to represent and interact with the disassociate hosts modal

Enhancements:

  • Validate mutually exclusive select_all_hosts and host_names parameters
  • Support both individual host selection and select-all flow in the disassociate_hosts method

@LadislavVasina1 LadislavVasina1 self-assigned this Jul 1, 2025
@LadislavVasina1 LadislavVasina1 added entity Related to entity coverage view Issues related to Views coverage No-CherryPick PR doesnt need CherryPick to previous branches Stream labels Jul 1, 2025
@sourcery-ai

sourcery-ai Bot commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR adds Airgun test coverage for the “Disassociate hosts” bulk action on the All Hosts page by implementing a new API method to drive the workflow and introducing a corresponding modal view.

Sequence diagram for disassociating hosts via AllHostsEntity

sequenceDiagram
    actor Tester
    participant AllHostsEntity
    participant AllHostsTableView
    participant DisassociateHostsModal

    Tester->>AllHostsEntity: disassociate_hosts(host_names, select_all_hosts)
    AllHostsEntity->>AllHostsTableView: navigate_to('All')
    AllHostsTableView->>AllHostsTableView: wait_displayed()
    alt select_all_hosts
        AllHostsEntity->>AllHostsTableView: select_all.fill(True)
    else select specific hosts
        AllHostsEntity->>AllHostsTableView: search(host_name)
        AllHostsTableView->>AllHostsTableView: table[0][0].widget.fill(True)
    end
    AllHostsEntity->>AllHostsTableView: bulk_actions_kebab.click()
    AllHostsTableView->>AllHostsTableView: bulk_actions_menu.item_select('Disassociate hosts')
    AllHostsEntity->>DisassociateHostsModal: instantiate modal
    DisassociateHostsModal->>DisassociateHostsModal: confirm_btn.click()
Loading

Class diagram for DisassociateHostsModal and AllHostsEntity changes

classDiagram
    class AllHostsEntity {
        ...
        +disassociate_hosts(host_names, select_all_hosts=False)
    }
    class DisassociateHostsModal {
        OUIA_ID
        title
        close_btn
        confirm_btn
        cancel_btn
        +is_displayed
    }
    AllHostsEntity --> DisassociateHostsModal : uses
Loading

File-Level Changes

Change Details Files
Implement disassociate_hosts entity method
  • Add disassociate_hosts(host_names, select_all_hosts) with docstring
  • Validate mutually exclusive parameters (host_names vs select_all)
  • Navigate to All Hosts, wait for page to be safe and view to render
  • Select hosts (all or those matching host_names) via search and table widget
  • Open bulk actions menu and choose “Disassociate hosts” action
  • Instantiate DisassociateHostsModal and click confirm
airgun/entities/all_hosts.py
Introduce DisassociateHostsModal view
  • Define new PF5 modal class with OUIA_ID
  • Add locators for title, close, confirm, and cancel buttons
  • Implement is_displayed property to detect modal presence
airgun/views/all_hosts.py
Update AllHosts entity imports
  • Import DisassociateHostsModal in the entities module
airgun/entities/all_hosts.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 @LadislavVasina1 - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `airgun/entities/all_hosts.py:520` </location>
<code_context>
             raise Exception("Repository count not matches")
         view.review.set_content_overrides.click()

+    def disassociate_hosts(self, host_names, select_all_hosts=False):
+        """
+        Navigate to the Disassociate hosts modal for selected hosts and disassociate them.
</code_context>

<issue_to_address>
Parameter name in docstring does not match function signature.

The docstring should use 'host_names' to match the parameter name and avoid confusion.
</issue_to_address>

### Comment 2
<location> `airgun/entities/all_hosts.py:544` </location>
<code_context>
+            if not isinstance(host_names, list):
+                host_names = [host_names]
+            for host_name in host_names:
+                view.search(host_name)
+                view.table[0][0].widget.fill(True)
+
+        view.bulk_actions_kebab.click()
</code_context>

<issue_to_address>
Selecting hosts by always using the first row may not be robust.

Selecting view.table[0][0] directly may not reliably select the intended host if the table structure or search results change. Please ensure the selected row matches the searched host.
</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/entities/all_hosts.py
Comment thread airgun/entities/all_hosts.py
@LadislavVasina1

Copy link
Copy Markdown
Contributor Author

PRT passed in SatelliteQE/robottelo#18859

@LadislavVasina1 LadislavVasina1 added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 1, 2025

@vijaysawant vijaysawant 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.

Non-blocking: request for change in doc strig with additional suggestion.

Comment thread airgun/views/all_hosts.py Outdated
@LadislavVasina1 LadislavVasina1 removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 2, 2025

@pnovotny pnovotny 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.

LGTM

Comment thread airgun/entities/all_hosts.py Outdated

@vsedmik vsedmik 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.

LGTM

@vsedmik
vsedmik merged commit 8b75a9e into SatelliteQE:master Jul 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

entity Related to entity coverage No-CherryPick PR doesnt need CherryPick to previous branches Stream view Issues related to Views coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants