@@ -24,7 +24,34 @@ async function sendMessage(page: Page, message: string): Promise<Locator> {
24
24
await page . getByRole ( "textbox" , { name : "Send a message…" } ) . fill ( message ) ;
25
25
await page . getByRole ( "button" , { name : "Send message" } ) . click ( ) ;
26
26
27
- const msgTile = await page . locator ( ".mx_EventTile_last" ) ;
27
+ const msgTile = page . locator ( ".mx_EventTile_last" ) ;
28
+ await msgTile . locator ( ".mx_EventTile_receiptSent" ) . waitFor ( ) ;
29
+ return msgTile ;
30
+ }
31
+
32
+ async function sendMultilineMessages ( page : Page , messages : string [ ] ) {
33
+ await page . getByRole ( "textbox" , { name : "Send a message…" } ) . focus ( ) ;
34
+ for ( let i = 0 ; i < messages . length ; i ++ ) {
35
+ await page . keyboard . type ( messages [ i ] ) ;
36
+ if ( i < messages . length - 1 ) await page . keyboard . press ( "Shift+Enter" ) ;
37
+ }
38
+
39
+ await page . getByRole ( "button" , { name : "Send message" } ) . click ( ) ;
40
+
41
+ const msgTile = page . locator ( ".mx_EventTile_last" ) ;
42
+ await msgTile . locator ( ".mx_EventTile_receiptSent" ) . waitFor ( ) ;
43
+ return msgTile ;
44
+ }
45
+
46
+ async function replyMessage ( page : Page , message : Locator , replyMessage : string ) : Promise < Locator > {
47
+ const line = message . locator ( ".mx_EventTile_line" ) ;
48
+ await line . hover ( ) ;
49
+ await line . getByRole ( "button" , { name : "Reply" , exact : true } ) . click ( ) ;
50
+
51
+ await page . getByRole ( "textbox" , { name : "Send a reply…" } ) . fill ( replyMessage ) ;
52
+ await page . getByRole ( "button" , { name : "Send message" } ) . click ( ) ;
53
+
54
+ const msgTile = page . locator ( ".mx_EventTile_last" ) ;
28
55
await msgTile . locator ( ".mx_EventTile_receiptSent" ) . waitFor ( ) ;
29
56
return msgTile ;
30
57
}
@@ -88,6 +115,22 @@ test.describe("Message rendering", () => {
88
115
} ) ;
89
116
} ) ;
90
117
118
+ test ( "should render a reply of a LTR message" , async ( { page, user, app, room } ) => {
119
+ await page . goto ( `#/room/${ room . roomId } ` ) ;
120
+
121
+ const msgTile = await sendMultilineMessages ( page , [
122
+ "Fist line" ,
123
+ "Second line" ,
124
+ "Third line" ,
125
+ "Fourth line" ,
126
+ ] ) ;
127
+
128
+ await replyMessage ( page , msgTile , "response to multiline message" ) ;
129
+ await expect ( msgTile ) . toMatchScreenshot ( `reply-message-ltr-${ direction } displayname.png` , {
130
+ mask : [ page . locator ( ".mx_MessageTimestamp" ) ] ,
131
+ } ) ;
132
+ } ) ;
133
+
91
134
test ( "should render a basic RTL text message" , async ( { page, user, app, room } ) => {
92
135
await page . goto ( `#/room/${ room . roomId } ` ) ;
93
136
@@ -122,6 +165,22 @@ test.describe("Message rendering", () => {
122
165
mask : [ page . locator ( ".mx_MessageTimestamp" ) ] ,
123
166
} ) ;
124
167
} ) ;
168
+
169
+ test ( "should render a reply of a RTL message" , async ( { page, user, app, room } ) => {
170
+ await page . goto ( `#/room/${ room . roomId } ` ) ;
171
+
172
+ const msgTile = await sendMultilineMessages ( page , [
173
+ "مرحبا بالعالم!" ,
174
+ "مرحبا بالعالم!" ,
175
+ "مرحبا بالعالم!" ,
176
+ "مرحبا بالعالم!" ,
177
+ ] ) ;
178
+
179
+ await replyMessage ( page , msgTile , "مرحبا بالعالم!" ) ;
180
+ await expect ( msgTile ) . toMatchScreenshot ( `reply-message-trl-${ direction } displayname.png` , {
181
+ mask : [ page . locator ( ".mx_MessageTimestamp" ) ] ,
182
+ } ) ;
183
+ } ) ;
125
184
} ) ;
126
185
} ) ;
127
186
} ) ;
0 commit comments