@@ -46,29 +46,21 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
46
46
state . browser = null ;
47
47
} ) ;
48
48
it . fail ( true ) ( 'should report oopif frames' , async function ( { browser, page, server, context} ) {
49
- const browserSession = await browser . createBrowserSession ( ) ;
50
- await browserSession . send ( 'Target.setDiscoverTargets' , { discover : true } ) ;
51
- const oopifs = [ ] ;
52
- browserSession . on ( 'Target.targetCreated' , async ( { targetInfo} ) => {
53
- if ( targetInfo . type === 'iframe' )
54
- oopifs . push ( targetInfo ) ;
55
- } ) ;
56
49
await page . goto ( server . PREFIX + '/dynamic-oopif.html' ) ;
57
- expect ( oopifs . length ) . toBe ( 1 ) ;
50
+ expect ( await countOOPIFs ( browser ) ) . toBe ( 1 ) ;
58
51
expect ( page . frames ( ) . length ) . toBe ( 2 ) ;
59
52
} ) ;
60
53
it ( 'should load oopif iframes with subresources and request interception' , async function ( { browser, page, server, context} ) {
61
54
await page . route ( '**/*' , request => request . continue ( ) ) ;
62
- const browserSession = await browser . createBrowserSession ( ) ;
63
- await browserSession . send ( 'Target.setDiscoverTargets' , { discover : true } ) ;
64
- const oopifs = [ ] ;
65
- browserSession . on ( 'Target.targetCreated' , async ( { targetInfo} ) => {
66
- if ( targetInfo . type === 'iframe' )
67
- oopifs . push ( targetInfo ) ;
68
- } ) ;
69
55
await page . goto ( server . PREFIX + '/dynamic-oopif.html' ) ;
70
- expect ( oopifs . length ) . toBe ( 1 ) ;
71
- await browserSession . detach ( ) ;
56
+ expect ( await countOOPIFs ( browser ) ) . toBe ( 1 ) ;
57
+ } ) ;
58
+ // @see https://github.com/microsoft/playwright/issues/1240
59
+ xit ( 'should click a button when it overlays oopif' , async function ( { browser, page, server, context} ) {
60
+ await page . goto ( server . PREFIX + '/button-overlay-oopif.html' ) ;
61
+ expect ( await countOOPIFs ( browser ) ) . toBe ( 1 ) ;
62
+ await page . click ( 'button' ) ;
63
+ expect ( await page . evaluate ( ( ) => window . BUTTON_CLICKED ) ) . toBe ( true ) ;
72
64
} ) ;
73
65
it . fail ( true ) ( 'should report google.com frame with headful' , async ( { server} ) => {
74
66
// TODO: Support OOOPIF. @see https://github.com/GoogleChrome/puppeteer/issues/2548
@@ -94,4 +86,16 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
94
86
await browser . close ( ) ;
95
87
} ) ;
96
88
} ) ;
97
- } ;
89
+ } ;
90
+
91
+ async function countOOPIFs ( browser ) {
92
+ const browserSession = await browser . createBrowserSession ( ) ;
93
+ const oopifs = [ ] ;
94
+ browserSession . on ( 'Target.targetCreated' , async ( { targetInfo} ) => {
95
+ if ( targetInfo . type === 'iframe' )
96
+ oopifs . push ( targetInfo ) ;
97
+ } ) ;
98
+ await browserSession . send ( 'Target.setDiscoverTargets' , { discover : true } ) ;
99
+ await browserSession . detach ( ) ;
100
+ return oopifs . length ;
101
+ }
0 commit comments