@@ -104,3 +104,58 @@ test('Flowchart deletes a selected node at once and Undo puts it back', async ({
104104 await page . getByRole ( 'button' , { name : 'Undo' } ) . click ( ) ;
105105 await expect ( page . getByText ( 'Argument 1' , { exact : true } ) ) . toHaveCount ( 1 ) ;
106106} ) ;
107+
108+ // VS-05: a long motion and long item titles once widened the dashboard past a phone screen.
109+ for ( const locale of locales ) {
110+ test ( `Current Debate fits a 360px phone with sources attached in ${ locale } ` , { tag : '@smoke' } , async ( { page } ) => {
111+ const motion = 'This House believes that national governments should nationalise all critical digital infrastructure including undersea cables' ;
112+ await page . setViewportSize ( { width : 360 , height : 780 } ) ;
113+ await setLocale ( page , locale ) ;
114+ await stubSupabaseSession ( page ) ;
115+ await seedCurrentDebate ( page , motion ) ;
116+ await page . addInitScript ( ( { motion } ) => {
117+ const debateId = '00000000-0000-4000-8000-00000000d001' ;
118+ const now = Date . now ( ) ;
119+ const sources = [ 0 , 1 , 2 ] . map ( ( index ) => ( {
120+ id : `source-${ index } ` , title : `${ motion } source ${ index } ` , content : 'Evidence' , type : 'text' ,
121+ debateId, createdAt : now - index , isActive : true , folder : 'General' ,
122+ } ) ) ;
123+ const savedCases = [ 0 , 1 ] . map ( ( index ) => ( {
124+ id : `case-${ index } ` , title : `${ motion } case ${ index } ` , data : { motion } , createdAt : now - index ,
125+ debateId, side : index ? 'con' : 'pro' ,
126+ } ) ) ;
127+ window . localStorage . setItem ( 'debate-trainer-storage' , JSON . stringify ( {
128+ state : { ownerUserId : '00000000-0000-0000-0000-000000000001' , sourceLibrary : sources , savedCases, sourceFolders : [ 'General' ] } ,
129+ version : 1 ,
130+ } ) ) ;
131+ } , { motion } ) ;
132+
133+ await page . goto ( '/app/debate' ) ;
134+ await expect ( page . getByTestId ( 'debate-sources' ) . getByText ( `${ motion } source 0` ) ) . toBeVisible ( ) ;
135+ // The Load button stays on screen beside its truncated title.
136+ const load = await page . getByTestId ( 'debate-side-pro' ) . getByRole ( 'button' , { name : `${ motion } case 0` } ) . boundingBox ( ) ;
137+ expect ( load ) . not . toBeNull ( ) ;
138+ expect ( load ! . x + load ! . width ) . toBeLessThanOrEqual ( 360 ) ;
139+
140+ expect ( await page . evaluate ( ( ) => document . documentElement . scrollWidth ) ) . toBe ( 360 ) ;
141+ } ) ;
142+ }
143+
144+ // VS-09: picking a language closes the menu; the choice already persists.
145+ test ( 'language menu closes once a language is chosen' , { tag : '@smoke' } , async ( { page } ) => {
146+ await setLocale ( page , 'en' ) ;
147+ await page . goto ( '/' ) ;
148+ // Below lg the section links and the language control sit in the menu.
149+ const language = page . getByRole ( 'button' , { name : 'Language' } ) ;
150+ const openMenu = page . getByRole ( 'button' , { name : 'Open menu' } ) ;
151+ await expect ( language . or ( openMenu ) . first ( ) ) . toBeVisible ( ) ;
152+ if ( await openMenu . isVisible ( ) ) await openMenu . click ( ) ;
153+ await language . click ( ) ;
154+ const menu = page . getByRole ( 'radiogroup' , { name : 'Interface language' } ) ;
155+ await expect ( menu ) . toBeVisible ( ) ;
156+
157+ await menu . getByRole ( 'radio' , { name : 'Magyar' } ) . click ( ) ;
158+
159+ await expect ( page . getByRole ( 'radiogroup' ) ) . toHaveCount ( 0 ) ;
160+ await expect ( page . locator ( 'html' ) ) . toHaveAttribute ( 'lang' , 'hu' ) ;
161+ } ) ;
0 commit comments