11// @vitest -environment jsdom
2- import { browserFixtureFlags , cleanupBrowserFixture , rehostSkinImages } from './browser-fixture.test-support' ;
2+ import { BROWSER_FIXTURE_LAUNCH_TIMEOUT_MS , BROWSER_FIXTURE_TEST_TIMEOUT_MS , browserFixtureFlags , cleanupBrowserFixture , rehostSkinImages } from './browser-fixture.test-support' ;
33import { existsSync , mkdtempSync , writeFileSync } from 'node:fs' ;
44import { execFileSync } from 'node:child_process' ;
55import { resolve } from 'node:path' ;
@@ -72,14 +72,14 @@ it.skipIf(!browser).each([1000, 700])('keeps the real welcome brand centered wit
7272 document.getElementById('result').textContent=JSON.stringify({active,after:{x:after.x,y:after.y,width:after.width,height:after.height},background,logo:document.querySelector('.welcome-scene__logo').getBoundingClientRect().width,brand:document.getElementById('welcome-scene-title').textContent,heading:document.getElementById(root.getAttribute('aria-labelledby')).tagName});
7373 </script></body></html>` ;
7474 const file = resolve ( scratch , 'welcome.html' ) ; writeFileSync ( file , html ) ;
75- const output = execFileSync ( browser ! , [ ...browserFixtureFlags ( ) , '--headless=new' , '--disable-gpu' , '--no-first-run' , `--user-data-dir=${ resolve ( scratch , 'profile' ) } ` , '--dump-dom' , pathToFileURL ( file ) . href ] , { windowsHide :true , encoding :'utf8' , timeout :20000 , stdio :'pipe' } ) ;
75+ const output = execFileSync ( browser ! , [ ...browserFixtureFlags ( ) , '--headless=new' , '--disable-gpu' , '--no-first-run' , `--user-data-dir=${ resolve ( scratch , 'profile' ) } ` , '--dump-dom' , pathToFileURL ( file ) . href ] , { windowsHide :true , encoding :'utf8' , timeout : BROWSER_FIXTURE_LAUNCH_TIMEOUT_MS , stdio :'pipe' } ) ;
7676 const result = JSON . parse ( output . match ( / < p r e i d = " r e s u l t " > ( .* ?) < \/ p r e > / s) ! [ 1 ] ) ;
7777 expect ( result . heading ) . toBe ( 'H1' ) ; expect ( result . brand ) . toContain ( 'OpenBitFun' ) ; expect ( result . logo ) . toBe ( 56 ) ;
7878 expect ( result . background ) . toBe ( 'rgba(0, 0, 0, 0)' ) ; expect ( result . active ) . toEqual ( result . after ) ;
7979 expect ( result . active . x + result . active . width / 2 ) . toBeCloseTo ( width / 2 , 0 ) ;
8080 expect ( result . active . y ) . toBeLessThan ( 300 ) ; expect ( result . active . y ) . toBeGreaterThan ( 100 ) ;
8181 } finally { await cleanupBrowserFixture ( scratch ) ; }
82- } , 30000 ) ;
82+ } , BROWSER_FIXTURE_TEST_TIMEOUT_MS ) ;
8383
8484
8585it . skipIf ( ! browser ) ( 'retains readable settings, tables and overlays when a hidden welcome remains mounted' , async ( ) => {
@@ -94,8 +94,8 @@ it.skipIf(!browser)('retains readable settings, tables and overlays when a hidde
9494 document.getElementById('viewport').setAttribute('data-openbitfun-state','empty');result.landing=style('frame');result.landingToolbar=style('toolbar');document.getElementById('viewport').removeAttribute('data-openbitfun-state');result.restored=style('frame');document.getElementById('result').textContent=JSON.stringify(result);
9595 </script></body></html>` ;
9696 const file = resolve ( scratch , 'reading.html' ) ; writeFileSync ( file , html ) ;
97- const output = execFileSync ( browser ! , [ ...browserFixtureFlags ( ) , '--headless=new' , '--disable-gpu' , '--no-first-run' , `--user-data-dir=${ resolve ( scratch , 'profile' ) } ` , '--dump-dom' , pathToFileURL ( file ) . href ] , { windowsHide :true , encoding :'utf8' , timeout :20000 , stdio :'pipe' } ) ;
97+ const output = execFileSync ( browser ! , [ ...browserFixtureFlags ( ) , '--headless=new' , '--disable-gpu' , '--no-first-run' , `--user-data-dir=${ resolve ( scratch , 'profile' ) } ` , '--dump-dom' , pathToFileURL ( file ) . href ] , { windowsHide :true , encoding :'utf8' , timeout : BROWSER_FIXTURE_LAUNCH_TIMEOUT_MS , stdio :'pipe' } ) ;
9898 const result = JSON . parse ( output . match ( / < p r e i d = " r e s u l t " > ( .* ?) < \/ p r e > / s) ! [ 1 ] ) ;
9999 expect ( result ) . toEqual ( { frame :'rgb(250, 246, 235)' , viewport :'rgb(250, 246, 235)' , toolbar :'rgb(232, 220, 196)' , card :'rgb(255, 252, 243)' , menu :'rgb(255, 252, 243)' , landing :'rgba(0, 0, 0, 0)' , landingToolbar :'rgba(0, 0, 0, 0)' , restored :'rgb(250, 246, 235)' } ) ;
100100 } finally { runtime . dispose ( ) ; await cleanupBrowserFixture ( scratch ) ; }
101- } , 30000 ) ;
101+ } , BROWSER_FIXTURE_TEST_TIMEOUT_MS ) ;
0 commit comments