@@ -178,7 +178,16 @@ describeControlUiE2e("Control UI attributed chat identity", () => {
178178 markRetrySettled ( ) ;
179179 }
180180 } ) ;
181- const gateway = await installMockGateway ( page , {
181+ await installMockGateway ( page , {
182+ presenceUsers : [
183+ {
184+ self : true ,
185+ id : "viewer-profile" ,
186+ name : "Viewer" ,
187+ 188+ watchedSessions : [ "agent:main:main" ] ,
189+ } ,
190+ ] ,
182191 historyMessages : [
183192 {
184193 role : "user" ,
@@ -198,29 +207,33 @@ describeControlUiE2e("Control UI attributed chat identity", () => {
198207 await page . goto ( controlUiSessionUrl ( server . baseUrl , "agent:main:main" ) ) ;
199208 await page . getByText ( "Please keep my fallback avatar readable." ) . waitFor ( ) ;
200209
201- const slot = page . locator ( ".chat-avatar-slot" ) ;
210+ const userGroup = page . locator ( ".chat-group.user" , {
211+ hasText : "Please keep my fallback avatar readable." ,
212+ } ) ;
213+ const slot = userGroup . locator ( ".chat-avatar-slot" ) ;
202214 const image = slot . locator ( "img.chat-avatar.user" ) ;
203215 const initials = slot . locator ( ".chat-avatar--sender-initials" ) ;
204- await expect . poll ( ( ) => avatarRequestCount ) . toBe ( 1 ) ;
216+ await retryStarted ;
217+ expect ( avatarRequestCount ) . toBe ( 2 ) ;
205218 await expect ( slot ) . toHaveClass ( / \b i s - f a l l b a c k \b / u) ;
206219 await expect . poll ( ( ) => image . getAttribute ( "src" ) ) . toBeNull ( ) ;
207220 await expect ( initials ) . toBeVisible ( ) ;
208221 await expect ( initials ) . toHaveText ( "H" ) ;
209222 await captureProof ( page , "missing-avatar-after-404.png" ) ;
210223
211- await gateway . emitGatewayEvent ( "presence" , {
212- presence : [
213- {
214- instanceId : "observer-instance" ,
215- mode : "webchat" ,
216- reason : "connect ",
217- user : { id : "observer" , name : "Observer" , email : "[email protected] " } , 218- watchedSessions : [ "agent:main:main" ] ,
219- } ,
220- ] ,
221- } ) ;
222- await page . locator ( '[data-viewer-id="observer"]' ) . waitFor ( ) ;
223- await retryStarted ;
224+ await userGroup . hover ( ) ;
225+ await userGroup . getByRole ( "button" , { name : "Reply to message" } ) . click ( ) ;
226+ const replyPreview = page . locator ( ".chat-reply-preview" ) ;
227+ await replyPreview . waitFor ( { state : "visible" } ) ;
228+ await expect ( replyPreview . locator ( ".chat-reply-preview__text" ) ) . toHaveText (
229+ "Please keep my fallback avatar readable. ",
230+ ) ;
231+ await page . evaluate (
232+ ( ) =>
233+ new Promise < void > ( ( resolve ) => {
234+ requestAnimationFrame ( ( ) => requestAnimationFrame ( ( ) => resolve ( ) ) ) ;
235+ } ) ,
236+ ) ;
224237
225238 expect ( avatarRequestCount ) . toBe ( 2 ) ;
226239 await expect ( slot ) . toHaveClass ( / \b i s - f a l l b a c k \b / u) ;
0 commit comments