@@ -27,7 +27,7 @@ const DESKTOP_CONTEXT: BrowserContextOptions = {
2727} ;
2828const MOBILE_CONTEXT : BrowserContextOptions = {
2929 ...BASE_CONTEXT ,
30- viewport : { height : 568 , width : 320 } ,
30+ viewport : { height : 740 , width : 364 } ,
3131} ;
3232const MODELS = [
3333 { id : "gpt-5.5" , name : "GPT 5.5" , provider : "openai" } ,
@@ -127,7 +127,20 @@ suite.define(() => {
127127 it ( "keeps the mobile footer controls separated and reveals session modes on hover or focus" , async ( ) => {
128128 await withNewSessionPage ( MOBILE_CONTEXT , async ( page ) => {
129129 await installMockGateway ( page , {
130- models : [ { id : "gpt-5.6-sol" , name : "GPT 5.6 Sol" , provider : "openai" } ] ,
130+ models : [
131+ {
132+ id : "gpt-5.6-luna" ,
133+ name : "GPT 5.6 Luna" ,
134+ provider : "openai" ,
135+ contextWindow : 400_000 ,
136+ } ,
137+ {
138+ id : "claude-sonnet-4-6" ,
139+ name : "Claude Sonnet 4.6" ,
140+ provider : "anthropic" ,
141+ contextWindow : 200_000 ,
142+ } ,
143+ ] ,
131144 hasMultipleSessionSharingIdentities : true ,
132145 } ) ;
133146 await page . goto ( `${ suite . server . baseUrl } new` ) ;
@@ -178,23 +191,49 @@ suite.define(() => {
178191 expect ( modelBox ) . not . toBeNull ( ) ;
179192 expect ( ( attachBox ?. x ?? 0 ) + ( attachBox ?. width ?? 0 ) ) . toBeLessThanOrEqual ( draftBox ?. x ?? 0 ) ;
180193 expect ( ( draftBox ?. x ?? 0 ) + ( draftBox ?. width ?? 0 ) ) . toBeLessThanOrEqual ( incognitoBox ?. x ?? 0 ) ;
181- expect ( ( incognitoBox ?. x ?? 0 ) + ( incognitoBox ?. width ?? 0 ) ) . toBeLessThanOrEqual (
182- modelBox ?. x ?? 0 ,
183- ) ;
184194 for ( const control of [ attachBox , draftBox , incognitoBox , modelBox ] ) {
185195 expect ( control ?. x ?? 0 ) . toBeGreaterThanOrEqual ( footerBox ?. x ?? 0 ) ;
186196 expect ( ( control ?. x ?? 0 ) + ( control ?. width ?? 0 ) ) . toBeLessThanOrEqual (
187197 ( footerBox ?. x ?? 0 ) + ( footerBox ?. width ?? 0 ) ,
188198 ) ;
189199 }
190200 // The new-session footer keeps flex (not the shared chat mobile grid), so
191- // all four controls share one 320px row; wrap or overflow here means the
192- // new-session.css mobile override regressed.
201+ // its transient mode switches can wrap before the model picker overflows.
193202 const controlsOverflow = await footer . evaluate (
194203 ( element ) => element . scrollWidth - element . clientWidth ,
195204 ) ;
196205 expect ( controlsOverflow ) . toBe ( 0 ) ;
197206
207+ const picker = newSessionModelPicker ( page ) ;
208+ await picker . click ( ) ;
209+ await expect . poll ( ( ) => picker . getAttribute ( "open" ) ) . toBe ( "" ) ;
210+ const optionLabelWidths = await picker . locator ( "wa-option" ) . evaluateAll ( ( options ) =>
211+ options . flatMap ( ( option ) => {
212+ if ( option . getBoundingClientRect ( ) . width === 0 ) {
213+ return [ ] ;
214+ }
215+ const label = option . querySelector < HTMLElement > ( ".picker-select__label" ) ! ;
216+ const probe = document . createElement ( "span" ) ;
217+ probe . style . cssText = `position:fixed;visibility:hidden;width:8ch;font:${ getComputedStyle ( label ) . font } ` ;
218+ document . body . append ( probe ) ;
219+ const minimum = probe . getBoundingClientRect ( ) . width ;
220+ probe . remove ( ) ;
221+ return [
222+ {
223+ label : label . textContent ?. trim ( ) ,
224+ minimum,
225+ width : label . getBoundingClientRect ( ) . width ,
226+ } ,
227+ ] ;
228+ } ) ,
229+ ) ;
230+ expect ( optionLabelWidths . length ) . toBeGreaterThanOrEqual ( 2 ) ;
231+ for ( const entry of optionLabelWidths ) {
232+ expect ( entry . width , JSON . stringify ( entry ) ) . toBeGreaterThanOrEqual ( entry . minimum ) ;
233+ }
234+ await captureUiProof ( page , "mobile-model-picker-labels.png" ) ;
235+ await picker . click ( ) ;
236+
198237 await attach . click ( ) ;
199238 await expect . poll ( ( ) => takePhoto . isVisible ( ) ) . toBe ( true ) ;
200239 await page . keyboard . press ( "Escape" ) ;
0 commit comments