Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit d80d264

Browse files
committed
debugging
1 parent 364e961 commit d80d264

File tree

1 file changed

+12
-2
lines changed
  • examples/browser-service-worker/tests

1 file changed

+12
-2
lines changed

examples/browser-service-worker/tests/test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ play.describe('browser service worker:', () => {
1717
await page.goto(`http://localhost:${servers[0].port}/`);
1818
})
1919

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()));
2222
page.on("pageerror", (err) => {
2323
console.trace(`pageerror: ${err.message}`)
2424
})
@@ -32,11 +32,21 @@ play.describe('browser service worker:', () => {
3232
state: 'attached'
3333
})
3434

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+
3544
// const currentURL = await page.url();
3645
await page.goto(`http://localhost:${servers[0].port}/ipfs/Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD`, {waitUntil: 'commit'});
3746
await page.waitForSelector('#viewer', {state: 'visible'})
3847

3948
const frameText2 = page.frameLocator('#viewer').locator(textDOM)
49+
await frameText2.waitFor({state: 'visible'})
4050

4151
// loop over all of the frames and log their content
4252
const frames = await page.frames();

0 commit comments

Comments
 (0)