The nightly test test_webui/test_user.py::TestLifeCycles::test_life_cycles randomly fails, see for instance PR #622 with the following logs and report:
test_webui/test_user.py::TestLifeCycles::test_life_cycles
self = <ipatests.test_webui.test_user.TestLifeCycles object at 0x7facc9b703a0> @screenshot def test_life_cycles(self): """ Test user life-cycles """ self.init_app() # create "itest-user" and send him to preserved self.add_record(user.ENTITY, user.DATA) self.delete_record(user.PKEY, confirm_btn=None) self.check_option('preserve', value='true') self.dialog_button_click('ok') > self.assert_notification(assert_text='1 item(s) deleted') test_webui/test_user.py:736: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <ipatests.test_webui.test_user.TestLifeCycles object at 0x7facc9b703a0> type = 'success', assert_text = '1 item(s) deleted' 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 E AssertionError test_webui/ui_driver.py:2330: AssertionError
Test scenario: add a user, delete the user with --preserve, ensure that a notification "1 item(s) deleted" is displayed in the notification area.
The test fails even though the screenshot shows the notification (see http://freeipa-org-pr-ci.s3-website.eu-central-1.amazonaws.com/jobs/f5a469b4-4c90-11eb-b665-fa163e03e1e5/2021-01-02T01:04:51.942512_TestLifeCycles_test_life_cycles.png). In the screenshot we can see 2 notifications: - User successfully added - 1item(s) deleted
Need to check if the test is reading the most recent notification or the first one.
I think that Flo's hypothesis is sound. Seeing the code, assert_notification is not written in a way to work correctly with 2 notifications present of the same type if we want to check the text.
assert_notification
It might be more correct to find all the notification of the type and interate through them if any of them contains the desired text.
Btw to get all the change is something like:
self.find(notification_type, By.CSS_SELECTOR, many=True)
Metadata Update from @mpolovka: - Issue assigned to mpolovka
Also happened in PR #725 - [testing_master_latest] on fedora33 with the same symptom (screeenshot shows 2 notifications).
master:
Metadata Update from @mpolovka: - Custom field affects_doc adjusted to on - Custom field knownissue adjusted to on - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
ipa-4-8:
ipa-4-9:
Login to comment on this ticket.