Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CV UI - Add versions screen, and capability to search/read all tables #1083

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
sambible marked this conversation as resolved.
Show resolved Hide resolved
78 changes: 75 additions & 3 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 @@ -271,16 +271,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",
sambible marked this conversation as resolved.
Show resolved Hide resolved
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",
sambible marked this conversation as resolved.
Show resolved Hide resolved
column_widgets={
'Name': Text('.//a'),
'Type': Text('.//a'),
'Product': Text('.//a'),
'Content': Text('.//a'),
},
)

@View.nested
class rpmPackageGroups(Tab):
omkarkhatavkar marked this conversation as resolved.
Show resolved Hide resolved
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",
sambible marked this conversation as resolved.
Show resolved Hide resolved
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",
sambible marked this conversation as resolved.
Show resolved Hide resolved
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