@@ -36,12 +36,11 @@ describe("Appearance user settings tab", () => {
36
36
it ( "should be rendered properly" , ( ) => {
37
37
cy . openUserSettings ( "Appearance" ) ;
38
38
39
- cy . get ( ".mx_SettingsTab.mx_AppearanceUserSettingsTab" ) . within ( ( ) => {
40
- // Assert that the top heading is rendered
41
- cy . findByTestId ( "appearance" ) . should ( "have.text" , "Customise your appearance" ) . should ( "be.visible" ) ;
39
+ cy . findByTestId ( "mx_AppearanceUserSettingsTab" ) . within ( ( ) => {
40
+ cy . get ( "h2" ) . should ( "have.text" , "Customise your appearance" ) . should ( "be.visible" ) ;
42
41
} ) ;
43
42
44
- cy . get ( ".mx_SettingsTab. mx_AppearanceUserSettingsTab") . percySnapshotElement (
43
+ cy . findByTestId ( " mx_AppearanceUserSettingsTab") . percySnapshotElement (
45
44
"User settings tab - Appearance (advanced options collapsed)" ,
46
45
{
47
46
// Emulate TabbedView's actual min and max widths
@@ -57,7 +56,7 @@ describe("Appearance user settings tab", () => {
57
56
// Assert that "Hide advanced" link button is rendered
58
57
cy . findByRole ( "button" , { name : "Hide advanced" } ) . should ( "exist" ) ;
59
58
60
- cy . get ( ".mx_SettingsTab. mx_AppearanceUserSettingsTab") . percySnapshotElement (
59
+ cy . findByTestId ( " mx_AppearanceUserSettingsTab") . percySnapshotElement (
61
60
"User settings tab - Appearance (advanced options expanded)" ,
62
61
{
63
62
// Emulate TabbedView's actual min and max widths
@@ -74,7 +73,7 @@ describe("Appearance user settings tab", () => {
74
73
75
74
cy . openUserSettings ( "Appearance" ) ;
76
75
77
- cy . get ( ".mx_AppearanceUserSettingsTab . mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
76
+ cy . get ( ".mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
78
77
// Assert that the layout selected by default is "Modern"
79
78
cy . get ( ".mx_LayoutSwitcher_RadioButton_selected .mx_StyledRadioButton_enabled" ) . within ( ( ) => {
80
79
cy . findByLabelText ( "Modern" ) . should ( "exist" ) ;
@@ -84,7 +83,7 @@ describe("Appearance user settings tab", () => {
84
83
// Assert that the room layout is set to group (modern) layout
85
84
cy . get ( ".mx_RoomView_body[data-layout='group']" ) . should ( "exist" ) ;
86
85
87
- cy . get ( ".mx_AppearanceUserSettingsTab . mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
86
+ cy . get ( ".mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
88
87
// Select the first layout
89
88
cy . get ( ".mx_LayoutSwitcher_RadioButton" ) . first ( ) . click ( ) ;
90
89
@@ -97,7 +96,7 @@ describe("Appearance user settings tab", () => {
97
96
// Assert that the room layout is set to IRC layout
98
97
cy . get ( ".mx_RoomView_body[data-layout='irc']" ) . should ( "exist" ) ;
99
98
100
- cy . get ( ".mx_AppearanceUserSettingsTab . mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
99
+ cy . get ( ".mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
101
100
// Select the last layout
102
101
cy . get ( ".mx_LayoutSwitcher_RadioButton" ) . last ( ) . click ( ) ;
103
102
@@ -114,7 +113,7 @@ describe("Appearance user settings tab", () => {
114
113
it ( "should support changing font size by clicking the font slider" , ( ) => {
115
114
cy . openUserSettings ( "Appearance" ) ;
116
115
117
- cy . get ( ".mx_SettingsTab. mx_AppearanceUserSettingsTab") . within ( ( ) => {
116
+ cy . findByTestId ( " mx_AppearanceUserSettingsTab") . within ( ( ) => {
118
117
cy . get ( ".mx_FontScalingPanel_fontSlider" ) . within ( ( ) => {
119
118
cy . findByLabelText ( "Font size" ) . should ( "exist" ) ;
120
119
} ) ;
@@ -150,7 +149,7 @@ describe("Appearance user settings tab", () => {
150
149
it ( "should disable font size slider when custom font size is used" , ( ) => {
151
150
cy . openUserSettings ( "Appearance" ) ;
152
151
153
- cy . get ( ". mx_FontScalingPanel") . within ( ( ) => {
152
+ cy . findByTestId ( " mx_FontScalingPanel") . within ( ( ) => {
154
153
cy . findByLabelText ( "Use custom size" ) . click ( { force : true } ) ; // force click as checkbox size is zero
155
154
156
155
// Assert that the font slider is disabled
@@ -167,24 +166,16 @@ describe("Appearance user settings tab", () => {
167
166
// Click "Show advanced" link button
168
167
cy . findByRole ( "button" , { name : "Show advanced" } ) . click ( ) ;
169
168
170
- cy . get ( ".mx_AppearanceUserSettingsTab_Advanced" ) . within ( ( ) => {
171
- // force click as checkbox size is zero
172
- cy . findByLabelText ( "Use a more compact 'Modern' layout" ) . click ( { force : true } ) ;
173
- } ) ;
169
+ // force click as checkbox size is zero
170
+ cy . findByLabelText ( "Use a more compact 'Modern' layout" ) . click ( { force : true } ) ;
174
171
175
172
// Assert that the room layout is set to compact group (modern) layout
176
173
cy . get ( "#matrixchat .mx_MatrixChat_wrapper.mx_MatrixChat_useCompactLayout" ) . should ( "exist" ) ;
177
174
} ) ;
178
175
179
176
it ( "should disable compact group (modern) layout option on IRC layout and bubble layout" , ( ) => {
180
177
const checkDisabled = ( ) => {
181
- cy . get ( ".mx_AppearanceUserSettingsTab_Advanced" ) . within ( ( ) => {
182
- cy . get ( ".mx_Checkbox" )
183
- . first ( )
184
- . within ( ( ) => {
185
- cy . get ( "input[type='checkbox'][disabled]" ) . should ( "exist" ) ;
186
- } ) ;
187
- } ) ;
178
+ cy . findByLabelText ( "Use a more compact 'Modern' layout" ) . should ( "be.disabled" ) ;
188
179
} ;
189
180
190
181
cy . openUserSettings ( "Appearance" ) ;
@@ -193,7 +184,7 @@ describe("Appearance user settings tab", () => {
193
184
cy . findByRole ( "button" , { name : "Show advanced" } ) . click ( ) ;
194
185
195
186
// Enable IRC layout
196
- cy . get ( ".mx_AppearanceUserSettingsTab . mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
187
+ cy . get ( ".mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
197
188
// Select the first layout
198
189
cy . get ( ".mx_LayoutSwitcher_RadioButton" ) . first ( ) . click ( ) ;
199
190
@@ -206,7 +197,7 @@ describe("Appearance user settings tab", () => {
206
197
checkDisabled ( ) ;
207
198
208
199
// Enable bubble layout
209
- cy . get ( ".mx_AppearanceUserSettingsTab . mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
200
+ cy . get ( ".mx_LayoutSwitcher_RadioButtons" ) . within ( ( ) => {
210
201
// Select the first layout
211
202
cy . get ( ".mx_LayoutSwitcher_RadioButton" ) . last ( ) . click ( ) ;
212
203
@@ -225,10 +216,8 @@ describe("Appearance user settings tab", () => {
225
216
// Click "Show advanced" link button
226
217
cy . findByRole ( "button" , { name : "Show advanced" } ) . click ( ) ;
227
218
228
- cy . get ( ".mx_AppearanceUserSettingsTab_Advanced" ) . within ( ( ) => {
229
- // force click as checkbox size is zero
230
- cy . findByLabelText ( "Use a system font" ) . click ( { force : true } ) ;
231
- } ) ;
219
+ // force click as checkbox size is zero
220
+ cy . findByLabelText ( "Use a system font" ) . click ( { force : true } ) ;
232
221
233
222
// Assert that the font-family value was removed
234
223
cy . get ( "body" ) . should ( "have.css" , "font-family" , '""' ) ;
@@ -242,7 +231,7 @@ describe("Appearance user settings tab", () => {
242
231
243
232
it ( "should be rendered with the light theme selected" , ( ) => {
244
233
cy . openUserSettings ( "Appearance" )
245
- . get ( ". mx_ThemeChoicePanel")
234
+ . findByTestId ( " mx_ThemeChoicePanel")
246
235
. within ( ( ) => {
247
236
cy . findByTestId ( "checkbox-use-system-theme" ) . within ( ( ) => {
248
237
cy . findByText ( "Match system theme" ) . should ( "be.visible" ) ;
@@ -252,7 +241,7 @@ describe("Appearance user settings tab", () => {
252
241
cy . get ( ".mx_Checkbox_checkmark" ) . should ( "not.be.visible" ) ;
253
242
} ) ;
254
243
255
- cy . get ( ".mx_ThemeSelectors ") . within ( ( ) => {
244
+ cy . findByTestId ( "theme-choice-panel-selectors ") . within ( ( ) => {
256
245
cy . get ( ".mx_ThemeSelector_light" ) . should ( "exist" ) ;
257
246
cy . get ( ".mx_ThemeSelector_dark" ) . should ( "exist" ) ;
258
247
@@ -274,11 +263,11 @@ describe("Appearance user settings tab", () => {
274
263
"the system theme is clicked" ,
275
264
( ) => {
276
265
cy . openUserSettings ( "Appearance" )
277
- . get ( ". mx_ThemeChoicePanel")
266
+ . findByTestId ( " mx_ThemeChoicePanel")
278
267
. findByLabelText ( "Match system theme" )
279
268
. click ( { force : true } ) ; // force click because the size of the checkbox is zero
280
269
281
- cy . get ( ". mx_ThemeChoicePanel") . within ( ( ) => {
270
+ cy . findByTestId ( " mx_ThemeChoicePanel") . within ( ( ) => {
282
271
// Assert that the labels for the light theme and dark theme are disabled
283
272
cy . get ( ".mx_ThemeSelector_light.mx_StyledRadioButton_disabled" ) . should ( "exist" ) ;
284
273
cy . get ( ".mx_ThemeSelector_dark.mx_StyledRadioButton_disabled" ) . should ( "exist" ) ;
@@ -321,7 +310,7 @@ describe("Appearance user settings tab", () => {
321
310
} ) ;
322
311
323
312
cy . openUserSettings ( "Appearance" )
324
- . get ( ". mx_ThemeChoicePanel")
313
+ . findByTestId ( " mx_ThemeChoicePanel")
325
314
. findByLabelText ( "Use high contrast" )
326
315
. click ( { force : true } ) ; // force click because the size of the checkbox is zero
327
316
0 commit comments