test: unflake page-click.spec.ts test (#11050)

This commit is contained in:
Andrey Lushnikov 2021-12-21 17:31:13 -08:00 committed by GitHub
parent 9294947862
commit 1ee2d01f1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -834,11 +834,14 @@ it('should not hang when frame is detached', async ({ page, server, mode }) => {
button.style.marginLeft = '200px';
});
let detachPromise;
let resolveDetachPromise;
const detachPromise = new Promise(resolve => resolveDetachPromise = resolve);
const __testHookBeforeStable = () => {
// Detach the frame after "waiting for stable" has started.
setTimeout(() => {
detachPromise = detachFrame(page, 'frame1');
setTimeout(async () => {
await detachFrame(page, 'frame1');
resolveDetachPromise();
}, 1000);
};
const promise = frame.click('button', { __testHookBeforeStable } as any).catch(e => e);