@@ -16,11 +16,19 @@ afterAll(async() => {
1616 await browser . close ( ) ;
1717} , 15000 ) ;
1818
19- jest . setTimeout ( 999999 ) ;
19+ jest . setTimeout ( 120000 ) ;
2020describe ( 'ekoPlayer.load()' , ( ) => {
21+ let page ;
22+ beforeEach ( async ( ) => {
23+ page = await browser . newPage ( ) ;
24+ } ) ;
25+
26+ afterEach ( ( ) => {
27+ return page . close ( ) ;
28+ } ) ;
29+
2130 it ( `ekoPlayer.load(id, { autoplay: true }))
2231 check if autoplay set to true in query string` , async ( ) => {
23- const page = await browser . newPage ( ) ;
2432 await page . goto ( `file://${ __dirname } /../app.html` ) ;
2533
2634 await page . evaluate ( ( _testingProjectId ) => {
@@ -44,7 +52,6 @@ describe('ekoPlayer.load()', () => {
4452
4553 it ( `ekoPlayer.load(id, { autoplay: false }))
4654 check if autoplay set to false in query string` , async ( ) => {
47- const page = await browser . newPage ( ) ;
4855 await page . goto ( `file://${ __dirname } /../app.html` ) ;
4956
5057 await page . evaluate ( ( _testingProjectId ) => {
@@ -68,7 +75,6 @@ describe('ekoPlayer.load()', () => {
6875
6976 it ( `ekoPlayer.load(id, { iframeAttributes: {title: iframeTitle, ...}})
7077 check if iframeAttributes is the iframe attributes` , async ( ) => {
71- const page = await browser . newPage ( ) ;
7278 await page . goto ( `file://${ __dirname } /../app.html` ) ;
7379
7480 // Init EkoPlayer
@@ -110,7 +116,6 @@ describe('ekoPlayer.load()', () => {
110116
111117 it ( `ekoPlayer.load(id)
112118 check if pageParam1 & pageParam2 pass to iframe query string with correct values` , async ( ) => {
113- const page = await browser . newPage ( ) ;
114119 const passQueryParamKeys = [ 'pageParam1' , 'pageParam2' ] ;
115120 const passQueryParamValues = [ '1' , '2' ] ;
116121 await page . goto ( `file://${ __dirname } /../app.html?${ passQueryParamKeys [ 0 ] } =${ passQueryParamValues [ 0 ] } &${ passQueryParamKeys [ 1 ] } =${ passQueryParamValues [ 1 ] } ` ) ;
@@ -141,7 +146,6 @@ describe('ekoPlayer.load()', () => {
141146
142147 it ( `ekoPlayer.load(id, { params: { autoplay: true } })
143148 check that autoplay of query param override autoplay params value as iframe queryString ` , async ( ) => {
144- const page = await browser . newPage ( ) ;
145149 await page . goto ( `file://${ __dirname } /../app.html?autoplay=false` ) ;
146150
147151 // Init EkoPlayer
@@ -164,7 +168,6 @@ describe('ekoPlayer.load()', () => {
164168
165169 it ( `ekoPlayer.load(id, { excludePropagatedParams: ['autoplay'] })
166170 check that autoplay query param is not being forwarded to iframe` , async ( ) => {
167- const page = await browser . newPage ( ) ;
168171 await page . goto ( `file://${ __dirname } /../app.html?autoplay=false&coolio=yay` ) ;
169172
170173 // Init EkoPlayer
@@ -191,7 +194,6 @@ describe('ekoPlayer.load()', () => {
191194
192195 it ( `ekoPlayer.load(id, { events: ['nodestart', 'nodeend', 'playing', 'pause']})
193196 check that events is part of iframe query string ` , async ( ) => {
194- const page = await browser . newPage ( ) ;
195197 await page . goto ( `file://${ __dirname } /../app.html` ) ;
196198 const events = [ 'nodestart' , 'nodeend' , 'playing' , 'pause' ] ;
197199
@@ -217,7 +219,6 @@ describe('ekoPlayer.load()', () => {
217219
218220 it ( `ekoPlayer.load(id, { cover: DomCover, autoplay: false})
219221 check domCover autoplay false -> domCover class: eko-player-loaded` , async ( ) => {
220- const page = await browser . newPage ( ) ;
221222 await page . goto ( `file://${ __dirname } /../appWithDomCover.html` ) ;
222223
223224 // Init EkoPlayer
@@ -245,7 +246,6 @@ describe('ekoPlayer.load()', () => {
245246
246247 it ( `ekoPlayer.load(id, { cover: DomCover, autoplay: true})
247248 check domCover autoplay true -> domCover class: eko-player-started` , async ( ) => {
248- const page = await browser . newPage ( ) ;
249249 await page . goto ( `file://${ __dirname } /../appWithDomCover.html` ) ;
250250
251251 // Init EkoPlayer
@@ -270,7 +270,6 @@ describe('ekoPlayer.load()', () => {
270270
271271 it ( `ekoPlayer.load(id, { cover: callbackCover, autoplay: true})
272272 check callbackCover called for each state` , async ( ) => {
273- const page = await browser . newPage ( ) ;
274273 await page . goto ( `file://${ __dirname } /../app.html` ) ;
275274
276275 // Init EkoPlayer
@@ -303,7 +302,6 @@ describe('ekoPlayer.load()', () => {
303302
304303 it ( `ekoPlayer.load(id, { clientSideParams: {key: 'value'}})
305304 check if clientSideParams is set to true in query string` , async ( ) => {
306- const page = await browser . newPage ( ) ;
307305 await page . goto ( `file://${ __dirname } /../app.html` ) ;
308306
309307 // Init EkoPlayer
@@ -325,7 +323,6 @@ describe('ekoPlayer.load()', () => {
325323
326324 it ( `ekoPlayer.load(id, { clientSideParams: {key: 'value'}})
327325 check that clientSideParams have been set correctly in iframe` , async ( ) => {
328- const page = await browser . newPage ( ) ;
329326 await page . goto ( `file://${ __dirname } /../app.html` ) ;
330327 const CSP_OBJ = { key : 'value' } ;
331328 const IFRAME_ID = 'EKO_EMBED' ;
@@ -353,7 +350,6 @@ describe('ekoPlayer.load()', () => {
353350
354351 it ( `ekoPlayer.load(id, { clientSideParams: async () => {} })
355352 check that async clientSideParams have been set correctly in iframe` , async ( ) => {
356- const page = await browser . newPage ( ) ;
357353 await page . goto ( `file://${ __dirname } /../app.html` ) ;
358354 const CSP_OBJ = { coolio : 'ya' } ;
359355 const IFRAME_ID = 'EKO_EMBED' ;
@@ -388,7 +384,6 @@ describe('ekoPlayer.load()', () => {
388384
389385 it ( `ekoPlayer.load(id, { params: { id: abcde, embedapi: 3.0 } })
390386 check options params override default values and id args ` , async ( ) => {
391- const page = await browser . newPage ( ) ;
392387 await page . goto ( `file://${ __dirname } /../app.html?autoplay=false` ) ;
393388
394389 const overrideId = 'abcde' ;
@@ -425,11 +420,18 @@ describe('ekoPlayer.load()', () => {
425420} ) ;
426421
427422describe ( 'ekoPlayer.on()' , ( ) => {
423+ let page ;
424+ beforeEach ( async ( ) => {
425+ page = await browser . newPage ( ) ;
426+ } ) ;
427+
428+ afterEach ( ( ) => {
429+ return page . close ( ) ;
430+ } ) ;
431+
428432 it ( `ekoplayer.on('nodestart', callback)
429433 check if nodestart callback fired` , async ( ) => {
430- const page = await browser . newPage ( ) ;
431434 await page . goto ( `file://${ __dirname } /../app.html` ) ;
432-
433435 await page . evaluate ( ( _testingProjectId ) => {
434436 window . onNodeStartCallBack = false ;
435437 let ekoPlayer = new EkoPlayer ( '#ekoPlayerEl' , '2.0' ) ;
@@ -455,7 +457,6 @@ describe('ekoPlayer.on()', () => {
455457
456458 it ( `ekoplayer.on('customTestEvent', callback)
457459 check if on customTestEvent callback fired & callback args are separtiated` , async ( ) => {
458- const page = await browser . newPage ( ) ;
459460 await page . goto ( `file://${ __dirname } /../app.html` ) ;
460461
461462 await page . evaluate ( ( _testingProjectId ) => {
@@ -494,8 +495,16 @@ describe('ekoPlayer.on()', () => {
494495} ) ;
495496
496497describe ( 'ekoPlayer.invoke()' , ( ) => {
498+ let page ;
499+ beforeEach ( async ( ) => {
500+ page = await browser . newPage ( ) ;
501+ } ) ;
502+
503+ afterEach ( ( ) => {
504+ return page . close ( ) ;
505+ } ) ;
506+
497507 it ( `ekoplayer.invoke('pause')` , async ( ) => {
498- const page = await browser . newPage ( ) ;
499508 await page . goto ( `file://${ __dirname } /../app.html` ) ;
500509
501510 await page . evaluate ( ( _testingProjectId ) => {
0 commit comments