@@ -20,47 +20,39 @@ def test_case():
20
20
21
21
22
22
@pytest .mark .headed
23
- @pytest .mark .skipif (MAC_GHA , reason = "Test unstable in MacOS Github Actions" )
24
- @pytest .mark .skipif (
25
- sys .platform .lower ().startswith ("linux" ),
26
- reason = "Test unstable in CI on Linux. see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1951666" ,
27
- )
28
23
def test_password_csv_correctness (driver_and_saved_logins , home_folder , sys_platform ):
29
24
"""
30
- C2241522: Check that password.csv displays the correct information
25
+ C2241522: Verify than an exported password.csv file displays the correct information
31
26
"""
32
27
# Initializing objects
33
28
(driver , usernames , logins ) = driver_and_saved_logins
34
29
about_logins = AboutLogins (driver )
35
30
keyboard = Controller ()
36
31
37
- # Ensure the Downloads folder doesn't contain a passwords.csv file
38
- about_logins .remove_password_csv (home_folder )
32
+ # Ensure the export target folder doesn't contain a passwords.csv file
33
+ about_logins .remove_password_csv ()
39
34
40
35
# Click on buttons to export passwords
41
36
about_logins .open ()
42
37
about_logins .click_on ("menu-button" )
43
38
about_logins .click_on ("export-passwords-button" )
44
39
about_logins .click_on ("continue-export-button" )
45
40
46
- # Download the password file
41
+ # Export the password file
47
42
time .sleep (5 )
48
43
keyboard .tap (Key .enter )
49
44
50
- # Verify that the file exists
51
- if sys_platform == "Linux" :
52
- downloads_folder = os .getcwd ()
53
- else :
54
- downloads_folder = os .path .join (home_folder , "Downloads" )
55
- passwords_csv = os .path .join (downloads_folder , "passwords.csv" )
56
- about_logins .wait .until (lambda _ : os .path .exists (passwords_csv ))
45
+ # Verify the exported csv file is present in the target folder
46
+ documents_directory = about_logins .get_documents_dir ()
47
+ csv_file = os .path .join (documents_directory , "passwords.csv" )
48
+ about_logins .wait .until (lambda _ : os .path .exists (csv_file ))
57
49
58
- # Verify the results
50
+ # Verify the contents of the exported csv file
59
51
guid_pattern = re .compile (
60
52
r"{[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}}"
61
53
)
62
54
time_pattern = re .compile (r"[0-9]{10}" )
63
- with open (passwords_csv ) as pw :
55
+ with open (csv_file ) as pw :
64
56
reader = csv .DictReader (pw )
65
57
actual_logins = {}
66
58
for row in reader :
@@ -74,4 +66,4 @@ def test_password_csv_correctness(driver_and_saved_logins, home_folder, sys_plat
74
66
about_logins .check_logins_present (actual_logins , logins )
75
67
76
68
# Delete the password.csv created
77
- about_logins .remove_password_csv (home_folder )
69
+ about_logins .remove_password_csv ()
0 commit comments