@@ -165,16 +165,19 @@ it('should not change default locale in another context', async ({ browser }) =>
165165 }
166166} ) ;
167167
168- it ( 'should format number in workers' , async ( { browser, browserName, server } ) => {
168+ it ( 'should propagate locale to workers' , async ( { browser, browserName, server } ) => {
169169 it . fail ( browserName === 'firefox' , 'https://github.com/microsoft/playwright/issues/38919' ) ;
170170 const context = await browser . newContext ( { locale : 'ru-RU' } ) ;
171171 const page = await context . newPage ( ) ;
172172 await page . goto ( server . EMPTY_PAGE ) ;
173- const [ worker ] = await Promise . all ( [
174- page . waitForEvent ( 'worker ' ) ,
175- page . evaluate ( ( ) => new Worker ( URL . createObjectURL ( new Blob ( [ 'console.log(1 )' ] , { type : 'application/javascript' } ) ) ) ) ,
173+ const [ msg ] = await Promise . all ( [
174+ page . waitForEvent ( 'console ' ) ,
175+ page . evaluate ( ( ) => new Worker ( URL . createObjectURL ( new Blob ( [ 'console.log(Intl.NumberFormat().resolvedOptions().locale )' ] , { type : 'application/javascript' } ) ) ) ) ,
176176 ] ) ;
177- expect ( await worker . evaluate ( ( ) => ( 10000.20 ) . toLocaleString ( ) ) ) . toBe ( '10\u00A0000,2' ) ;
177+ if ( browserName === 'webkit' )
178+ expect ( msg . text ( ) ) . toContain ( 'ru' ) ; // Webkit on Ubuntu is "ru-RU", and on other platforms is "ru"
179+ else
180+ expect ( msg . text ( ) ) . toBe ( 'ru-RU' ) ;
178181 await context . close ( ) ;
179182} ) ;
180183
0 commit comments