fix(connect): report all frames in existing page to the client (#8910)
This commit is contained in:
parent
5f704edc6c
commit
bdea9c74c4
|
|
@ -79,6 +79,10 @@ export class PageDispatcher extends Dispatcher<Page, channels.PageInitializer, c
|
||||||
page.on(Page.Events.Video, (artifact: Artifact) => this._dispatchEvent('video', { artifact: existingDispatcher<ArtifactDispatcher>(artifact) }));
|
page.on(Page.Events.Video, (artifact: Artifact) => this._dispatchEvent('video', { artifact: existingDispatcher<ArtifactDispatcher>(artifact) }));
|
||||||
if (page._video)
|
if (page._video)
|
||||||
this._dispatchEvent('video', { artifact: existingDispatcher<ArtifactDispatcher>(page._video) });
|
this._dispatchEvent('video', { artifact: existingDispatcher<ArtifactDispatcher>(page._video) });
|
||||||
|
// Ensure client knows about all frames.
|
||||||
|
const frames = page._frameManager.frames();
|
||||||
|
for (let i = 1; i < frames.length; i++)
|
||||||
|
this._onFrameAttached(frames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
page(): Page {
|
page(): Page {
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,28 @@ playwrightTest('should connect to an existing cdp session twice', async ({ brows
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
playwrightTest('should connect to existing page with iframe and navigate', async ({ browserType, browserOptions, server }, testInfo) => {
|
||||||
|
const port = 9339 + testInfo.workerIndex;
|
||||||
|
const browserServer = await browserType.launch({
|
||||||
|
...browserOptions,
|
||||||
|
args: ['--remote-debugging-port=' + port]
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
{
|
||||||
|
const context1 = await browserServer.newContext();
|
||||||
|
const page = await context1.newPage();
|
||||||
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
|
}
|
||||||
|
const cdpBrowser = await browserType.connectOverCDP(`http://localhost:${port}/`);
|
||||||
|
const contexts = cdpBrowser.contexts();
|
||||||
|
expect(contexts.length).toBe(1);
|
||||||
|
await contexts[0].pages()[0].goto(server.EMPTY_PAGE);
|
||||||
|
await cdpBrowser.close();
|
||||||
|
} finally {
|
||||||
|
await browserServer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
playwrightTest('should connect to existing service workers', async ({browserType, browserOptions, server}, testInfo) => {
|
playwrightTest('should connect to existing service workers', async ({browserType, browserOptions, server}, testInfo) => {
|
||||||
const port = 9339 + testInfo.workerIndex;
|
const port = 9339 + testInfo.workerIndex;
|
||||||
const browserServer = await browserType.launch({
|
const browserServer = await browserType.launch({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue