-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add view/entity for booted container images page (#1745)
* Add view/entity for booted container images page * Clarify which issue the workaround is for (cherry picked from commit 16621d5)
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from airgun.entities.base import BaseEntity | ||
from airgun.navigation import NavigateStep, navigator | ||
from airgun.utils import retry_navigation | ||
from airgun.views.bootc import BootedContainerImagesView | ||
|
||
|
||
class BootcEntity(BaseEntity): | ||
endpoint_path = '/booted_container_images' | ||
|
||
def read(self, booted_image_name): | ||
""" | ||
Read the expanded row of a specific booted_image, returns a tuple | ||
with the unexpanded content, and the expanded content | ||
""" | ||
view = self.navigate_to(self, 'All') | ||
self.browser.plugin.ensure_page_safe(timeout='5s') | ||
# Workaround for SAT-31160 | ||
script = "document.querySelector('tbody').remove();" | ||
self.browser.execute_script(script) | ||
view.search(f"bootc_booted_image = {booted_image_name}") | ||
view.table.row(image_name=booted_image_name).expand() | ||
row = view.table.row(image_name=booted_image_name).read() | ||
row_content = view.table.row(image_name=booted_image_name).content.read() | ||
return (row, row_content['table'][0]) | ||
|
||
|
||
@navigator.register(BootcEntity, 'All') | ||
class BootedImagesScreen(NavigateStep): | ||
"""Navigate to Booted Container Images screen.""" | ||
|
||
VIEW = BootedContainerImagesView | ||
|
||
@retry_navigation | ||
def step(self, *args, **kwargs): | ||
self.view.menu.select('Content', 'Booted Container Images') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from widgetastic.widget import Table, Text, View | ||
from widgetastic_patternfly4.ouia import ExpandableTable | ||
|
||
from airgun.views.common import ( | ||
BaseLoggedInView, | ||
SearchableViewMixinPF4, | ||
) | ||
|
||
|
||
class BootedContainerImagesView(BaseLoggedInView, SearchableViewMixinPF4): | ||
title = Text('.//h1[@data-ouia-component-id="header-text"]') | ||
|
||
# This represents the contents of the expanded table rows | ||
class NestedBootCTable(View): | ||
table = Table( | ||
locator='.//div[@class="pf-c-table__expandable-row-content"]/table', | ||
column_widgets={'Image Digest': Text('./a'), 'Hosts': Text('./a')}, | ||
) | ||
|
||
# Passing in the nested table as content_view, refer to ExpandableTable docs for info | ||
table = ExpandableTable( | ||
component_id='booted-containers-table', | ||
column_widgets={ | ||
'Image Name': Text('./a'), | ||
'Image Digests': Text('./a'), | ||
'Hosts': Text('./a'), | ||
}, | ||
content_view=NestedBootCTable(), | ||
) | ||
|
||
@property | ||
def is_displayed(self): | ||
return self.table.is_displayed |