Skip to content

Commit 445396a

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Declaring constants
1 parent 92f268d commit 445396a

5 files changed

+20
-6
lines changed

tests/password_manager/test_about_logins_navigation_from_context_menu.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ def test_case():
1010
return "2241087"
1111

1212

13+
ABOUT_LOGINS_PAGE_TITLE = "Passwords"
14+
15+
1316
@pytest.mark.ci
1417
def test_about_logins_navigation_from_login_form_context_menu(driver: Firefox):
1518
"""
@@ -19,13 +22,14 @@ def test_about_logins_navigation_from_login_form_context_menu(driver: Firefox):
1922
# Instantiate objects
2023
context_menu = ContextMenu(driver)
2124
tabs = TabBar(driver)
22-
login = LoginAutofill(driver).open()
25+
login = LoginAutofill(driver)
2326

2427
# Access the manage passwords in context menu from the username field in the demo login form
28+
login.open()
2529
username_field = login.get_element("username-field")
2630
login.context_click(username_field)
2731
context_menu.click_and_hide_menu("context-menu-manage-passwords")
2832

2933
# Verify that the about:logins page is opened in a new tab
3034
tabs.wait_for_num_tabs(2)
31-
tabs.title_contains("Passwords")
35+
tabs.title_contains(ABOUT_LOGINS_PAGE_TITLE)

tests/password_manager/test_about_logins_navigation_from_hamburger_menu.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def test_case():
99
return "2241082"
1010

1111

12+
ABOUT_LOGINS_PAGE_TITLE = "Passwords"
13+
14+
1215
def test_about_logins_navigation_from_password_hamburger_menu(driver: Firefox):
1316
"""
1417
C2241082 - Verify that clicking the Password option in Hamburger Menu opens about:logins page in a new tab
@@ -23,4 +26,4 @@ def test_about_logins_navigation_from_password_hamburger_menu(driver: Firefox):
2326

2427
# Verify that the about:logins page is opened in a new tab
2528
tabs.wait_for_num_tabs(2)
26-
tabs.title_contains("Passwords")
29+
tabs.title_contains(ABOUT_LOGINS_PAGE_TITLE)

tests/password_manager/test_add_password_non_ascii_chars.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def test_case():
99
return "2241113"
1010

1111

12+
WEBSITE_ADDRESS = "mozilla.org"
13+
14+
1215
def test_add_password_non_ascii_chars(driver: Firefox):
1316
"""
1417
C2241113 Add password - non-ascii characters
@@ -33,6 +36,6 @@ def test_add_password_non_ascii_chars(driver: Firefox):
3336
about_logins.get_element("login-list-item")
3437
logins = about_logins.get_elements("login-list-item")
3538
mozilla_login = next(
36-
login for login in logins if login.get_attribute("title") == "mozilla.org"
39+
login for login in logins if login.get_attribute("title") == WEBSITE_ADDRESS
3740
)
3841
assert mozilla_login

tests/password_manager/test_add_password_save_valid_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ def test_case():
1010
return "2241112"
1111

1212

13+
WEBSITE_ADDRESS = "mozilla.org"
14+
15+
1316
def test_add_password_save_valid_data(driver: Firefox):
1417
"""
1518
C2241112 Verify that a password can be added and saved
@@ -34,7 +37,7 @@ def test_add_password_save_valid_data(driver: Firefox):
3437
about_logins.get_element("login-list-item")
3538
logins = about_logins.get_elements("login-list-item")
3639
mozilla_login = next(
37-
login for login in logins if login.get_attribute("title") == "mozilla.org"
40+
login for login in logins if login.get_attribute("title") == WEBSITE_ADDRESS
3841
)
3942
assert mozilla_login
4043

tests/password_manager/test_add_primary_password.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def hard_quit():
1616

1717

1818
PRIMARY_PASSWORD = "securePassword1"
19+
ALERT_MESSAGE = "Primary Password successfully changed."
1920

2021

2122
def test_add_primary_password(driver: Firefox):
@@ -45,5 +46,5 @@ def test_add_primary_password(driver: Firefox):
4546
# Check that the pop-up appears
4647
with driver.context(driver.CONTEXT_CHROME):
4748
alert = about_prefs.get_alert()
48-
assert alert.text == "Primary Password successfully changed."
49+
assert alert.text == ALERT_MESSAGE
4950
alert.accept()

0 commit comments

Comments
 (0)