Skip to content

Commit f8d9294

Browse files
committed
Wait for a login to be present
1 parent 6597f17 commit f8d9294

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/password_manager/test_add_password_save_valid_data.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import logging
2+
13
import pytest
4+
from selenium.common.exceptions import TimeoutException
25
from selenium.webdriver import Firefox
36
from selenium.webdriver.support import expected_conditions as EC
47

@@ -36,10 +39,18 @@ def test_add_password_save_valid_data(driver: Firefox):
3639

3740
# Check password added in the listbox
3841
logins = about_logins.get_elements("login-list-item")
39-
mozilla_login = any(
40-
[login for login in logins if login.get_attribute("title") == WEBSITE_ADDRESS]
41-
)
42-
assert mozilla_login
42+
try:
43+
about_logins.wait.until(
44+
lambda _: any(
45+
[
46+
login
47+
for login in logins
48+
if login.get_attribute("title") == WEBSITE_ADDRESS
49+
]
50+
)
51+
)
52+
except TimeoutException:
53+
logging.warning("A login was not saved.")
4354

4455
# Check the "Sort by:" dropdown from the top part of the Login list becomes active
4556
login_sort = about_logins.get_element("login-sort")

0 commit comments

Comments
 (0)