@@ -23,12 +23,24 @@ test("Messages receives scoped typing through authenticated live traffic and exp
2323 app . activity ( { age : 9 } ) ;
2424 await expect ( indicator ) . toHaveCount ( 0 ) ;
2525 app . activity ( ) ;
26- await expect ( indicator ) . toContainText ( "is typing… " ) ;
26+ await expect ( indicator ) . toContainText ( "is typing" ) ;
2727 app . activity ( { author : 1 } ) ;
28- await expect ( indicator ) . toContainText ( "are typing…" ) ;
28+ await expect ( indicator ) . toContainText ( "are typing" ) ;
29+ await expect ( indicator ) . not . toContainText ( "…" ) ;
30+ // Browser-only contracts: real geometry and the OS motion preference.
31+ const composer = page . getByRole ( "form" , { name : "Send a message to Alpha" } ) ;
32+ const bounds = await indicator . boundingBox ( ) ;
33+ const composerBounds = await composer . boundingBox ( ) ;
34+ expect ( bounds . y + bounds . height ) . toBeLessThan ( composerBounds . y ) ;
35+ const dots = indicator . locator ( '[aria-hidden="true"] > span' ) ;
36+ await expect ( dots ) . toHaveCount ( 3 ) ;
37+ await page . emulateMedia ( { reducedMotion : "no-preference" } ) ;
38+ await expect ( dots . first ( ) ) . not . toHaveCSS ( "animation-name" , "none" ) ;
39+ await page . emulateMedia ( { reducedMotion : "reduce" } ) ;
40+ await expect ( dots . first ( ) ) . toHaveCSS ( "animation-name" , "none" ) ;
2941 await page . screenshot ( { path : testInfo . outputPath ( "messages-typing.png" ) } ) ;
3042 app . activity ( { kind : 9 } ) ;
31- await expect ( indicator ) . toContainText ( "is typing… " ) ;
43+ await expect ( indicator ) . toContainText ( "is typing" ) ;
3244 app . activity ( { kind : 9 , author : 1 } ) ;
3345 await expect ( indicator ) . toHaveCount ( 0 ) ;
3446 app . activity ( ) ; // same-second late pulse cannot resurrect completion
@@ -55,11 +67,33 @@ test("Messages receives scoped typing through authenticated live traffic and exp
5567 app . activity ( { root : root . id } ) ;
5668 await expect (
5769 thread . getByRole ( "status" , { name : "Typing activity" } ) ,
58- ) . toContainText ( "is typing… " ) ;
70+ ) . toContainText ( "is typing" ) ;
5971 await expect ( indicator ) . toHaveCount ( 1 ) ;
6072 await page . screenshot ( {
6173 path : testInfo . outputPath ( "messages-thread-typing.png" ) ,
6274 } ) ;
75+ await page . emulateMedia ( { colorScheme : "dark" } ) ;
76+ await page . setViewportSize ( { width : 800 , height : 700 } ) ;
77+ // Stress the real label's CSS with an unbroken name, without adding profile
78+ // fixture/network machinery to a presentation-only regression.
79+ const label = indicator . locator ( ":scope > span" ) . last ( ) ;
80+ await label . evaluate ( ( el ) => {
81+ el . textContent = `${ "LongDisplayName" . repeat ( 30 ) } is typing` ;
82+ } ) ;
83+ await expect ( label ) . toHaveCSS ( "text-overflow" , "ellipsis" ) ;
84+ expect ( await label . evaluate ( ( el ) => el . scrollWidth > el . clientWidth ) ) . toBe (
85+ true ,
86+ ) ;
87+ const narrowBounds = await indicator . boundingBox ( ) ;
88+ const threadComposer = await thread . getByRole ( "form" ) . boundingBox ( ) ;
89+ expect ( narrowBounds . x ) . toBeGreaterThanOrEqual ( threadComposer . x ) ;
90+ expect ( narrowBounds . x + narrowBounds . width ) . toBeLessThanOrEqual (
91+ threadComposer . x + threadComposer . width ,
92+ ) ;
93+ expect ( narrowBounds . y + narrowBounds . height ) . toBeLessThan ( threadComposer . y ) ;
94+ await page . screenshot ( {
95+ path : testInfo . outputPath ( "messages-thread-typing-dark-narrow.png" ) ,
96+ } ) ;
6397 // Real browser timer, signed timestamp TTL, no polling transport or fixture cleanup.
6498 await expect ( indicator ) . toHaveCount ( 0 , { timeout : 10000 } ) ;
6599 expect ( app . report . publications ) . toEqual ( [ ] ) ;
@@ -105,7 +139,9 @@ for (const scope of ["channel", "thread"]) {
105139 name : scope === "thread" ? "Reply to thread" : "Send a message to Alpha" ,
106140 exact : true ,
107141 } ) ;
108- const indicator = composer . getByRole ( "status" , { name : "Typing activity" } ) ;
142+ const indicator = composer
143+ . locator ( ".." )
144+ . getByRole ( "status" , { name : "Typing activity" } ) ;
109145 const gap = ( ) =>
110146 history . evaluate (
111147 ( el ) => el . scrollHeight - el . clientHeight - el . scrollTop ,
@@ -141,14 +177,16 @@ for (const scope of ["channel", "thread"]) {
141177 await expect ( indicator ) . toHaveCount ( 0 ) ;
142178 const target = scope === "thread" ? { root : root . id } : { } ;
143179 app . activity ( target ) ;
144- await expect ( indicator ) . toContainText ( "is typing…" ) ;
180+ await expect ( indicator ) . toContainText ( "is typing" ) ;
181+ const typingBounds = await indicator . boundingBox ( ) ;
182+ expect ( typingBounds . y ) . toBeGreaterThanOrEqual ( idle . y + idle . height ) ;
145183 await stable ( ) ;
146184 app . activity ( { ...target , kind : 9 } ) ;
147185 await expect ( indicator ) . toHaveCount ( 0 ) ;
148186 await stable ( ) ;
149187 // A different signer is outside the first signer's quiet period.
150188 app . activity ( { ...target , author : 1 } ) ;
151- await expect ( indicator ) . toContainText ( "is typing… " ) ;
189+ await expect ( indicator ) . toContainText ( "is typing" ) ;
152190 await stable ( ) ;
153191 await expect ( indicator ) . toHaveCount ( 0 , { timeout : 10000 } ) ;
154192 await stable ( ) ;
0 commit comments