@@ -7,27 +7,20 @@ const play = test.extend({
7
7
...playwright . servers ( [ ] , true ) ,
8
8
} ) ;
9
9
10
- play . setTimeout ( 60 * 1000 ) ;
11
-
12
10
play . describe ( 'browser service worker:' , ( ) => {
13
11
// DOM
14
12
const linkDOM = "a"
15
13
const textDOM = "body"
16
14
const debugDOM = "#debug"
17
- const errorLogs = [ ]
18
15
19
16
play . beforeEach ( async ( { servers, page} ) => {
20
17
await page . goto ( `http://localhost:${ servers [ 0 ] . port } /` ) ;
21
18
} )
22
19
23
20
play ( 'should properly load the content of an IPFS hash' , async ( { servers, page } ) => {
24
- page . on ( "console" , ( message ) => {
25
- if ( message . type ( ) === "error" ) {
26
- errorLogs . push ( message . text ( ) )
27
- }
28
- } )
21
+
29
22
page . on ( "pageerror" , ( err ) => {
30
- console . log ( err . message )
23
+ console . trace ( `pageerror: ${ err . message } ` )
31
24
} )
32
25
await page . waitForSelector ( textDOM )
33
26
await page . waitForSelector ( linkDOM )
@@ -40,25 +33,28 @@ play.describe('browser service worker:', () => {
40
33
} )
41
34
42
35
// const currentURL = await page.url();
43
- await page . goto ( `http://localhost:${ servers [ 0 ] . port } /ipfs/Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD` , { waitUntil : 'domcontentloaded ' } ) ;
44
- await page . waitForSelector ( textDOM )
36
+ await page . goto ( `http://localhost:${ servers [ 0 ] . port } /ipfs/Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD` , { waitUntil : 'load ' } ) ;
37
+ // await page.waitForSelector(textDOM)
45
38
46
- const elementFrame = await page . waitForSelector ( "iframe" )
47
- /**
48
- * @type {import('playwright').Frame }
49
- */
50
- // @ts -ignore
51
- const frame = await elementFrame . contentFrame ( )
52
- if ( frame == null ) {
53
- throw new Error ( 'frame is null' )
54
- }
55
- const frameText = await frame . textContent ( textDOM )
39
+ const frameText2 = page . frameLocator ( '#viewer' ) . locator ( textDOM )
40
+
41
+ expect ( await frameText2 . textContent ( ) ) . toContain ( "hello world" )
42
+
43
+ // const elementFrame = await page.waitForSelector("iframe")
44
+ // /**
45
+ // * @type {import('playwright').Frame }
46
+ // */
47
+ // // @ts -ignore
48
+ // const frame = await elementFrame.contentFrame()
49
+ // if (frame == null) {
50
+ // throw new Error('frame is null')
51
+ // }
52
+ // const frameText = await frame.textContent(textDOM)
56
53
57
- expect ( frameText ) . toContain ( "hello world" )
54
+ // expect(frameText).toContain("hello world")
58
55
} ) ;
59
56
60
57
play . afterAll ( async ( { servers} ) => {
61
- console . log ( "errorLogs" , errorLogs )
62
58
// now stop all servers
63
59
for ( const server of servers ) {
64
60
await server . stop ( )
0 commit comments