From 1ba0f302bc4b5242e8d003e49041b0c5e33b5c34 Mon Sep 17 00:00:00 2001 From: Samuel Bible Date: Thu, 12 Dec 2024 02:00:38 -0600 Subject: [PATCH] add support for versions dropdown (#1411) * add support for versions dropdown * Move error checking logic into airgun, and add method to contain it * Add better is_displayed logic and call it in function * Remove pytest reference and change is_displayed --- airgun/entities/contentview_new.py | 20 ++++++++++++++++++++ airgun/views/contentview_new.py | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/airgun/entities/contentview_new.py b/airgun/entities/contentview_new.py index 0194e9c6f..defdbe2d0 100644 --- a/airgun/entities/contentview_new.py +++ b/airgun/entities/contentview_new.py @@ -3,6 +3,7 @@ from navmazing import NavigateToSibling from widgetastic.exceptions import NoSuchElementException +from widgetastic_patternfly4.dropdown import DropdownItemDisabled from airgun.entities.base import BaseEntity from airgun.navigation import NavigateStep, navigator @@ -229,6 +230,25 @@ def read_french_lang_cv(self): view.wait_displayed() return view.table.read() + def click_version_dropdown(self, entity_name, version, dropdown_option): + """Clicks a specific dropdown option for a CV Version""" + view = self.navigate_to(self, 'Version', entity_name=entity_name, version=version) + self.browser.plugin.ensure_page_safe(timeout='5s') + view.wait_displayed() + return view.version_dropdown.item_select(dropdown_option) + + def republish_metadata_error(self, entity_name, version): + """Clicks a specific dropdown option for a CV Version, that will throw an error""" + view = self.navigate_to(self, 'Version', entity_name=entity_name, version=version) + self.browser.plugin.ensure_page_safe(timeout='5s') + view.wait_displayed() + try: + view.version_dropdown.item_select('Republish repository metadata') + except DropdownItemDisabled as error: + if 'Item "Republish repository metadata"' and 'is disabled' in error.args[0]: + return True + return 'No error was found, metadata unexpectedly was able to be published.' + def promote(self, entity_name, version_name, lce_name): """Promotes the selected version of content view to given environment. :return: dict with new content view version table row; contains keys diff --git a/airgun/views/contentview_new.py b/airgun/views/contentview_new.py index 19dddc80f..3e826e62a 100644 --- a/airgun/views/contentview_new.py +++ b/airgun/views/contentview_new.py @@ -268,6 +268,9 @@ class ContentViewVersionDetailsView(BaseLoggedInView): promoteButton = PF4Button( locator='.//button[@data-ouia-component-id="cv-details-publish-button"]' ) + version_dropdown = Dropdown( + locator='.//div[@data-ouia-component-id="cv-version-header-actions-dropdown"]' + ) editDescription = PF4Button( locator='.//button[@data-ouia-component-id="edit-button-description"]' ) @@ -347,8 +350,10 @@ class errata(Tab): @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) + title_loaded = self.browser.wait_for_element(self.version, exception=False) return ( breadcrumb_loaded + and title_loaded and len(self.breadcrumb.locations) > LOCATION_NUM and self.breadcrumb.locations[0] == 'Content views' and self.breadcrumb.locations[2] == 'Versions'