From d8ba1f473a192d733a25f0f22c38def7aa0d7bcc Mon Sep 17 00:00:00 2001 From: shwsingh Date: Mon, 16 Dec 2024 00:58:29 +0530 Subject: [PATCH] Add leapp preupgrade remidiation view --- airgun/entities/job_invocation.py | 13 +++++++++++++ airgun/views/job_invocation.py | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/airgun/entities/job_invocation.py b/airgun/entities/job_invocation.py index 787f81bc2..7a86cdb48 100644 --- a/airgun/entities/job_invocation.py +++ b/airgun/entities/job_invocation.py @@ -103,6 +103,19 @@ def read_dynflow_output(self, entity_name, host_name): self.browser.close_window(self.browser.window_handles[1]) return result + def leapp_fix_inhibitor(self, entity_name, host_name, expected_state='Success'): + """Fix inhibitors in leapp preupgrade report""" + view = self.navigate_to(self, 'Job Status', entity_name=entity_name, host_name=host_name) + view.leapp_preupgrade_report.leapp_report_title.click() + wait_for(lambda: view.leapp_preupgrade_report.fix_selected.is_displayed, timeout=10) + view.leapp_preupgrade_report.fix_selected.click() + wait_for( + lambda: view.overview.read()['job_status'] == expected_state, + timeout=300, + delay=10, + logger=view.logger, + ) + @navigator.register(JobInvocationEntity, 'All') class ShowAllJobs(NavigateStep): diff --git a/airgun/views/job_invocation.py b/airgun/views/job_invocation.py index 630ead307..5dc8c8e52 100644 --- a/airgun/views/job_invocation.py +++ b/airgun/views/job_invocation.py @@ -1,5 +1,5 @@ from wait_for import wait_for -from widgetastic.widget import Text, TextInput, View +from widgetastic.widget import Checkbox, Text, TextInput, View from widgetastic_patternfly import BreadCrumb from widgetastic_patternfly4 import Button, ChipGroup, DescriptionList, Radio, Select from widgetastic_patternfly4.donutchart import DonutCircle, DonutLegend @@ -181,6 +181,17 @@ class overview(SatTab): "//h2[contains(., 'Total hosts')]/span[@class='card-pf-aggregate-status-count']" ) + @View.nested + class leapp_preupgrade_report(SatTab): + ROOT = '//div[@id="content"]//ul/li/a[contains(text(), "Leapp preupgrade report")][@href="#leapp_preupgrade_report"]' + TAB_NAME = 'Leapp preupgrade report' + + leapp_report_title = Checkbox( + locator='//*[@id="preupgrade-report-entries-list-view"]//input[@type="checkbox"]' + ) + fix_selected = Text('//*[@id="leapp_preupgrade_report"]//button[text()="Fix Selected"]') + run_upgrade = Text('//*[@id="leapp_preupgrade_report"]//button[text()="Run Upgrade"]') + def wait_for_result(self, timeout=600, delay=1): """Wait for invocation job to finish""" wait_for(