From f05d9b8da37a609c9e2327edab3b3bd72c2f4647 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Wed, 22 May 2024 19:30:31 +0530 Subject: [PATCH] added new support for feature manifest expires soon (#1385) * added new support for feature manifest expires soon * add & update function from subscription entities * new approach to read manifest expire message and date * update xpath for manage manifest alert message * update xpaths for subscription manager manifest modal box --- airgun/entities/subscription.py | 36 +++++++++++++++++++++++++++++++++ airgun/views/subscription.py | 10 +++++++++ 2 files changed, 46 insertions(+) diff --git a/airgun/entities/subscription.py b/airgun/entities/subscription.py index 6bfe96d64..e499bf1ff 100644 --- a/airgun/entities/subscription.py +++ b/airgun/entities/subscription.py @@ -103,6 +103,42 @@ def read_delete_manifest_message(self): manage_view.close_button.click() return delete_message + def read_subscription_manifest_header_message_and_date(self): + """Read message displayed about 'manifest expiration' at Subscription Manifest section""" + view = self.navigate_to(self, 'Manage Manifest') + view.wait_animation_end() + # Read manifest expiration header & message + if view.manifest.alert_message.is_displayed: + expire_manifest_header = view.manifest.expire_header.read() + expire_manifest_message = view.manifest.expire_message.read() + else: + # Subscription Manifest header & message is not present + raise Exception('Manifest expire alert not found') + # Read manifest expiration date + if view.manifest.expire_date.is_displayed: + expire_manifest_date = view.manifest.expire_date.read() + else: + raise Exception('Manifest expire date not found') + # close opened modal dialogs views + manage_view = ManageManifestView(self.browser) + if manage_view.is_displayed: + manage_view.close_button.click() + return { + 'header': expire_manifest_header, + 'message': expire_manifest_message, + 'date': expire_manifest_date, + } + + def read_subscription_manifest_expiration_date_only(self): + """Returns the expiration date from 'Manage Manifest' modal box""" + view = self.navigate_to(self, 'Manage Manifest') + view.wait_animation_end() + manifest_expiration_date = view.manifest.expire_date.read() + manage_view = ManageManifestView(self.browser) + if manage_view.is_displayed: + manage_view.close_button.click() + return manifest_expiration_date + def add(self, entity_name, quantity=1): """Attach new subscriptions :param entity_name: Name of subscription to attach diff --git a/airgun/views/subscription.py b/airgun/views/subscription.py index 2ce0c29c4..51e0c41d7 100644 --- a/airgun/views/subscription.py +++ b/airgun/views/subscription.py @@ -161,6 +161,16 @@ class ManageManifestView(BaseLoggedInView): @View.nested class manifest(SatTab): + alert_message = Text( + '//div[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' + ) + expire_header = Text('//div[@id="manifest-history-tabs-pane-1"]/div/div/h4') + expire_message = Text( + '//div[@id="manifest-history-tabs-pane-1"]/div/div/h4//following-sibling::div' + ) + expire_date = Text( + '//div[@id="manifest-history-tabs-pane-1"]/div/hr//following-sibling::div[2]/div[2]' + ) red_hat_cdn_url = TextInput(id='cdnUrl') manifest_file = FileInput(id='usmaFile') refresh_button = Button('Refresh')