@@ -179,10 +179,11 @@ describe("Timeline", () => {
179
179
// Check the event line has margin instead of inset property
180
180
// cf. _EventTile.pcss
181
181
// --EventTile_irc_line_info-margin-inline-start
182
- // = calc(var(--name-width) + 10px + var(--icon-width))
183
- // = 80 + 10 + 14 = 104px
182
+ // = calc(var(--name-width) + var(--icon-width) + 1 * var(--right-padding))
183
+ // = 80 + 14 + 5 = 99px
184
+
184
185
cy . get ( ".mx_EventTile[data-layout=irc].mx_EventTile_info:first-of-type .mx_EventTile_line" )
185
- . should ( "have.css" , "margin-inline-start" , "104px " )
186
+ . should ( "have.css" , "margin-inline-start" , "99px " )
186
187
. should ( "have.css" , "inset-inline-start" , "0px" ) ;
187
188
188
189
// Exclude timestamp and read marker from snapshot
@@ -193,6 +194,113 @@ describe("Timeline", () => {
193
194
cy . checkA11y ( ) ;
194
195
} ) ;
195
196
197
+ it ( "should align generic event list summary with messages and emote on IRC layout" , ( ) => {
198
+ // This test aims to check:
199
+ // 1. Alignment of collapsed GELS (generic event list summary) and messages
200
+ // 2. Alignment of expanded GELS and messages
201
+ // 3. Alignment of expanded GELS and placeholder of deleted message
202
+ // 4. Alignment of expanded GELS, placeholder of deleted message, and emote
203
+
204
+ // Exclude timestamp from snapshot of mx_MainSplit
205
+ const percyCSS = ".mx_MainSplit .mx_MessageTimestamp { visibility: hidden !important; }" ;
206
+
207
+ cy . visit ( "/#/room/" + roomId ) ;
208
+ cy . setSettingValue ( "layout" , null , SettingLevel . DEVICE , Layout . IRC ) ;
209
+
210
+ // Wait until configuration is finished
211
+ cy . contains (
212
+ ".mx_RoomView_body .mx_GenericEventListSummary .mx_GenericEventListSummary_summary" ,
213
+ "created and configured the room." ,
214
+ ) . should ( "exist" ) ;
215
+
216
+ // Send messages
217
+ cy . get ( ".mx_RoomView_body .mx_BasicMessageComposer_input" ) . type ( "Hello Mr. Bot{enter}" ) ;
218
+ cy . get ( ".mx_RoomView_body .mx_BasicMessageComposer_input" ) . type ( "Hello again, Mr. Bot{enter}" ) ;
219
+ // Make sure the second message was sent
220
+ cy . get ( ".mx_RoomView_MessageList > .mx_EventTile_last .mx_EventTile_receiptSent" ) . should ( "be.visible" ) ;
221
+
222
+ // 1. Alignment of collapsed GELS (generic event list summary) and messages
223
+ // Check inline start spacing of collapsed GELS
224
+ // See: _EventTile.pcss
225
+ // .mx_GenericEventListSummary[data-layout="irc"] > .mx_EventTile_line
226
+ // = var(--name-width) + var(--icon-width) + $MessageTimestamp_width + 2 * var(--right-padding)
227
+ // = 80 + 14 + 46 + 2 * 5
228
+ // = 150px
229
+ cy . get ( ".mx_GenericEventListSummary[data-layout=irc] > .mx_EventTile_line" ) . should (
230
+ "have.css" ,
231
+ "padding-inline-start" ,
232
+ "150px" ,
233
+ ) ;
234
+ // Check width and spacing values of elements in .mx_EventTile, which should be equal to 150px
235
+ // --right-padding should be applied
236
+ cy . get ( ".mx_EventTile > *" ) . should ( "have.css" , "margin-right" , "5px" ) ;
237
+ // --name-width width zero inline end margin should be applied
238
+ cy . get ( ".mx_EventTile .mx_DisambiguatedProfile" )
239
+ . should ( "have.css" , "width" , "80px" )
240
+ . should ( "have.css" , "margin-inline-end" , "0px" ) ;
241
+ // --icon-width should be applied
242
+ cy . get ( ".mx_EventTile .mx_EventTile_avatar > .mx_BaseAvatar" ) . should ( "have.css" , "width" , "14px" ) ;
243
+ // $MessageTimestamp_width should be applied
244
+ cy . get ( ".mx_EventTile > a" ) . should ( "have.css" , "min-width" , "46px" ) ;
245
+ // Record alignment of collapsed GELS and messages on messagePanel
246
+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "Collapsed GELS and messages on IRC layout" , { percyCSS } ) ;
247
+
248
+ // 2. Alignment of expanded GELS and messages
249
+ // Click "expand" link button
250
+ cy . get ( ".mx_GenericEventListSummary_toggle[aria-expanded=false]" ) . click ( ) ;
251
+ // Check inline start spacing of info line on expanded GELS
252
+ cy . get ( ".mx_EventTile[data-layout=irc].mx_EventTile_info:first-of-type .mx_EventTile_line" )
253
+ // See: _EventTile.pcss
254
+ // --EventTile_irc_line_info-margin-inline-start
255
+ // = 80 + 14 + 1 * 5
256
+ . should ( "have.css" , "margin-inline-start" , "99px" ) ;
257
+ // Record alignment of expanded GELS and messages on messagePanel
258
+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "Expanded GELS and messages on IRC layout" , { percyCSS } ) ;
259
+
260
+ // 3. Alignment of expanded GELS and placeholder of deleted message
261
+ // Delete the second (last) message
262
+ cy . get ( ".mx_RoomView_MessageList > .mx_EventTile_last" ) . realHover ( ) ;
263
+ cy . get ( ".mx_RoomView_MessageList > .mx_EventTile_last .mx_MessageActionBar_optionsButton" , {
264
+ timeout : 1000 ,
265
+ } )
266
+ . should ( "exist" )
267
+ . realHover ( )
268
+ . click ( { force : false } ) ;
269
+ cy . get ( ".mx_IconizedContextMenu_item[aria-label=Remove]" ) . should ( "be.visible" ) . click ( { force : false } ) ;
270
+ // Confirm deletion
271
+ cy . get ( ".mx_Dialog_buttons button[data-testid=dialog-primary-button]" )
272
+ . should ( "have.text" , "Remove" )
273
+ . click ( { force : false } ) ;
274
+ // Make sure the dialog was closed and the second (last) message was redacted
275
+ cy . get ( ".mx_Dialog" ) . should ( "not.exist" ) ;
276
+ cy . get ( ".mx_GenericEventListSummary .mx_EventTile_last .mx_RedactedBody" ) . should ( "be.visible" ) ;
277
+ cy . get ( ".mx_GenericEventListSummary .mx_EventTile_last .mx_EventTile_receiptSent" ) . should ( "be.visible" ) ;
278
+ // Record alignment of expanded GELS and placeholder of deleted message on messagePanel
279
+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "Expanded GELS and with placeholder of deleted message" , {
280
+ percyCSS,
281
+ } ) ;
282
+
283
+ // 4. Alignment of expanded GELS, placeholder of deleted message, and emote
284
+ // Send a emote
285
+ cy . get ( ".mx_RoomView_body .mx_BasicMessageComposer_input" ) . type ( "/me says hello to Mr. Bot{enter}" ) ;
286
+ // Check inline start margin of its avatar
287
+ // Here --right-padding is for the avatar on the message line
288
+ // See: _IRCLayout.pcss
289
+ // .mx_IRCLayout .mx_EventTile_emote .mx_EventTile_avatar
290
+ // = calc(var(--name-width) + var(--icon-width) + 1 * var(--right-padding))
291
+ // = 80 + 14 + 1 * 5
292
+ cy . get ( ".mx_EventTile_emote .mx_EventTile_avatar" ) . should ( "have.css" , "margin-left" , "99px" ) ;
293
+ // Make sure emote was sent
294
+ cy . get ( ".mx_EventTile_last.mx_EventTile_emote .mx_EventTile_receiptSent" ) . should ( "be.visible" ) ;
295
+ // Record alignment of expanded GELS, placeholder of deleted message, and emote
296
+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement (
297
+ "Expanded GELS and with emote and placeholder of deleted message" ,
298
+ {
299
+ percyCSS,
300
+ } ,
301
+ ) ;
302
+ } ) ;
303
+
196
304
it ( "should set inline start padding to a hidden event line" , ( ) => {
197
305
sendEvent ( roomId ) ;
198
306
cy . visit ( "/#/room/" + roomId ) ;
0 commit comments