@@ -160,6 +160,40 @@ for (const viewport of [
160160 } ) ;
161161}
162162
163+ for ( const viewport of [
164+ { name : 'mobile' , width : 390 , height : 844 } ,
165+ { name : 'desktop' , width : 1440 , height : 900 } ,
166+ ] ) {
167+ test ( `audio.cpp deployment is stable at ${ viewport . name } ` , async ( { page } , testInfo ) => {
168+ await page . setViewportSize ( viewport ) ;
169+ await page . goto ( '/deploy/audio-cpp.html' ) ;
170+
171+ await expect ( page . locator ( 'h1' ) ) . toHaveText ( 'audio.cpp 原生 Fun-ASR-Nano 与 SenseVoice' ) ;
172+ await expect ( page . getByText ( 'pinned SenseVoice GGUF package' , { exact : false } ) ) . toBeVisible ( ) ;
173+ await expect ( page . locator ( 'a[href="https://github.com/0xShug0/audio.cpp/pull/219"]' ) ) . toBeVisible ( ) ;
174+
175+ const layout = await page . evaluate ( ( ) => ( {
176+ overflow : document . documentElement . scrollWidth - document . documentElement . clientWidth ,
177+ evidenceWidths : [ ...document . querySelectorAll < HTMLElement > ( '.evidence-list li' ) ] . map ( ( node ) => ( {
178+ client : node . clientWidth ,
179+ scroll : node . scrollWidth ,
180+ } ) ) ,
181+ commandWidths : [ ...document . querySelectorAll < HTMLElement > ( '.command-block' ) ] . map ( ( node ) => ( {
182+ parent : node . parentElement ?. getBoundingClientRect ( ) . width ?? 0 ,
183+ width : node . getBoundingClientRect ( ) . width ,
184+ } ) ) ,
185+ } ) ) ;
186+ expect ( layout . overflow ) . toBeLessThanOrEqual ( 1 ) ;
187+ expect ( layout . evidenceWidths . every ( ( { client, scroll } ) => scroll <= client + 1 ) ) . toBe ( true ) ;
188+ expect ( layout . commandWidths . every ( ( { parent, width } ) => width <= parent + 1 ) ) . toBe ( true ) ;
189+
190+ await page . screenshot ( {
191+ path : testInfo . outputPath ( `audio-cpp-${ viewport . name } .png` ) ,
192+ fullPage : true ,
193+ } ) ;
194+ } ) ;
195+ }
196+
163197test ( 'reduced motion disables smooth scrolling' , async ( { page } ) => {
164198 await page . emulateMedia ( { reducedMotion : 'reduce' } ) ;
165199 await page . goto ( '/en/' ) ;
0 commit comments