Skip to content

Commit

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

docstring fix
  • Loading branch information
damoore044 committed Jan 25, 2024
1 parent 05858aa commit 6c4ad18
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
29 changes: 26 additions & 3 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,40 @@ 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
2 changes: 1 addition & 1 deletion airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ 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
20 changes: 20 additions & 0 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2645,7 +2645,27 @@ 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.
Check the clear_button is not present after clicking it.
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 6c4ad18

Please sign in to comment.