Skip to content

Commit

Permalink
CV UI - Add versions screen, and capability to search/read all tables (
Browse files Browse the repository at this point in the history
…#1083)

* Add versions screen, and capability to search/read all tables

* Change field name and remove commented field

* Better locator for versions tab

* Apply suggestions from code review

Use single quotation instead of double

Co-authored-by: vijay sawant <[email protected]>

---------

Co-authored-by: vijay sawant <[email protected]>
  • Loading branch information
sambible and vijaysawant authored Jun 3, 2024
1 parent 25be8ca commit b649a9d
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 5 deletions.
28 changes: 27 additions & 1 deletion airgun/entities/contentview_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ContentViewCreateView,
ContentViewEditView,
ContentViewTableView,
ContentViewVersionDetailsView,
ContentViewVersionPublishView,
CreateFilterView,
EditFilterView,
Expand Down Expand Up @@ -42,12 +43,22 @@ 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, 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, tab_name).table.wait_displayed()
if search_param:
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
in the Content Type dropdown, and filter_inclusion should be either 'include' or 'exclude'
Expand Down Expand Up @@ -182,3 +193,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()
82 changes: 78 additions & 4 deletions airgun/views/contentview_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -271,16 +273,88 @@ 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):
breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False)
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'
)

Expand Down

0 comments on commit b649a9d

Please sign in to comment.