Monkeypatch each iframe (#716)
* `setTimeout` and `clearTimeout` are global functions. Think the window versions of them were for the following reason: https://stackoverflow.com/questions/60245787/ * Comments and extra test here helped me understand which inserts were expected and which are to be ignored * Add a test for the style setProperty/removeProperty added in #671 * Add a test to ensure that listeners get added correctly in nested iframes - particularly important for those which rely on prototype monkeypatching * Pass in the window object from the current iframe so that monkeypatching applies to all windows * Satisfy typings * No need to insert an iframe as there's one already set up for us * Enable the console logger to also intercept log messages within iframes * There's no tests for FontFace but presumably the monkeypatching here works similarly to the others
This commit is contained in:
@@ -471,8 +471,15 @@ describe('record integration tests', function (this: ISuite) {
|
||||
console.trace('trace');
|
||||
console.warn('warn');
|
||||
console.clear();
|
||||
const iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
|
||||
await page.frames()[1].evaluate(() => {
|
||||
console.log('from iframe');
|
||||
});
|
||||
|
||||
|
||||
const snapshots = await page.evaluate('window.snapshots');
|
||||
assertSnapshot(snapshots, __filename, 'log');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user