From 65065f532a9605bbd0c63fdff718c31ae12afbb0 Mon Sep 17 00:00:00 2001 From: Vladimir Sedmik Date: Fri, 25 Oct 2024 16:02:52 +0200 Subject: [PATCH 1/4] Add new Refresh button in capsule content --- airgun/entities/capsule.py | 18 +++++++++++++----- airgun/views/capsule.py | 7 ++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/airgun/entities/capsule.py b/airgun/entities/capsule.py index c3e711666..019179b64 100644 --- a/airgun/entities/capsule.py +++ b/airgun/entities/capsule.py @@ -281,12 +281,14 @@ def complete_sync(self, capsule_name): self.sync(capsule_name, 'Complete Sync') - def refresh_lce_counts(self, capsule_name, lce_name): + def refresh_lce_counts(self, capsule_name, lce_name, cv_name=None): """ - Function that refreshes LCE counts of given capsule + Function that refreshes the content counts of given capsule Args: capsule_name (str): Name of capsule to be refreshed + lce_name (str): Name of LCE to be refreshed + cv_name (str, optional): Name of CV within LCE to be refreshed only """ view = self.navigate_to(self, 'Capsules') @@ -294,9 +296,15 @@ def refresh_lce_counts(self, capsule_name, lce_name): view.table.row(name=capsule_name)['Name'].click() view = CapsuleDetailsView(self.browser) view.wait_displayed() - view.content.top_content_table.row(Environment=lce_name)[3].widget.item_select( - 'Refresh counts' - ) + if not cv_name: + view.content.top_content_table.row(Environment=lce_name)[3].widget.item_select( + 'Refresh counts' + ) + else: + view.content.top_content_table.row(Environment=lce_name)[0].click() + view.content.mid_content_table.row(content_view=cv_name)[5].widget.item_select( + 'Refresh counts' + ) @navigator.register(CapsuleEntity, 'Capsules') diff --git a/airgun/views/capsule.py b/airgun/views/capsule.py index c96e817a2..0946a2330 100644 --- a/airgun/views/capsule.py +++ b/airgun/views/capsule.py @@ -186,7 +186,12 @@ class content(SatTab): mid_content_table = ExpandableTable( component_id='expandable-content-views', column_widgets={ - 'cv_info_list': ItemsList(locator='//ul'), + 0: Button(locator='./button[@aria-label="Details"]'), + 'Content view': Text('./span/a'), + 'Version': Text('./a'), + 'Last published': Text('./span'), + 'Synced': Text('./svg'), + 5: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) From 7c441d79a087b01efae36bfc2cceb12db661145a Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:25:50 +0100 Subject: [PATCH 2/4] Remove Purpose addons from airgun code --- airgun/views/contenthost.py | 2 -- airgun/views/host_new.py | 2 -- airgun/widgets.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/airgun/views/contenthost.py b/airgun/views/contenthost.py index 50f54bbf4..e670f045d 100644 --- a/airgun/views/contenthost.py +++ b/airgun/views/contenthost.py @@ -29,7 +29,6 @@ ConfirmationDialog, EditableEntry, EditableEntryCheckbox, - EditableEntryMultiCheckbox, EditableEntrySelect, Pagination, ReadOnlyEntry, @@ -147,7 +146,6 @@ class details(SatTab): service_level = EditableEntrySelect(name='Service Level (SLA)') usage_type = EditableEntrySelect(name='Usage Type') role = EditableEntrySelect(name='Role') - addons = EditableEntryMultiCheckbox(name='Add ons') # Content Host Properties os = ReadOnlyEntry( locator=".//dt[.='OS']/following-sibling::dd[not(contains(@class, 'ng-hide'))]" diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index 6632386be..6f7640096 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -16,7 +16,6 @@ ExpandableTable, FormSelect as OUIAFormSelect, PatternflyTable, - Select as OUIASelect, ) from airgun.views.common import BaseLoggedInView @@ -772,7 +771,6 @@ class EditSystemPurposeView(View): sla = OUIAFormSelect('service-level-select') usage = OUIAFormSelect('usage-select') release_version = OUIAFormSelect('release-version-select') - add_ons = OUIASelect('syspurpose-addons-select') save = OUIAButton('save-syspurpose') cancel = OUIAButton('cancel-syspurpose') diff --git a/airgun/widgets.py b/airgun/widgets.py index 98093feb9..39616aa73 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -1685,7 +1685,7 @@ def fill(self, values): """Check or uncheck one of the checkboxes :param value: string with specification of fields' values - Example: value={'details.addons': {'Test addon 1': True, 'Test addon 2': False}} + Example: value={'details.role': {'Test role 1': True, 'Test role 2': False}} """ for name, value in values.items(): self.checkboxes[name].fill(value) From c94c24e0e186ed487353196945332d8ca1c02147 Mon Sep 17 00:00:00 2001 From: Lukas Hellebrandt Date: Tue, 10 Dec 2024 15:07:00 +0100 Subject: [PATCH 3/4] Template editor error widget --- airgun/views/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/airgun/views/common.py b/airgun/views/common.py index e09166c4b..355a51e11 100644 --- a/airgun/views/common.py +++ b/airgun/views/common.py @@ -539,6 +539,7 @@ class TemplateEditor(View): rendering_options = ItemsList(".//div[contains(@class,'navbar-editor')]/ul") import_template = Button(id='import-btn') fullscreen = Button(id='fullscreen-btn') + error = Text(".//div[@id='preview_error_toast']") editor = ACEEditor() From 1ba0f302bc4b5242e8d003e49041b0c5e33b5c34 Mon Sep 17 00:00:00 2001 From: Samuel Bible Date: Thu, 12 Dec 2024 02:00:38 -0600 Subject: [PATCH 4/4] 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'