@@ -17,8 +17,8 @@ play.describe('browser service worker:', () => {
17
17
await page . goto ( `http://localhost:${ servers [ 0 ] . port } /` ) ;
18
18
} )
19
19
20
- play ( 'should properly load the content of an IPFS hash' , async ( { servers, page } ) => {
21
-
20
+ play ( 'should properly load the content of an IPFS hash' , async ( { servers, page, context } ) => {
21
+ page . on ( 'console' , msg => console . log ( 'PAGE LOG:' , msg . text ( ) ) ) ;
22
22
page . on ( "pageerror" , ( err ) => {
23
23
console . trace ( `pageerror: ${ err . message } ` )
24
24
} )
@@ -32,11 +32,21 @@ play.describe('browser service worker:', () => {
32
32
state : 'attached'
33
33
} )
34
34
35
+ await page . evaluate ( async ( ) => {
36
+ const registration = await window . navigator . serviceWorker . getRegistration ( ) ;
37
+ console . log ( `registration?.active?.state: ` , registration ?. active ?. state ) ;
38
+ if ( registration ?. active ?. state === 'activated' ) {
39
+ return ;
40
+ }
41
+ await new Promise ( res => window . navigator . serviceWorker . addEventListener ( 'controllerchange' , res ) ) ;
42
+ } ) ;
43
+
35
44
// const currentURL = await page.url();
36
45
await page . goto ( `http://localhost:${ servers [ 0 ] . port } /ipfs/Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD` , { waitUntil : 'commit' } ) ;
37
46
await page . waitForSelector ( '#viewer' , { state : 'visible' } )
38
47
39
48
const frameText2 = page . frameLocator ( '#viewer' ) . locator ( textDOM )
49
+ await frameText2 . waitFor ( { state : 'visible' } )
40
50
41
51
// loop over all of the frames and log their content
42
52
const frames = await page . frames ( ) ;
0 commit comments