Skip to content

Commit

Permalink
host_new>content>errata tab pagination (#1152)
Browse files Browse the repository at this point in the history
Click button to clear searchbar

docstring fix

(cherry picked from commit 5b0ca76)
  • Loading branch information
damoore044 authored and web-flow committed Jan 26, 2024
1 parent 17311ec commit 62cc118
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
30 changes: 27 additions & 3 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,41 @@ def get_errata_by_type(self, entity_name, type):
view.content.errata.table.wait_displayed()
return view.read(widget_names="content.errata.table")

def apply_erratas(self, entity_name, search):
"""Apply errata on selected host based on errata_id"""
def apply_erratas(self, entity_name, search=None):
"""Apply available errata on selected host based on searchbar result.
param: search (string): search value to filter results.
example: search="errata_id == {ERRATA_ID}"
default: None; all available errata are returned and installed.
"""
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
view.content.errata.searchbar.fill(search)
if search is None:
# Return all errata, clear the searchbar
view.content.errata.searchbar.clear()
else:
# Return only errata by search
view.content.errata.searchbar.fill(search)
# wait for filter to apply
view.content.errata.wait_displayed()
self.browser.plugin.ensure_page_safe()
view.content.errata.select_all.click()
view.content.errata.apply.fill('Apply')
view.flash.assert_no_error()
view.flash.dismiss()
# clear the searchbar so any input will not persist
view.content.errata.searchbar.clear()
view.content.errata.wait_displayed()
self.browser.plugin.ensure_page_safe()

def get_errata_pagination(self, entity_name):
"""Get pagination info from Errata tab on selected host."""
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
view.content.errata.select()
view.content.errata.wait_displayed()
self.browser.plugin.ensure_page_safe()
return view.content.errata.pagination

def get_module_streams(self, entity_name, search):
"""Filter module streams"""
Expand Down
4 changes: 3 additions & 1 deletion airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,9 @@ class errata(Tab):
8: Dropdown(locator='./div'),
},
)
pagination = PF4Pagination()
pagination = PF4Pagination(
"//div[@class = 'pf-c-pagination pf-m-bottom tfm-pagination']"
)

@View.nested
class module_streams(Tab):
Expand Down
19 changes: 19 additions & 0 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2645,7 +2645,26 @@ def read(self):


class SearchInput(TextInput):
"""Searchbar's contained input text, and buttons"""

search_field = TextInput(locator=('//input[@aria-label="Search input"]'))
clear_button = Text(locator=('//button[@aria-label="Reset search"]'))

def clear(self):
"""Clear search input by clicking the clear_button.
Return: True if button was present, and clicking it caused it to disappear.
False otherwise.
"""
changed = False
if self.clear_button.is_displayed:
self.clear_button.click()
# after clicking clear button, it should disappear
if not self.clear_button.is_displayed:
changed = True
return changed

def fill(self, value, enter_timeout=1, after_enter_timeout=3):
"""Fill the search input with supplied value"""
changed = super().fill(value)
if changed:
# workaround for BZ #2140636
Expand Down

0 comments on commit 62cc118

Please sign in to comment.