From 7aa07d5ca62e9a294d57b58ee6ffe151a36e8db3 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 15 Dec 2023 10:31:02 -0600 Subject: [PATCH 1/4] Add versions screen, and capability to search/read all tables --- airgun/entities/contentview_new.py | 29 ++++++++++- airgun/views/contentview_new.py | 78 ++++++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 4 deletions(-) diff --git a/airgun/entities/contentview_new.py b/airgun/entities/contentview_new.py index 469017207..93466e4b9 100644 --- a/airgun/entities/contentview_new.py +++ b/airgun/entities/contentview_new.py @@ -9,6 +9,7 @@ ContentViewCreateView, ContentViewEditView, ContentViewTableView, + ContentViewVersionDetailsView, ContentViewVersionPublishView, CreateFilterView, EditFilterView, @@ -42,12 +43,23 @@ def publish(self, entity_name, values=None): view.fill(values) view.next.click() view.finish.click() - view.progressbar.wait_for_result(delay=0.01) + # view.progressbar.wait_for_result(delay=0.01) view = self.navigate_to(self, 'Edit', entity_name=entity_name) self.browser.plugin.ensure_page_safe(timeout='5s') view.wait_displayed() return view.versions.table.read() + def read_version_table(self, entity_name, version, version_table_name, search_param=None): + """Reads a specific table 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() + # This allows dynamic access to the proper table + getattr(view, version_table_name).table.wait_displayed() + if search_param: + getattr(view, version_table_name).searchbox.search(search_param) + return getattr(view, version_table_name).table.read() + def create_filter(self, entity_name, filter_name, filter_type, filter_inclusion): """Create a new filter on a CV - filter_type should be one of the available dropdown options in the Content Type dropdown, and filter_inclusion should be either 'include' or 'exclude' @@ -182,3 +194,18 @@ def step(self, *args, **kwargs): entity_name = kwargs.get('entity_name') self.parent.search(entity_name) self.parent.table.row(name=entity_name)['Name'].widget.click() + + +@navigator.register(NewContentViewEntity, 'Version') +class ShowContentViewVersionDetails(NavigateStep): + """Navigate to Content View Version screen for a specific Version.""" + + VIEW = ContentViewVersionDetailsView + + def prerequisite(self, *args, **kwargs): + return self.navigate_to(self.obj, 'Edit', **kwargs) + + def step(self, *args, **kwargs): + version = kwargs.get('version') + self.parent.versions.search(version) + self.parent.versions.table.row(version=version)['Version'].widget.click() diff --git a/airgun/views/contentview_new.py b/airgun/views/contentview_new.py index 9415f54ce..f203b0b27 100644 --- a/airgun/views/contentview_new.py +++ b/airgun/views/contentview_new.py @@ -103,7 +103,7 @@ class ContentViewTableView(BaseLoggedInView, SearchableViewMixinPF4): @property def is_displayed(self): - return self.create_content_view.is_displayed() + return self.create_content_view.is_displayed class ContentViewCreateView(BaseLoggedInView): @@ -271,8 +271,80 @@ def before_fill(self, values=None): ) -class NewContentViewVersionDetailsView(BaseLoggedInView): +class ContentViewVersionDetailsView(BaseLoggedInView): breadcrumb = BreadCrumb() + version = Text(locator='.//h2[@data-ouia-component-id="cv-version"]') + promoteButton = PF4Button( + locator='.//button[@data-ouia-component-id="cv-details-publish-button"]' + ) + editDescription = PF4Button( + locator='.//button[@data-ouia-component-id="edit-button-description"]' + ) + + @View.nested + class repositories(Tab): + TAB_LOCATOR = ParametrizedLocator( + './/button[@data-ouia-component-id="cv-version-details-tabs-tab-repositories"]' + ) + searchbox = PF4Search() + table = PatternflyTable( + component_id="content-view-version-details-repositories-table", + column_widgets={ + 'Name': Text('.//a'), + 'Version': Text('.//a'), + 'Release': Text('.//a'), + 'Arch': Text('.//a'), + 'Epoch': Text('.//a'), + }, + ) + + @View.nested + class rpmPackages(Tab): + TAB_LOCATOR = ParametrizedLocator( + './/button[@data-ouia-component-id="cv-version-details-tabs-tab-rpmPackages"]' + ) + searchbox = PF4Search() + table = PatternflyTable( + component_id="content-view-version-details-rpm-packages-table", + column_widgets={ + 'Name': Text('.//a'), + 'Type': Text('.//a'), + 'Product': Text('.//a'), + 'Content': Text('.//a'), + }, + ) + + @View.nested + class rpmPackageGroups(Tab): + TAB_LOCATOR = ParametrizedLocator( + './/button[@data-ouia-component-id="cv-version-details-tabs-tab-rpmPackageGroups"]' + ) + searchbox = PF4Search() + table = PatternflyTable( + component_id="content-view-version-details-rpm-package-groups-table", + column_widgets={ + 'Name': Text('.//a'), + 'Repository': Text('.//a'), + }, + ) + + @View.nested + class errata(Tab): + TAB_LOCATOR = ParametrizedLocator( + './/button[@data-ouia-component-id="cv-version-details-tabs-tab-errata"]' + ) + searchbox = PF4Search() + table = PatternflyTable( + component_id="content-view-version-details-errata-table", + column_widgets={ + 'Errata ID': Text('.//a'), + 'Title': Text('.//a'), + 'Type': Text('.//a'), + 'Modular': Text('.//a'), + 'Applicable Content Hosts': Text('.//a'), + 'Updated': Text('.//a'), + }, + ) @property def is_displayed(self): @@ -280,7 +352,7 @@ def is_displayed(self): return ( breadcrumb_loaded and len(self.breadcrumb.locations) > LOCATION_NUM - and self.breadcrumb.locations[0] == 'Content Views' + and self.breadcrumb.locations[0] == 'Content views' and self.breadcrumb.locations[2] == 'Versions' ) From c1ff6695825d88662e12f45eaa10e6584eef708d Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 3 May 2024 10:08:54 -0500 Subject: [PATCH 2/4] Change field name and remove commented field --- airgun/entities/contentview_new.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/airgun/entities/contentview_new.py b/airgun/entities/contentview_new.py index 93466e4b9..6007da6c0 100644 --- a/airgun/entities/contentview_new.py +++ b/airgun/entities/contentview_new.py @@ -43,22 +43,21 @@ def publish(self, entity_name, values=None): view.fill(values) view.next.click() view.finish.click() - # view.progressbar.wait_for_result(delay=0.01) view = self.navigate_to(self, 'Edit', entity_name=entity_name) self.browser.plugin.ensure_page_safe(timeout='5s') view.wait_displayed() return view.versions.table.read() - def read_version_table(self, entity_name, version, version_table_name, search_param=None): + def read_version_table(self, entity_name, version, tab_name, search_param=None): """Reads a specific table 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() # This allows dynamic access to the proper table - getattr(view, version_table_name).table.wait_displayed() + getattr(view, tab_name).table.wait_displayed() if search_param: - getattr(view, version_table_name).searchbox.search(search_param) - return getattr(view, version_table_name).table.read() + getattr(view, tab_name).searchbox.search(search_param) + return getattr(view, tab_name).table.read() def create_filter(self, entity_name, filter_name, filter_type, filter_inclusion): """Create a new filter on a CV - filter_type should be one of the available dropdown options From 62b95b9b47f31258ffc0c3f368616c15b2c76186 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 10 May 2024 09:22:31 -0500 Subject: [PATCH 3/4] Better locator for versions tab --- airgun/views/contentview_new.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/airgun/views/contentview_new.py b/airgun/views/contentview_new.py index f203b0b27..c1cc50ab2 100644 --- a/airgun/views/contentview_new.py +++ b/airgun/views/contentview_new.py @@ -165,7 +165,9 @@ class details(Tab): @View.nested class versions(Tab): - TAB_LOCATOR = ParametrizedLocator('//a[contains(@href, "#/versions")]') + TAB_LOCATOR = ParametrizedLocator( + '//a[contains(@href, "#/versions") and @data-ouia-component-id="routed-tabs-tab-versions"]' + ) searchbox = PF4Search() table = PatternflyTable( component_id="content-view-versions-table", From 494c4894d46b98c5e33b7e5c7858fba05439b51f Mon Sep 17 00:00:00 2001 From: Samuel Bible Date: Mon, 3 Jun 2024 00:17:04 -0500 Subject: [PATCH 4/4] Apply suggestions from code review Use single quotation instead of double Co-authored-by: vijay sawant --- airgun/views/contentview_new.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airgun/views/contentview_new.py b/airgun/views/contentview_new.py index c1cc50ab2..c6db5fbdb 100644 --- a/airgun/views/contentview_new.py +++ b/airgun/views/contentview_new.py @@ -307,7 +307,7 @@ class rpmPackages(Tab): ) searchbox = PF4Search() table = PatternflyTable( - component_id="content-view-version-details-rpm-packages-table", + component_id='content-view-version-details-rpm-packages-table', column_widgets={ 'Name': Text('.//a'), 'Type': Text('.//a'), @@ -323,7 +323,7 @@ class rpmPackageGroups(Tab): ) searchbox = PF4Search() table = PatternflyTable( - component_id="content-view-version-details-rpm-package-groups-table", + component_id='content-view-version-details-rpm-package-groups-table', column_widgets={ 'Name': Text('.//a'), 'Repository': Text('.//a'), @@ -337,7 +337,7 @@ class errata(Tab): ) searchbox = PF4Search() table = PatternflyTable( - component_id="content-view-version-details-errata-table", + component_id='content-view-version-details-errata-table', column_widgets={ 'Errata ID': Text('.//a'), 'Title': Text('.//a'),