1- import { test as base , chromium , type BrowserContext } from ' @playwright/test' ;
2- import path from ' path' ;
1+ import { test as base , chromium , type BrowserContext } from " @playwright/test" ;
2+ import path from " path" ;
33
4- const pathToExtension = path . resolve ( ' .output/chrome-mv3' ) ;
4+ const pathToExtension = path . resolve ( " .output/chrome-mv3" ) ;
55
66export const test = base . extend < {
77 context : BrowserContext ;
88 extensionId : string ;
99} > ( {
1010 context : async ( { } , use ) => {
11- const context = await chromium . launchPersistentContext ( '' , {
11+ const context = await chromium . launchPersistentContext ( "" , {
1212 headless : false ,
1313 args : [
1414 `--disable-extensions-except=${ pathToExtension } ` ,
@@ -20,16 +20,16 @@ export const test = base.extend<{
2020 } ,
2121 extensionId : async ( { context } , use ) => {
2222 let background : { url ( ) : string } ;
23- if ( pathToExtension . endsWith ( ' -mv3' ) ) {
23+ if ( pathToExtension . endsWith ( " -mv3" ) ) {
2424 [ background ] = context . serviceWorkers ( ) ;
25- if ( ! background ) background = await context . waitForEvent ( ' serviceworker' ) ;
25+ if ( ! background ) background = await context . waitForEvent ( " serviceworker" ) ;
2626 } else {
2727 [ background ] = context . backgroundPages ( ) ;
2828 if ( ! background )
29- background = await context . waitForEvent ( ' backgroundpage' ) ;
29+ background = await context . waitForEvent ( " backgroundpage" ) ;
3030 }
3131
32- const extensionId = background . url ( ) . split ( '/' ) [ 2 ] ;
32+ const extensionId = background . url ( ) . split ( "/" ) [ 2 ] ;
3333 await use ( extensionId ) ;
3434 } ,
3535} ) ;
0 commit comments