From e379236abe8aa50e168b884deebda65097263274 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 --- 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 c606155f0..5ed6ae970 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -2,6 +2,7 @@ from airgun.navigation import NavigateStep, navigator from airgun.views.host_new import ( InstallPackagesView, + ManageHostStatusesView, ModuleStreamDialog, NewHostDetailsView, ) @@ -28,6 +29,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 schedule_job(self, entity_name, values): """Schedule a remote execution on selected host""" view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index 046146a33..ce14f1b77 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -278,6 +278,26 @@ class InstallPackagesView(View): cancel = Button('Cancel') +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 ModuleStreamDialog(Pf4ConfirmationDialog): confirm_dialog = Button(locator='.//button[@aria-label="confirm-module-action"]') cancel_dialog = Button(locator='.//button[@aria-label="cancel-module-action"]')