@@ -22,15 +22,15 @@ def test_case():
22
22
@pytest .mark .headed
23
23
def test_password_csv_correctness (driver_and_saved_logins , home_folder , sys_platform ):
24
24
"""
25
- C2241522: Check that password.csv displays the correct information
25
+ C2241522: Verify than an exported password.csv file displays the correct information
26
26
"""
27
27
# Initializing objects
28
28
(driver , usernames , logins ) = driver_and_saved_logins
29
29
about_logins = AboutLogins (driver )
30
30
keyboard = Controller ()
31
31
32
- # Ensure the Downloads folder doesn't contain a passwords.csv file
33
- 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 ()
34
34
35
35
# Click on buttons to export passwords
36
36
about_logins .open ()
@@ -42,20 +42,17 @@ def test_password_csv_correctness(driver_and_saved_logins, home_folder, sys_plat
42
42
time .sleep (5 )
43
43
keyboard .tap (Key .enter )
44
44
45
- # Verify that the file exists
46
- if sys_platform == "Linux" :
47
- downloads_folder = os .getcwd ()
48
- else :
49
- downloads_folder = os .path .join (home_folder , "Downloads" )
50
- passwords_csv = os .path .join (downloads_folder , "passwords.csv" )
51
- 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 ))
52
49
53
50
# Verify the results
54
51
guid_pattern = re .compile (
55
52
r"{[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}}"
56
53
)
57
54
time_pattern = re .compile (r"[0-9]{10}" )
58
- with open (passwords_csv ) as pw :
55
+ with open (csv_file ) as pw :
59
56
reader = csv .DictReader (pw )
60
57
actual_logins = {}
61
58
for row in reader :
@@ -69,4 +66,4 @@ def test_password_csv_correctness(driver_and_saved_logins, home_folder, sys_plat
69
66
about_logins .check_logins_present (actual_logins , logins )
70
67
71
68
# Delete the password.csv created
72
- about_logins .remove_password_csv (home_folder )
69
+ about_logins .remove_password_csv ()
0 commit comments