|
| 1 | +from airgun.entities.base import BaseEntity |
| 2 | +from airgun.navigation import NavigateStep, navigator |
| 3 | +from airgun.utils import retry_navigation |
| 4 | +from airgun.views.bootc import BootedContainerImagesView |
| 5 | + |
| 6 | + |
| 7 | +class BootcEntity(BaseEntity): |
| 8 | + endpoint_path = '/booted_container_images' |
| 9 | + |
| 10 | + def read(self, booted_image_name): |
| 11 | + """ |
| 12 | + Read the expanded row of a specific booted_image, returns a tuple |
| 13 | + with the unexpanded content, and the expanded content |
| 14 | + """ |
| 15 | + view = self.navigate_to(self, 'All') |
| 16 | + self.browser.plugin.ensure_page_safe(timeout='5s') |
| 17 | + # Workaround for SAT-31160 |
| 18 | + script = "document.querySelector('tbody').remove();" |
| 19 | + self.browser.execute_script(script) |
| 20 | + view.search(f"bootc_booted_image = {booted_image_name}") |
| 21 | + view.table.row(image_name=booted_image_name).expand() |
| 22 | + row = view.table.row(image_name=booted_image_name).read() |
| 23 | + row_content = view.table.row(image_name=booted_image_name).content.read() |
| 24 | + return (row, row_content['table'][0]) |
| 25 | + |
| 26 | + |
| 27 | +@navigator.register(BootcEntity, 'All') |
| 28 | +class BootedImagesScreen(NavigateStep): |
| 29 | + """Navigate to Booted Container Images screen.""" |
| 30 | + |
| 31 | + VIEW = BootedContainerImagesView |
| 32 | + |
| 33 | + @retry_navigation |
| 34 | + def step(self, *args, **kwargs): |
| 35 | + self.view.menu.select('Content', 'Booted Container Images') |
0 commit comments