Skip to content

Commit

Permalink
pf4 bookmarks dropdown (#1200) (#1228)
Browse files Browse the repository at this point in the history
(cherry picked from commit 39f73c6)

Co-authored-by: Peter Ondrejka <[email protected]>
  • Loading branch information
Satellite-QE and pondrejk authored Feb 16, 2024
1 parent 65d801f commit 842a66e
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 16 deletions.
1 change: 0 additions & 1 deletion airgun/views/capsule.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class CapsulesView(BaseLoggedInView, SearchableViewMixinPF4):
'Actions': ActionsDropdown('./div[contains(@class, "btn-group")]'),
},
)

pagination = Pagination()

@property
Expand Down
9 changes: 7 additions & 2 deletions airgun/views/computeresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down
7 changes: 3 additions & 4 deletions airgun/views/dashboard.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions airgun/views/discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')
Expand Down
7 changes: 6 additions & 1 deletion airgun/views/package.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
8 changes: 6 additions & 2 deletions airgun/views/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')]")
Expand Down
11 changes: 8 additions & 3 deletions airgun/views/subnet.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 3 additions & 1 deletion airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 842a66e

Please sign in to comment.