@@ -77,11 +77,16 @@ def create_profiles(profile_paths, sys_platform):
77
77
os .remove (profile_file )
78
78
79
79
80
- def test_set_default_profile (driver : Firefox , opt_ci ):
80
+ def test_set_default_profile (
81
+ driver : Firefox , opt_ci : bool , about_profiles : AboutProfiles
82
+ ):
81
83
"""
82
- C130792: Set the default profile through the firefox browser
84
+ C130792: Set the default profile through the firefox
85
+
86
+ Arguments:
87
+ about_profiles: AboutProfiles page object model.
88
+ opt_ci: Boolean to verify if test is run in ci.
83
89
"""
84
- about_profiles = AboutProfiles (driver )
85
90
86
91
# Get the profiles container, extract all relevant children under it.
87
92
about_profiles .open ()
@@ -105,28 +110,29 @@ def test_set_default_profile(driver: Firefox, opt_ci):
105
110
logging .info (f"Found the default profile at { i } !" )
106
111
cur_default = i
107
112
break
113
+ test_profile_idx = 0 if cur_default != 0 else cur_default + 1
108
114
109
115
# Set test profile as the default and verify the rows
110
116
logging .info ("Preparing to set test profile to the default." )
111
117
about_profiles .get_element (
112
118
"profile-container-item-button" ,
113
- parent_element = profiles [- 1 ],
119
+ parent_element = profiles [test_profile_idx ],
114
120
labels = ["profiles-set-as-default" ],
115
121
).click ()
116
122
117
123
# Refetch data to ensure no stale elements
118
124
profiles = about_profiles .get_all_children ("profile-container" )
119
-
120
- table_rows = about_profiles .get_element (
125
+ test_profile_rows = about_profiles .get_element (
121
126
"profile-container-item-table-row" ,
122
127
multiple = True ,
123
- parent_element = profiles [- 1 ],
128
+ parent_element = profiles [test_profile_idx ],
129
+ )
130
+ default_profile_information = about_profiles .get_element (
131
+ "profile-container-item-table-row-value" , parent_element = test_profile_rows [0 ]
124
132
)
133
+
125
134
about_profiles .wait .until (
126
- lambda _ : about_profiles .get_element (
127
- "profile-container-item-table-row-value" , parent_element = table_rows [0 ]
128
- ).get_attribute ("innerHTML" )
129
- == "yes"
135
+ lambda _ : default_profile_information .get_attribute ("innerHTML" ) == "yes"
130
136
)
131
137
logging .info ("Verified that test profile was set to the default." )
132
138
0 commit comments