mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 08:41:55 -06:00
ui_tests: add assert_notification()
Add assert_notification() function to check whether we have a notification of particular type/ https://pagure.io/freeipa/issue/7441 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
parent
cd86fd21c5
commit
01fa54117d
@ -1875,3 +1875,21 @@ class UI_driver(object):
|
||||
is_enabled = not self.has_class(li, 'disabled')
|
||||
assert is_enabled == enabled, ('Invalid enabled state of action item %s. '
|
||||
'Expected: %s') % (action, str(visible))
|
||||
|
||||
def assert_notification(self, type='success', assert_text=None):
|
||||
"""
|
||||
Assert whether we have a notification of particular type
|
||||
|
||||
type: type for assertion
|
||||
assert_text: assert particular text when True
|
||||
|
||||
Returns True if selector/text found
|
||||
"""
|
||||
|
||||
notification_type = 'div.notification-area .alert-{}'.format(type)
|
||||
# wait for a half sec for notification to appear
|
||||
self.wait(0.5)
|
||||
is_present = self.find(notification_type, By.CSS_SELECTOR)
|
||||
assert is_present, "Notification not present"
|
||||
if assert_text:
|
||||
assert assert_text in is_present.text
|
||||
|
Loading…
Reference in New Issue
Block a user