Skip to content

Update locator and create host entity - #1936

Merged
LadislavVasina1 merged 1 commit into
SatelliteQE:masterfrom
amolpati30:Locator_updated_and_host_entity
Aug 12, 2025
Merged

Update locator and create host entity#1936
LadislavVasina1 merged 1 commit into
SatelliteQE:masterfrom
amolpati30:Locator_updated_and_host_entity

Conversation

@amolpati30

@amolpati30 amolpati30 commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Update various element locators in Hosts view and improve host creation stability.

Bug Fixes:

  • Wrap host form filling in a wait_for call in HostEntity.create to ensure fields are populated before submission.

Enhancements:

  • Refresh 'Create Host' button, checkbox, and actions dropdown selectors to match updated UI structure in HostsView.

@sourcery-ai

sourcery-ai Bot commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR refines element locators in HostsView for improved reliability and adds a wait_for wrapper around the host creation form fill to ensure synchronization before proceeding.

Sequence diagram for host creation with wait_for synchronization

sequenceDiagram
    participant Test as Test Code
    participant HostEntity
    participant Browser
    participant HostsView
    Test->>HostEntity: create(values)
    HostEntity->>HostsView: navigate_to(self, 'New')
    HostEntity->>HostsView: wait_for(view.fill(values), timeout=60)
    HostsView-->>HostEntity: Form filled
    HostEntity->>Browser: click(view.submit, ignore_ajax=True)
    HostEntity->>Browser: plugin.ensure_page_safe(timeout='800s')
    HostEntity->>NewHostDetailsView: instantiate with browser
Loading

Class diagram for updated HostsView and HostEntity

classDiagram
    class HostsView {
        +Text title
        +PF5Button manage_columns
        +Text export
        +Text new
        +PF4Button register
        +Text new_ui_button
        +Checkbox select_all
        +SatTable table
        +displayed_table_headers
    }
    class HostEntity {
        +create(values)
    }
    HostsView --> SatTable : contains
    SatTable --> Checkbox : column_widgets[0]
    SatTable --> Text : column_widgets['Name']
    SatTable --> Text : column_widgets['Recommendations']
    SatTable --> ActionsDropdown : column_widgets['Actions']
    HostEntity --> HostsView : uses in create()
Loading

File-Level Changes

Change Details Files
Refine element locators in HostsView
  • Update 'Create Host' button locator to use foreman-page container and OUIA component id
  • Change table row checkbox locator to target input[@type='checkbox']
  • Adjust Actions dropdown locator to use pf-v5-c-menu-toggle pf-m-plain button
airgun/views/host.py
Add synchronization to HostEntity.create
  • Wrap view.fill call in wait_for with a 60s timeout
airgun/entities/host.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 @amolpati30 - 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/host.py:46` </location>
<code_context>
     def create(self, values):
         """Create new host entity"""
         view = self.navigate_to(self, 'New')
-        view.fill(values)
+        wait_for(lambda: view.fill(values), timeout=60)
         self.browser.click(view.submit, ignore_ajax=True)
         self.browser.plugin.ensure_page_safe(timeout='800s')
</code_context>

<issue_to_address>
Host creation now waits for the fill operation to complete.

Confirm that view.fill is idempotent or that wait_for won't invoke it multiple times, to avoid unintended side effects from repeated calls.
</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/host.py
def create(self, values):
"""Create new host entity"""
view = self.navigate_to(self, 'New')
view.fill(values)

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): Host creation now waits for the fill operation to complete.

Confirm that view.fill is idempotent or that wait_for won't invoke it multiple times, to avoid unintended side effects from repeated calls.

@amolpati30 amolpati30 added No-CherryPick PR doesnt need CherryPick to previous branches Stream labels Jul 26, 2025
@amolpati30
amolpati30 force-pushed the Locator_updated_and_host_entity branch from 861f6a5 to ff17297 Compare July 26, 2025 16:30
@amolpati30

Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_computeresource_azurerm.py -k test_positive_azurerm_host_provision_ud

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 26, 2025
Comment thread airgun/views/host.py Outdated
@amolpati30
amolpati30 force-pushed the Locator_updated_and_host_entity branch from ff17297 to 521c919 Compare August 11, 2025 09:13
@amolpati30
amolpati30 requested a review from vijaysawant August 11, 2025 09:13
@vijaysawant

Copy link
Copy Markdown
Contributor
trigger: test-robottelo
pytest: tests/foreman/ui/test_computeresource_azurerm.py -k test_positive_azurerm_host_provision_ud

@vijaysawant vijaysawant added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Passed Indicates that latest PRT run is passed for the PR labels Aug 11, 2025
@LadislavVasina1
LadislavVasina1 merged commit 5a1731f into SatelliteQE:master Aug 12, 2025
10 of 11 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-Passed Indicates that latest PRT run is passed for the PR Stream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants