From 0f76738194989979c9287d5bb1e563aa7edfdf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Strelec?= Date: Fri, 22 Sep 2023 11:18:37 +0200 Subject: [PATCH] add Host statues modal support (#966) * add Host Statues modal support * address comments * address comments & fix stuck modal (cherry picked from commit f8c114b7015733e50c7e53be3c2a48b06631d061) --- airgun/entities/host_new.py | 16 ++++++++++++++++ airgun/views/host_new.py | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/airgun/entities/host_new.py b/airgun/entities/host_new.py index 2b4ad1d34..058f6c5c1 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -10,6 +10,7 @@ EnableTracerView, InstallPackagesView, ManageHostCollectionModal, + ManageHostStatusesView, ModuleStreamDialog, NewHostDetailsView, ParameterDeleteDialog, @@ -42,6 +43,21 @@ def get_details(self, entity_name, widget_names=None): self.browser.plugin.ensure_page_safe() return view.read(widget_names=widget_names) + def get_host_statuses(self, entity_name): + """Read host statuses from Host Details page + + Args: + entity_name: Name of the host + """ + view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) + view.wait_displayed() + self.browser.plugin.ensure_page_safe() + view.overview.host_status.manage_all_statuses.click() + view = ManageHostStatusesView(self.browser) + values = view.read() + view.close_modal.click() + return values + def edit_system_purpose( self, entity_name, role=None, sla=None, usage=None, release_ver=None, add_ons=None ): diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index ac8bffec1..fb96d4e63 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -795,6 +795,26 @@ class EditSystemPurposeView(View): cancel = OUIAButton('cancel-syspurpose') +class ManageHostStatusesView(View): + """Manage host statuses modal""" + + ROOT = './/div[@data-ouia-component-id="statuses-modal"]' + close_modal = Button(locator='.//button[@aria-label="Close"]') + host_statuses_table = PatternflyTable( + component_id='statuses-table', + column_widgets={ + 'Name': Text('.//td[contains(@data-label, "Name")]'), + 'Status': Text('.//td[contains(@data-label, "Status")]'), + 'Reported at': Text('.//td[contains(@data-label, "Reported at")]'), + 3: Button(locator='.//td[contains(@class, "action")]'), + }, + ) + + def read(self): + # Parses into a dictionary of {name: {status, reported_at}} + return {value.pop('Name'): value for value in self.host_statuses_table.read()} + + class EditAnsibleRolesView(View): """Edit Ansible Roles Modal"""