From 19c10fb10a4fd25459dd61e22e4f60fbf2313323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Strelec?= Date: Thu, 17 Aug 2023 15:14:45 +0200 Subject: [PATCH] [6.12.z] update Search widgets to PF4 class (#913) (#932) * update Search widgets to PF4 class (#913) * update locators for 6.12 --- airgun/views/ansible_variable.py | 4 ++-- airgun/views/architecture.py | 4 ++-- airgun/views/audit.py | 11 +++-------- airgun/views/bookmark.py | 4 ++-- airgun/views/cloud_insights.py | 26 +++----------------------- airgun/views/common.py | 3 ++- airgun/views/computeprofile.py | 4 ++-- airgun/views/domain.py | 4 ++-- airgun/views/hardware_model.py | 4 ++-- airgun/views/host.py | 4 ++-- airgun/views/hostgroup.py | 4 ++-- airgun/views/job_template.py | 4 ++-- airgun/views/location.py | 4 ++-- airgun/views/media.py | 4 ++-- airgun/views/modulestream.py | 25 ++----------------------- airgun/views/organization.py | 4 ++-- airgun/views/os.py | 4 ++-- airgun/views/oscapcontent.py | 4 ++-- airgun/views/partitiontable.py | 4 ++-- airgun/views/provisioning_template.py | 4 ++-- airgun/views/report_template.py | 4 ++-- airgun/views/role.py | 4 ++-- airgun/views/settings.py | 4 ++-- airgun/views/task.py | 4 ++-- airgun/views/user.py | 4 ++-- airgun/views/usergroup.py | 4 ++-- airgun/widgets.py | 14 ++++++-------- 27 files changed, 60 insertions(+), 107 deletions(-) diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index 0f4b446ce..a9cd3b45b 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -7,14 +7,14 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTable -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import CustomParameter from airgun.widgets import FilteredDropdown from airgun.widgets import Pagination from airgun.widgets import SatSelect -class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixin): +class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixinPF4): """Main Ansible Variables view""" title = Text("//h1[contains(normalize-space(.),'Ansible Variables')]") diff --git a/airgun/views/architecture.py b/airgun/views/architecture.py index 18ada2d0b..2788ea629 100644 --- a/airgun/views/architecture.py +++ b/airgun/views/architecture.py @@ -4,11 +4,11 @@ from widgetastic_patternfly import BreadCrumb from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import MultiSelect -class ArchitecturesView(BaseLoggedInView, SearchableViewMixin): +class ArchitecturesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Architectures']") new = Text("//a[contains(@href, '/architectures/new')]") table = Table( diff --git a/airgun/views/audit.py b/airgun/views/audit.py index f3dc307db..789328a51 100644 --- a/airgun/views/audit.py +++ b/airgun/views/audit.py @@ -3,8 +3,8 @@ from airgun.exceptions import ReadOnlyWidgetError from airgun.views.common import BaseLoggedInView +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import SatTableWithoutHeaders -from airgun.widgets import Search class AuditEntry(View): @@ -38,15 +38,10 @@ def fill(self, values): raise ReadOnlyWidgetError('View is read only, fill is prohibited') -class AuditsView(BaseLoggedInView): +class AuditsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Audits']") - searchbox = Search() - entry = AuditEntry() + table = AuditEntry() @property def is_displayed(self): return self.browser.wait_for_element(self.title, exception=False) is not None - - def search(self, query): - self.searchbox.search(query) - return self.entry.read() diff --git a/airgun/views/bookmark.py b/airgun/views/bookmark.py index d9291c5aa..4f306d1c4 100644 --- a/airgun/views/bookmark.py +++ b/airgun/views/bookmark.py @@ -4,11 +4,11 @@ from widgetastic_patternfly import BreadCrumb from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import SatTable -class BookmarksView(BaseLoggedInView, SearchableViewMixin): +class BookmarksView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Bookmarks']") table = SatTable( ".//table", diff --git a/airgun/views/cloud_insights.py b/airgun/views/cloud_insights.py index 4a4254f1f..1cfd7da43 100644 --- a/airgun/views/cloud_insights.py +++ b/airgun/views/cloud_insights.py @@ -1,4 +1,3 @@ -from selenium.webdriver.common.keys import Keys from widgetastic.widget import Checkbox from widgetastic.widget import Text from widgetastic.widget import TextInput @@ -11,7 +10,7 @@ from widgetastic_patternfly4.ouia import Switch from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 class CloudTokenView(BaseLoggedInView): @@ -46,7 +45,7 @@ def is_displayed(self): return self.title.wait_displayed() -class CloudInsightsView(BaseLoggedInView, SearchableViewMixin): +class CloudInsightsView(BaseLoggedInView, SearchableViewMixinPF4): """Main RH Cloud Insights view.""" title = Text('//h1[normalize-space(.)="Red Hat Insights"]') @@ -71,23 +70,4 @@ class CloudInsightsView(BaseLoggedInView, SearchableViewMixin): @property def is_displayed(self): - return self.title.wait_displayed() - - def search(self, query): - """Perform search using searchbox on the page and return table - contents. - - :param str query: search query to type into search field. E.g. ``foo`` - or ``name = "bar"``. - :return: list of dicts representing table rows - :rtype: list - """ - if not hasattr(self.__class__, 'table'): - raise AttributeError( - f'Class {self.__class__.__name__} does not have attribute "table". ' - 'SearchableViewMixin only works with views, which have table for results. ' - 'Please define table or use custom search implementation instead' - ) - self.searchbox.search(query + Keys.ENTER) - self.table.wait_displayed() - return self.table.read() + return self.browser.wait_for_element(self.title, exception=False) is not None diff --git a/airgun/views/common.py b/airgun/views/common.py index 7154a2ceb..4f787c5d2 100644 --- a/airgun/views/common.py +++ b/airgun/views/common.py @@ -442,7 +442,7 @@ def search(self, query): if not self.is_searchable(): return None self.searchbox.search(query) - + self.title.click() return self.table.read() @@ -485,6 +485,7 @@ def search(self, query): self.searchbox.search(query) self.browser.plugin.ensure_page_safe(timeout='60s') self.table.wait_displayed() + self.title.click() return self.table.read() diff --git a/airgun/views/computeprofile.py b/airgun/views/computeprofile.py index 76d64a756..e4fbda995 100644 --- a/airgun/views/computeprofile.py +++ b/airgun/views/computeprofile.py @@ -4,11 +4,11 @@ from widgetastic_patternfly import BreadCrumb from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown -class ComputeProfilesView(BaseLoggedInView, SearchableViewMixin): +class ComputeProfilesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text('//*[(self::h1 or self::h5) and normalize-space(.)="Compute Profiles"]') new = Text('//a[normalize-space(.)="Create Compute Profile"]') table = Table( diff --git a/airgun/views/domain.py b/airgun/views/domain.py index 5bb589434..dbbdd5610 100644 --- a/airgun/views/domain.py +++ b/airgun/views/domain.py @@ -6,13 +6,13 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import CustomParameter from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class DomainListView(BaseLoggedInView, SearchableViewMixin): +class DomainListView(BaseLoggedInView, SearchableViewMixinPF4): """List of all domains.""" title = Text('//*[(self::h1 or self::h5) and normalize-space(.)="Domains"]') diff --git a/airgun/views/hardware_model.py b/airgun/views/hardware_model.py index a1a525443..aa0acb9fd 100644 --- a/airgun/views/hardware_model.py +++ b/airgun/views/hardware_model.py @@ -4,7 +4,7 @@ from widgetastic_patternfly import Button from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ConfirmationDialog from airgun.widgets import SatTable @@ -14,7 +14,7 @@ class DeleteHardwareModelDialog(ConfirmationDialog): cancel_dialog = Text(".//button[normalize-space(.)='Cancel']") -class HardwareModelsView(BaseLoggedInView, SearchableViewMixin): +class HardwareModelsView(BaseLoggedInView, SearchableViewMixinPF4): delete_dialog = DeleteHardwareModelDialog() title = Text("//h1[normalize-space(.)='Hardware models']") new = Text("//a[contains(@href, '/models/new')]") diff --git a/airgun/views/host.py b/airgun/views/host.py index 79961fc0b..b191f8346 100644 --- a/airgun/views/host.py +++ b/airgun/views/host.py @@ -21,7 +21,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.views.job_invocation import JobInvocationCreateView from airgun.views.job_invocation import JobInvocationStatusView from airgun.views.task import TaskDetailsView @@ -196,7 +196,7 @@ def is_displayed(self): return self.browser.wait_for_element(self.title, visible=True, exception=False) is not None -class HostsView(BaseLoggedInView, SearchableViewMixin): +class HostsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Hosts']") export = Text(".//a[contains(@class, 'btn')][contains(@href, 'hosts.csv')]") new = Text(".//div[@id='rails-app-content']//a[contains(normalize-space(.),'Create Host')]") diff --git a/airgun/views/hostgroup.py b/airgun/views/hostgroup.py index 6ff36dacf..48f3f725c 100644 --- a/airgun/views/hostgroup.py +++ b/airgun/views/hostgroup.py @@ -8,7 +8,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import ConfigGroupMultiSelect from airgun.widgets import FilteredDropdown @@ -29,7 +29,7 @@ def items(self): ] -class HostGroupsView(BaseLoggedInView, SearchableViewMixin): +class HostGroupsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text( "//h1[contains(., 'Host Group Configuration') or normalize-space(.)='Host Groups']" ) diff --git a/airgun/views/job_template.py b/airgun/views/job_template.py index 7d89a04d0..e5106ddff 100644 --- a/airgun/views/job_template.py +++ b/airgun/views/job_template.py @@ -8,7 +8,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.views.common import TemplateEditor from airgun.views.common import TemplateInputItem from airgun.widgets import ActionsDropdown @@ -18,7 +18,7 @@ from airgun.widgets import RemovableWidgetsItemsListView -class JobTemplatesView(BaseLoggedInView, SearchableViewMixin): +class JobTemplatesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[contains(., 'Job Templates')]") import_template = Text("//a[normalize-space(.)='Import']") new = Text("//a[contains(@href, '/job_templates/new')]") diff --git a/airgun/views/location.py b/airgun/views/location.py index 9191eb627..225b930b7 100644 --- a/airgun/views/location.py +++ b/airgun/views/location.py @@ -7,14 +7,14 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatVerticalTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import CustomParameter from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class LocationsView(BaseLoggedInView, SearchableViewMixin): +class LocationsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Locations']") new = Text("//a[contains(@href, '/locations/new')]") table = Table( diff --git a/airgun/views/media.py b/airgun/views/media.py index d4e6e33e5..f3fcd30e9 100644 --- a/airgun/views/media.py +++ b/airgun/views/media.py @@ -6,12 +6,12 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class MediumView(BaseLoggedInView, SearchableViewMixin): +class MediumView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Installation Media']") new = Text("//a[contains(@href, '/media/new')]") table = Table( diff --git a/airgun/views/modulestream.py b/airgun/views/modulestream.py index f20e06345..8a1fb4c04 100644 --- a/airgun/views/modulestream.py +++ b/airgun/views/modulestream.py @@ -1,42 +1,21 @@ from widgetastic.widget import Table from widgetastic.widget import Text -from widgetastic.widget import TextInput from widgetastic.widget import View from widgetastic_patternfly import BreadCrumb -from widgetastic_patternfly import Button from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab from airgun.views.common import SatTable +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import SatTableWithUnevenStructure -from airgun.widgets import Search -class CustomSearch(Search): - search_field = TextInput(id='downshift-0-input') - search_button = Button('Search') - - -class ModuleStreamView(BaseLoggedInView): +class ModuleStreamView(BaseLoggedInView, SearchableViewMixinPF4): """Main Module_Streams view""" title = Text("//h2[contains(., 'Module Streams')]") table = SatTable('.//table', column_widgets={'Name': Text("./a")}) - search_box = CustomSearch() - - def search(self, query): - """Perform search using search box on the page and return table - contents. - - :param str query: search query to type into search field. E.g. - ``name = "bar"``. - :return: list of dicts representing table rows - :rtype: list - """ - self.search_box.search(query) - return self.table.read() - @property def is_displayed(self): """The view is displayed when it's title exists""" diff --git a/airgun/views/organization.py b/airgun/views/organization.py index de21ac72b..79dc179df 100644 --- a/airgun/views/organization.py +++ b/airgun/views/organization.py @@ -7,14 +7,14 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatVerticalTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import CustomParameter from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class OrganizationsView(BaseLoggedInView, SearchableViewMixin): +class OrganizationsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Organizations']") new = Text("//a[contains(@href, '/organizations/new')]") table = Table( diff --git a/airgun/views/os.py b/airgun/views/os.py index b8a9586a6..aa6332b5a 100644 --- a/airgun/views/os.py +++ b/airgun/views/os.py @@ -6,7 +6,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import CustomParameter from airgun.widgets import FilteredDropdown @@ -69,7 +69,7 @@ def fill(self, value): result[title].fill(select_value) -class OperatingSystemsView(BaseLoggedInView, SearchableViewMixin): +class OperatingSystemsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Operating Systems']") new = Text("//a[contains(@href, '/operatingsystems/new')]") table = Table( diff --git a/airgun/views/oscapcontent.py b/airgun/views/oscapcontent.py index 242d72519..34906d1d3 100644 --- a/airgun/views/oscapcontent.py +++ b/airgun/views/oscapcontent.py @@ -6,13 +6,13 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import MultiSelect from airgun.widgets import SatTable -class SCAPContentsView(BaseLoggedInView, SearchableViewMixin): +class SCAPContentsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='SCAP Content']") new = Text("//a[contains(@href, 'scap_contents/new')]") table = SatTable( diff --git a/airgun/views/partitiontable.py b/airgun/views/partitiontable.py index 95dcbaed4..b753e37b9 100644 --- a/airgun/views/partitiontable.py +++ b/airgun/views/partitiontable.py @@ -9,7 +9,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.views.common import TemplateInputItem from airgun.widgets import ACEEditor from airgun.widgets import ActionsDropdown @@ -18,7 +18,7 @@ from airgun.widgets import RemovableWidgetsItemsListView -class PartitionTablesView(BaseLoggedInView, SearchableViewMixin): +class PartitionTablesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[text()='Partition Tables']") new = Button("Create Partition Table") diff --git a/airgun/views/provisioning_template.py b/airgun/views/provisioning_template.py index b368138d1..0dc159fa5 100644 --- a/airgun/views/provisioning_template.py +++ b/airgun/views/provisioning_template.py @@ -9,7 +9,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.views.common import TemplateEditor from airgun.views.common import TemplateInputItem from airgun.widgets import ActionsDropdown @@ -26,7 +26,7 @@ class TemplateHostEnvironmentAssociation(GenericRemovableWidgetItem): host_group = Select(locator=".//select[contains(@name, '[hostgroup_id]')]") -class ProvisioningTemplatesView(BaseLoggedInView, SearchableViewMixin): +class ProvisioningTemplatesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Provisioning Templates']") new = Button("Create Template") build_pxe_default = Button("Build PXE Default") diff --git a/airgun/views/report_template.py b/airgun/views/report_template.py index 0ebb5e5f4..edd783723 100644 --- a/airgun/views/report_template.py +++ b/airgun/views/report_template.py @@ -8,7 +8,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.views.common import TemplateEditor from airgun.views.common import TemplateInputItem from airgun.widgets import ActionsDropdown @@ -18,7 +18,7 @@ from airgun.widgets import TextInputsGroup -class ReportTemplatesView(BaseLoggedInView, SearchableViewMixin): +class ReportTemplatesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Report Templates']") new = Button("Create Template") table = Table( diff --git a/airgun/views/role.py b/airgun/views/role.py index ed9f1cfcc..8b1a3a3d9 100644 --- a/airgun/views/role.py +++ b/airgun/views/role.py @@ -3,13 +3,13 @@ from widgetastic_patternfly import BreadCrumb from airgun.views.common import BaseLoggedInView -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import MultiSelect from airgun.widgets import SatTable -class RolesView(BaseLoggedInView, SearchableViewMixin): +class RolesView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Roles']") new = Text("//a[contains(@href, '/roles/new')]") table = SatTable( diff --git a/airgun/views/settings.py b/airgun/views/settings.py index eb0182635..e44c63897 100644 --- a/airgun/views/settings.py +++ b/airgun/views/settings.py @@ -5,11 +5,11 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import PopOverWidget -class SettingsView(BaseLoggedInView, SearchableViewMixin): +class SettingsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Settings']") table = Table( './/table', diff --git a/airgun/views/task.py b/airgun/views/task.py index 3b09284b5..69b1252dc 100644 --- a/airgun/views/task.py +++ b/airgun/views/task.py @@ -7,7 +7,7 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import ActionsDropdown from airgun.widgets import PieChart from airgun.widgets import ProgressBar @@ -26,7 +26,7 @@ class TaskReadOnlyEntryError(ReadOnlyEntry): BASE_LOCATOR = "//span[contains(., '{}')]//parent::div" "/following-sibling::pre" -class TasksView(BaseLoggedInView, SearchableViewMixin): +class TasksView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Tasks']") focus = ActionsDropdown("//div[./button[@id='tasks-dashboard-time-period-dropdown']]") table = SatTable( diff --git a/airgun/views/user.py b/airgun/views/user.py index e18900262..34dc6334b 100644 --- a/airgun/views/user.py +++ b/airgun/views/user.py @@ -7,12 +7,12 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class UsersView(BaseLoggedInView, SearchableViewMixin): +class UsersView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='Users']") new = Text("//a[contains(@href, '/users/new')]") table = Table( diff --git a/airgun/views/usergroup.py b/airgun/views/usergroup.py index dc7863806..8a77327bb 100644 --- a/airgun/views/usergroup.py +++ b/airgun/views/usergroup.py @@ -8,12 +8,12 @@ from airgun.views.common import BaseLoggedInView from airgun.views.common import SatTab -from airgun.views.common import SearchableViewMixin +from airgun.views.common import SearchableViewMixinPF4 from airgun.widgets import FilteredDropdown from airgun.widgets import MultiSelect -class UserGroupsView(BaseLoggedInView, SearchableViewMixin): +class UserGroupsView(BaseLoggedInView, SearchableViewMixinPF4): title = Text("//h1[normalize-space(.)='User Groups']") new_on_blank_page = P4Button('Create User group') new = Text("//a[contains(@href, '/usergroups/new')]") diff --git a/airgun/widgets.py b/airgun/widgets.py index 820a69337..eaa4c9083 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -749,14 +749,10 @@ def search(self, value): class PF4Search(Search): """PF4 Searchbar for table filtering""" - ROOT = '//div[@role="combobox" or @aria-haspopup="listbox"]' - search_field = TextInput( - locator=( - ".//input[@type='text' or @id='downshift-0-input' or" - " contains(@class, 'pf-m-search') or data-ouia-component-type='PF4/TextInput']" - ) - ) - clear_button = Button(locator=".//button[contains(@class,'search-clear')]") + ROOT = '//div[@id="search-bar"]' + search_field = TextInput(locator=(".//input[contains(@class, 'search-input')]")) + search_button = Text(locator=(".//button[contains(@id, 'btn-search')]")) + clear_button = Text(locator=(".//button[contains(@class,'autocomplete-clear-button')]")) def clear(self): """Clears search field value and re-trigger search to remove all @@ -770,6 +766,8 @@ def clear(self): def search(self, value): self.clear() self.fill(value) + if self.search_button.is_displayed: + self.search_button.click() class SatVerticalNavigation(VerticalNavigation):