test: add a test for a button that closes popup (#20672)
References #20093 Signed-off-by: Andrey Lushnikov <aslushnikov@gmail.com>
This commit is contained in:
parent
b736b0cc2d
commit
852b4bee0c
|
|
@ -38,6 +38,22 @@ it('should click button inside frameset', async ({ page, server }) => {
|
||||||
expect(await frame.evaluate('result')).toBe('Clicked');
|
expect(await frame.evaluate('result')).toBe('Clicked');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should click a button that closes popup', async ({ page }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20093' });
|
||||||
|
const [popup] = await Promise.all([
|
||||||
|
page.waitForEvent('popup'),
|
||||||
|
page.evaluate(() => window.open('')),
|
||||||
|
]);
|
||||||
|
await popup.setContent(`<button>clickme</button>`);
|
||||||
|
await popup.$eval('button', body => body.addEventListener('click', () => {
|
||||||
|
window.close();
|
||||||
|
}));
|
||||||
|
await Promise.all([
|
||||||
|
popup.locator('button').click(), // throws in Firefox, but not in Chromium or WebKit
|
||||||
|
popup.waitForEvent('close'),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should issue clicks in parallel in page and popup', async ({ page, server }) => {
|
it('should issue clicks in parallel in page and popup', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/counter.html');
|
await page.goto(server.PREFIX + '/counter.html');
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue