fix(infobar): account for infobar in headed mode (#9627)
This commit is contained in:
parent
9d03a85c30
commit
ba57be99a9
|
|
@ -85,6 +85,10 @@ export abstract class BrowserContext extends SdkObject {
|
||||||
this.fetchRequest = new BrowserContextFetchRequest(this);
|
this.fetchRequest = new BrowserContextFetchRequest(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPersistentContext(): boolean {
|
||||||
|
return this._isPersistentContext;
|
||||||
|
}
|
||||||
|
|
||||||
_setSelectors(selectors: Selectors) {
|
_setSelectors(selectors: Selectors) {
|
||||||
this._selectors = selectors;
|
this._selectors = selectors;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -974,6 +974,12 @@ class FrameSession {
|
||||||
insets = { width: 8, height: 85 };
|
insets = { width: 8, height: 85 };
|
||||||
else if (process.platform === 'darwin')
|
else if (process.platform === 'darwin')
|
||||||
insets = { width: 2, height: 80 };
|
insets = { width: 2, height: 80 };
|
||||||
|
if (this._crPage._browserContext.isPersistentContext()) {
|
||||||
|
// FIXME: Chrome bug: OOPIF router is confused when hit target is
|
||||||
|
// outside browser window.
|
||||||
|
// Account for the infobar here to work around the bug.
|
||||||
|
insets.height += 46;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
promises.push(this.setWindowBounds({
|
promises.push(this.setWindowBounds({
|
||||||
width: viewportSize.width + insets.width,
|
width: viewportSize.width + insets.width,
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,10 @@ function snapshotScript() {
|
||||||
iframe.setAttribute('src', 'data:text/html,<body style="background: #ddd"></body>');
|
iframe.setAttribute('src', 'data:text/html,<body style="background: #ddd"></body>');
|
||||||
} else {
|
} else {
|
||||||
// Append query parameters to inherit ?name= or ?time= values from parent.
|
// Append query parameters to inherit ?name= or ?time= values from parent.
|
||||||
const url = new URL('/trace' + src + window.location.search, window.location.href).toString();
|
const url = new URL('/trace' + src + window.location.search, window.location.href);
|
||||||
iframe.setAttribute('src', url);
|
url.searchParams.delete('pointX');
|
||||||
|
url.searchParams.delete('pointY');
|
||||||
|
iframe.setAttribute('src', url.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,3 +183,57 @@ it('Page.bringToFront should work', async ({ browserType, browserOptions }) => {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should click in OOPIF', async ({ browserName, browserType, browserOptions, createUserDataDir, server }) => {
|
||||||
|
it.fixme(browserName === 'chromium');
|
||||||
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||||
|
res.end(`<iframe src="${server.CROSS_PROCESS_PREFIX}/iframe.html"></iframe>`);
|
||||||
|
});
|
||||||
|
server.setRoute('/iframe.html', (req, res) => {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||||
|
res.end(`<button id="button" onclick="console.log('ok')">Submit</button>
|
||||||
|
<script>console.log('frame loaded')</script>`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const context = await browserType.launchPersistentContext(await createUserDataDir(), { ...browserOptions, headless: false });
|
||||||
|
const [page] = context.pages();
|
||||||
|
const consoleLog: string[] = [];
|
||||||
|
page.on('console', m => consoleLog.push(m.text()));
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
await page.frames()[1].click('text=Submit');
|
||||||
|
expect(consoleLog).toContain('ok');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should click bottom row w/ infobar in OOPIF', async ({ browserType, browserOptions, createUserDataDir, server }) => {
|
||||||
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||||
|
res.end(`
|
||||||
|
<style>
|
||||||
|
html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
|
||||||
|
iframe { position: absolute; bottom: 0; }
|
||||||
|
</style>
|
||||||
|
<iframe src="${server.CROSS_PROCESS_PREFIX}/iframe.html"></iframe>
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setRoute('/iframe.html', (req, res) => {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||||
|
res.end(`
|
||||||
|
<style>
|
||||||
|
html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
|
||||||
|
button { position: absolute; bottom: 0; }
|
||||||
|
</style>
|
||||||
|
<button id="button" onclick="console.log('ok')">Submit</button>`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const browserContext = await browserType.launchPersistentContext(await createUserDataDir(), { ...browserOptions, headless: false });
|
||||||
|
const [page] = browserContext.pages();
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
// Chrome bug! Investigate what's happening in the oopif router.
|
||||||
|
const consoleLog: string[] = [];
|
||||||
|
page.on('console', m => consoleLog.push(m.text()));
|
||||||
|
while (!consoleLog.includes('ok')) {
|
||||||
|
await page.waitForTimeout(100);
|
||||||
|
await page.frames()[1].click('text=Submit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue