From 180af784aa5cfe1d753ce52bd88447f4af52c76e Mon Sep 17 00:00:00 2001 From: Michal Polovka Date: Thu, 22 Apr 2021 14:21:37 +0200 Subject: [PATCH] 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 Reviewed-By: Michal Polovka Reviewed-By: Serhii Tsymbaliuk --- ipatests/test_webui/ui_driver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index a5a082830..4720d37d2 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -2324,10 +2324,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'):