mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: opener tab does not throttle rAF (#14564)
This commit is contained in:
parent
e912b6897d
commit
00b8d9f3db
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { browserTest as it, expect } from '../config/browserTest';
|
import { browserTest as it, expect } from '../config/browserTest';
|
||||||
|
import type { Page } from 'playwright-core';
|
||||||
|
|
||||||
it('should inherit user agent from browser context @smoke', async function({ browser, server }) {
|
it('should inherit user agent from browser context @smoke', async function({ browser, server }) {
|
||||||
const context = await browser.newContext({
|
const context = await browser.newContext({
|
||||||
@ -238,3 +239,31 @@ it('should not dispatch binding on a closed page', async function({ browser, ser
|
|||||||
else
|
else
|
||||||
expect(messages.join('|')).toBe('binding|close');
|
expect(messages.join('|')).toBe('binding|close');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not throttle rAF in the opener page', async ({ page, server, browserName }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/14557' });
|
||||||
|
it.fixme(browserName === 'firefox');
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
const [popup] = await Promise.all([
|
||||||
|
page.waitForEvent('popup'),
|
||||||
|
page.evaluate(() => { window.open('about:blank'); }),
|
||||||
|
]);
|
||||||
|
await Promise.all([
|
||||||
|
waitForRafs(page, 30),
|
||||||
|
waitForRafs(popup, 30)
|
||||||
|
]);
|
||||||
|
console.log('done');
|
||||||
|
});
|
||||||
|
|
||||||
|
async function waitForRafs(page: Page, count: number): Promise<void> {
|
||||||
|
await page.evaluate(count => new Promise<void>(resolve => {
|
||||||
|
const onRaf = () => {
|
||||||
|
--count;
|
||||||
|
if (!count)
|
||||||
|
resolve();
|
||||||
|
else
|
||||||
|
requestAnimationFrame(onRaf);
|
||||||
|
};
|
||||||
|
requestAnimationFrame(onRaf);
|
||||||
|
}), count);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user