From 39f73c63fc812e0284ffcb947cb3ce533f056da7 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Tue, 6 Feb 2024 10:42:09 +0100 Subject: [PATCH] pf4 bookmarks dropdown (#1200) --- airgun/views/capsule.py | 1 - airgun/views/computeresource.py | 9 +++++++-- airgun/views/dashboard.py | 7 +++---- airgun/views/discoveryrule.py | 4 ++-- airgun/views/package.py | 7 ++++++- airgun/views/repository.py | 8 ++++++-- airgun/views/subnet.py | 11 ++++++++--- airgun/widgets.py | 4 +++- 8 files changed, 35 insertions(+), 16 deletions(-) diff --git a/airgun/views/capsule.py b/airgun/views/capsule.py index 07694d435..2e45588c4 100644 --- a/airgun/views/capsule.py +++ b/airgun/views/capsule.py @@ -262,7 +262,6 @@ class CapsulesView(BaseLoggedInView, SearchableViewMixinPF4): 'Actions': ActionsDropdown('./div[contains(@class, "btn-group")]'), }, ) - pagination = Pagination() @property diff --git a/airgun/views/computeresource.py b/airgun/views/computeresource.py index eb13f4cee..e7f10e28e 100644 --- a/airgun/views/computeresource.py +++ b/airgun/views/computeresource.py @@ -11,7 +11,12 @@ ) from widgetastic_patternfly import BreadCrumb -from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixin +from airgun.views.common import ( + BaseLoggedInView, + SatTab, + SearchableViewMixin, + SearchableViewMixinPF4, +) from airgun.views.host import HostCreateView from airgun.widgets import ( ActionsDropdown, @@ -24,7 +29,7 @@ ) -class ComputeResourcesView(BaseLoggedInView, SearchableViewMixin): +class ComputeResourcesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text('//*[(self::h1 or self::h5) and normalize-space(.)="Compute Resources"]') new = Text('//a[normalize-space(.)="Create Compute Resource"]') table = SatTable( diff --git a/airgun/views/dashboard.py b/airgun/views/dashboard.py index 5c805bdfe..26b079ab1 100644 --- a/airgun/views/dashboard.py +++ b/airgun/views/dashboard.py @@ -1,7 +1,7 @@ from widgetastic.widget import Table, Text, View, Widget -from airgun.views.common import BaseLoggedInView, SatTable -from airgun.widgets import ActionsDropdown, PieChart, Search +from airgun.views.common import BaseLoggedInView, SatTable, SearchableViewMixinPF4 +from airgun.widgets import ActionsDropdown, PieChart class ItemValueList(Widget): @@ -71,11 +71,10 @@ def fill(self, value): self.browser.element(self.AUTO_REFRESH).click() -class DashboardView(BaseLoggedInView): +class DashboardView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Overview']") manage = ActionsDropdown("//div[@class='btn-group']") refresh = AutoRefresh() - searchbox = Search() @property def is_displayed(self): diff --git a/airgun/views/discoveryrule.py b/airgun/views/discoveryrule.py index d0d9410ef..0e1bab4b1 100644 --- a/airgun/views/discoveryrule.py +++ b/airgun/views/discoveryrule.py @@ -2,7 +2,7 @@ from widgetastic_patternfly import BreadCrumb from widgetastic_patternfly4 import Button as PF4Button -from airgun.views.common import BaseLoggedInView, SatTab +from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4 from airgun.widgets import ( ActionsDropdown, AutoCompleteTextInput, @@ -12,7 +12,7 @@ ) -class DiscoveryRulesView(BaseLoggedInView): +class DiscoveryRulesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Discovery Rules']") new = Text("//a[contains(@href, '/discovery_rules/new')]") new_on_blank_page = PF4Button('Create Rule') diff --git a/airgun/views/package.py b/airgun/views/package.py index 2a5e54198..0f795ce01 100644 --- a/airgun/views/package.py +++ b/airgun/views/package.py @@ -1,7 +1,12 @@ from widgetastic.widget import Checkbox, Select, Text, View from widgetastic_patternfly import BreadCrumb -from airgun.views.common import BaseLoggedInView, ReadOnlyEntry, SatTab, SatTable +from airgun.views.common import ( + BaseLoggedInView, + ReadOnlyEntry, + SatTab, + SatTable, +) from airgun.widgets import ItemsListReadOnly, Search diff --git a/airgun/views/repository.py b/airgun/views/repository.py index 3c82c85a9..8e805195e 100644 --- a/airgun/views/repository.py +++ b/airgun/views/repository.py @@ -9,7 +9,11 @@ ) from widgetastic_patternfly import BreadCrumb -from airgun.views.common import BaseLoggedInView, SearchableViewMixin +from airgun.views.common import ( + BaseLoggedInView, + SearchableViewMixin, + SearchableViewMixinPF4, +) from airgun.widgets import ( ActionsDropdown, ConfirmationDialog, @@ -22,7 +26,7 @@ ) -class RepositoriesView(BaseLoggedInView, SearchableViewMixin): +class RepositoriesView(BaseLoggedInView, SearchableViewMixinPF4): breadcrumb = BreadCrumb() new = Text("//button[contains(@href, '/repositories/new')]") sync = Text("//button[contains(@ng-click, 'syncSelectedRepositories')]") diff --git a/airgun/views/subnet.py b/airgun/views/subnet.py index aa104ba5d..7246cb268 100644 --- a/airgun/views/subnet.py +++ b/airgun/views/subnet.py @@ -1,11 +1,16 @@ from widgetastic.widget import Table, Text, TextInput, View from widgetastic_patternfly import BreadCrumb -from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixin -from airgun.widgets import CustomParameter, FilteredDropdown, MultiSelect, RadioGroup +from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4 +from airgun.widgets import ( + CustomParameter, + FilteredDropdown, + MultiSelect, + RadioGroup, +) -class SubnetsView(BaseLoggedInView, SearchableViewMixin): +class SubnetsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text('//*[(self::h1 or self::h5) and normalize-space(.)="Subnets"]') new = Text('//a[normalize-space(.)="Create Subnet"]') table = Table( diff --git a/airgun/widgets.py b/airgun/widgets.py index de9d59a4c..85608e977 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -629,7 +629,7 @@ class ActionsDropdown(GenericLocatorWidget): "contains(@ng-click, 'toggleDropdown')][contains(@class, 'btn')]" "[*[self::span or self::i][contains(@class, 'caret')]]" ) - pf4_drop_down = Dropdown('OUIA-Generated-Dropdown-2') + pf4_drop_down = Text("//div[contains(@data-ouia-component-id, 'bookmarks-dropdown')]") button = Text( ".//*[self::button or self::span][contains(@class, 'btn') or " "contains(@aria-label, 'search button')]" @@ -819,6 +819,8 @@ class PF4Search(Search): search_button = Text(locator=(".//button[@aria-label='Search']")) clear_button = Text(locator=(".//button[@aria-label='Reset search']")) + actions = ActionsDropdown("//div[contains(@data-ouia-component-id, 'bookmarks-dropdown')]") + def clear(self): """Clears search field value and re-trigger search to remove all filters.