From adf534cb7139b85e68379bd4cafff53d7b574c79 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Thu, 9 May 2024 00:05:40 +0530 Subject: [PATCH 1/5] added new support for feature manifest expires soon --- airgun/entities/subscription.py | 14 ++++++++++++++ airgun/views/subscription.py | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/airgun/entities/subscription.py b/airgun/entities/subscription.py index 76c1009ec..625214ea7 100644 --- a/airgun/entities/subscription.py +++ b/airgun/entities/subscription.py @@ -103,6 +103,20 @@ def read_delete_manifest_message(self): manage_view.close_button.click() return delete_message + def read_expire_manifest_message(self): # new changes + """Read message displayed about 'manifest expiration' at Subscription Manifest section""" + view = self.navigate_to(self, 'Manage Manifest') + view.wait_animation_end() + if not view.manifest_alert.is_displayed: + return None + expire_manifest_header = view.manifest_expire_header.read() + expire_manifest_message = view.manifest_expire_message.read() + # close opened modal dialogs views + manage_view = ManageManifestView(self.browser) + if manage_view.is_displayed: + manage_view.close_button.click() + return expire_manifest_header, expire_manifest_message + 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 ec0b23b27..a0d8b598f 100644 --- a/airgun/views/subscription.py +++ b/airgun/views/subscription.py @@ -154,6 +154,13 @@ def is_searchable(self): class ManageManifestView(BaseLoggedInView): ROOT = '//div[@role="dialog" and @tabindex][div//h4[normalize-space(.)="Manage Manifest"]]' + manifest_alert = Text( + '//*[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' + ) + manifest_expire_header = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/h4') + manifest_expire_message = Text( + '//*[@id="manifest-history-tabs-pane-1"]//following::div/div[2]/span' + ) close_button = Button('Close') @View.nested From ec49025993c6f027dd764343ee794a9108db5f01 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Thu, 9 May 2024 16:50:20 +0530 Subject: [PATCH 2/5] add & update function from subscription entities --- airgun/entities/subscription.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/airgun/entities/subscription.py b/airgun/entities/subscription.py index 625214ea7..ed4bb01e8 100644 --- a/airgun/entities/subscription.py +++ b/airgun/entities/subscription.py @@ -103,14 +103,18 @@ def read_delete_manifest_message(self): manage_view.close_button.click() return delete_message - def read_expire_manifest_message(self): # new changes + def read_expire_manifest_message(self): """Read message displayed about 'manifest expiration' at Subscription Manifest section""" + expire_manifest_header = None + expire_manifest_message = None view = self.navigate_to(self, 'Manage Manifest') view.wait_animation_end() - if not view.manifest_alert.is_displayed: - return None - expire_manifest_header = view.manifest_expire_header.read() - expire_manifest_message = view.manifest_expire_message.read() + if view.manifest_alert.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 + expire_manifest_message = 'Manifest expire alert not found' # close opened modal dialogs views manage_view = ManageManifestView(self.browser) if manage_view.is_displayed: From f5c286330533b93bb6caa025940d534664193243 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Mon, 13 May 2024 23:33:20 +0530 Subject: [PATCH 3/5] new approach to read manifest expire message and date --- airgun/entities/subscription.py | 35 +++++++++++++++++++++++++-------- airgun/views/subscription.py | 13 ++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/airgun/entities/subscription.py b/airgun/entities/subscription.py index ed4bb01e8..c18ee5841 100644 --- a/airgun/entities/subscription.py +++ b/airgun/entities/subscription.py @@ -103,23 +103,42 @@ def read_delete_manifest_message(self): manage_view.close_button.click() return delete_message - def read_expire_manifest_message(self): + def read_subscription_manifest_header_message_and_date(self): """Read message displayed about 'manifest expiration' at Subscription Manifest section""" - expire_manifest_header = None - expire_manifest_message = None view = self.navigate_to(self, 'Manage Manifest') view.wait_animation_end() - if view.manifest_alert.is_displayed: - expire_manifest_header = view.manifest_expire_header.read() - expire_manifest_message = view.manifest_expire_message.read() + # 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 - expire_manifest_message = 'Manifest expire alert not found' + 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: + # Subscription Manifest expire date is not present + 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 expire_manifest_header, expire_manifest_message + 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 diff --git a/airgun/views/subscription.py b/airgun/views/subscription.py index a0d8b598f..87e315cda 100644 --- a/airgun/views/subscription.py +++ b/airgun/views/subscription.py @@ -154,17 +154,16 @@ def is_searchable(self): class ManageManifestView(BaseLoggedInView): ROOT = '//div[@role="dialog" and @tabindex][div//h4[normalize-space(.)="Manage Manifest"]]' - manifest_alert = Text( - '//*[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' - ) - manifest_expire_header = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/h4') - manifest_expire_message = Text( - '//*[@id="manifest-history-tabs-pane-1"]//following::div/div[2]/span' - ) close_button = Button('Close') @View.nested class manifest(SatTab): + alert_message = Text( + '//*[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' + ) + expire_header = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/h4') + expire_message = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/div[2]/span') + expire_date = Text('//*[@id="manifest-history-tabs-pane-1"]/div[1]/div[3]/div[2]') red_hat_cdn_url = TextInput(id='cdnUrl') manifest_file = FileInput(id='usmaFile') refresh_button = Button('Refresh') From d1659521e25682952629a21143330cad2f333b93 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Mon, 20 May 2024 23:01:46 +0530 Subject: [PATCH 4/5] update xpath for manage manifest alert message --- airgun/entities/subscription.py | 1 - airgun/views/subscription.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/airgun/entities/subscription.py b/airgun/entities/subscription.py index c18ee5841..78f607f7d 100644 --- a/airgun/entities/subscription.py +++ b/airgun/entities/subscription.py @@ -118,7 +118,6 @@ def read_subscription_manifest_header_message_and_date(self): if view.manifest.expire_date.is_displayed: expire_manifest_date = view.manifest.expire_date.read() else: - # Subscription Manifest expire date is not present raise Exception('Manifest expire date not found') # close opened modal dialogs views manage_view = ManageManifestView(self.browser) diff --git a/airgun/views/subscription.py b/airgun/views/subscription.py index 87e315cda..f93c491da 100644 --- a/airgun/views/subscription.py +++ b/airgun/views/subscription.py @@ -159,11 +159,11 @@ class ManageManifestView(BaseLoggedInView): @View.nested class manifest(SatTab): alert_message = Text( - '//*[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' + '//div[@id="manifest-history-tabs-pane-1"]/div/h3//following-sibling::div[@aria-label="Warning Alert" or @aria-label="Danger Alert"]' ) - expire_header = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/h4') - expire_message = Text('//*[@id="manifest-history-tabs-pane-1"]//following::div/div[2]/span') - expire_date = Text('//*[@id="manifest-history-tabs-pane-1"]/div[1]/div[3]/div[2]') + expire_header = Text('//div[@id="manifest-history-tabs-pane-1"]//following::div/h4') + expire_message = Text('//div[@id="manifest-history-tabs-pane-1"]//following::div[1]/div[2]/span') + expire_date = Text('//div[@id="manifest-history-tabs-pane-1"]/div[1]/div[3]/div[2]') red_hat_cdn_url = TextInput(id='cdnUrl') manifest_file = FileInput(id='usmaFile') refresh_button = Button('Refresh') From 763de085b2204279bc043f94f46dfe617855ffdf Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Tue, 21 May 2024 17:23:28 +0530 Subject: [PATCH 5/5] update xpaths for subscription manager manifest modal box --- airgun/views/subscription.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/airgun/views/subscription.py b/airgun/views/subscription.py index f93c491da..14a38a3d0 100644 --- a/airgun/views/subscription.py +++ b/airgun/views/subscription.py @@ -161,9 +161,13 @@ 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"]//following::div/h4') - expire_message = Text('//div[@id="manifest-history-tabs-pane-1"]//following::div[1]/div[2]/span') - expire_date = Text('//div[@id="manifest-history-tabs-pane-1"]/div[1]/div[3]/div[2]') + 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')