@@ -2879,26 +2879,26 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
28792879 expect ( await bubble . getByText ( "Media failed" ) . count ( ) ) . toBe ( 0 ) ;
28802880
28812881 try {
2882- const desktopStatusSpacing = await cards
2883- . filter ( { hasText : "settings.toml" } )
2884- . evaluate ( ( card ) => {
2885- const badge = card . querySelector < HTMLElement > (
2886- ".chat-assistant-attachment-card__status-badge" ,
2887- ) ! ;
2888- const reason = card . querySelector < HTMLElement > (
2889- ".chat-assistant-attachment-card__status-reason" ,
2890- ) ! ;
2891- const separator = card . querySelector < HTMLElement > (
2892- ".chat-assistant-attachment-card__status-separator" ,
2893- ) ! ;
2894- const badgeRect = badge . getBoundingClientRect ( ) ;
2895- const reasonRect = reason . getBoundingClientRect ( ) ;
2896- const separatorRect = separator . getBoundingClientRect ( ) ;
2897- return {
2898- leftGap : separatorRect . left - badgeRect . right ,
2899- rightGap : reasonRect . left - separatorRect . right ,
2900- } ;
2901- } ) ;
2882+ const failedCard = cards . filter ( { hasText : "settings.toml" } ) ;
2883+ await failedCard . scrollIntoViewIfNeeded ( ) ;
2884+ const desktopStatusSpacing = await failedCard . evaluate ( ( card ) => {
2885+ const badge = card . querySelector < HTMLElement > (
2886+ ".chat-assistant-attachment-card__status-badge" ,
2887+ ) ! ;
2888+ const reason = card . querySelector < HTMLElement > (
2889+ ".chat-assistant-attachment-card__status-reason" ,
2890+ ) ! ;
2891+ const separator = card . querySelector < HTMLElement > (
2892+ ".chat-assistant-attachment-card__status-separator" ,
2893+ ) ! ;
2894+ const badgeRect = badge . getBoundingClientRect ( ) ;
2895+ const reasonRect = reason . getBoundingClientRect ( ) ;
2896+ const separatorRect = separator . getBoundingClientRect ( ) ;
2897+ return {
2898+ leftGap : separatorRect . left - badgeRect . right ,
2899+ rightGap : reasonRect . left - separatorRect . right ,
2900+ } ;
2901+ } ) ;
29022902 expect ( desktopStatusSpacing . leftGap ) . toBeGreaterThan ( 4 ) ;
29032903 expect ( desktopStatusSpacing . rightGap ) . toBeGreaterThan ( 4 ) ;
29042904 expect ( Math . abs ( desktopStatusSpacing . leftGap - desktopStatusSpacing . rightGap ) ) . toBeLessThan (
@@ -2907,7 +2907,14 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
29072907
29082908 for ( const width of [ 320 , 560 ] ) {
29092909 await page . setViewportSize ( { width, height : 852 } ) ;
2910- const failedCard = cards . filter ( { hasText : "settings.toml" } ) ;
2910+ // Viewport emulation can precede the shell and chat's responsive updates.
2911+ // Materialize the virtual row before measuring its committed layout.
2912+ await page . locator ( ".shell--mobile-nav .chat-split-view--narrow" ) . waitFor ( ) ;
2913+ await failedCard . scrollIntoViewIfNeeded ( ) ;
2914+ await waitForLayoutSettled (
2915+ page ,
2916+ ".chat-assistant-attachment-card, .chat-assistant-attachment-card__status-reason" ,
2917+ ) ;
29112918 const mobileStatusLayout = await failedCard . evaluate ( ( card ) => {
29122919 const badge = card . querySelector < HTMLElement > (
29132920 ".chat-assistant-attachment-card__status-badge" ,
0 commit comments