WebUI: Handle assertion if multiple notifications are present

If multiple notifications of the same type are shown at the same
time, assertion works for only the first one. This change enables to
search for notification's content in all shown notifications.

Fixes: https://pagure.io/freeipa/issue/8641

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
Michal Polovka committed 2021-04-24 14:04:52 +02:00
1 parent 33404a62c0
commit bd2a14a2e8
1 file changed
+2 -2
+2 -2
View File
@@ -2305,10 +2305,10 @@ class UI_driver:
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)
is_present = self.find(notification_type, By.CSS_SELECTOR, many=True)
assert is_present, "Notification not present"
if assert_text:
assert assert_text in is_present.text
assert any(map(lambda x: assert_text in x.text, is_present))
def assert_last_error_dialog(self, expected_err, details=False,
dialog_name='error_dialog'):