Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15.z] host_new>content>errata tab pagination #1202

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading