test(beforeunload): add failing beforeunload test (#4188)
This commit is contained in:
parent
7433ae2798
commit
3cceb14e29
|
|
@ -26,3 +26,20 @@ it('should close page with active dialog', (test, { browserName, platform }) =>
|
|||
await page.waitForEvent('dialog');
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should access page after beforeunload', (test, { browserName }) => {
|
||||
test.fixme(browserName === 'firefox', 'Only works on WebKit atm');
|
||||
test.fixme(browserName === 'chromium');
|
||||
}, async ({context}) => {
|
||||
const page = await context.newPage();
|
||||
await page.evaluate(() => {
|
||||
window.addEventListener('beforeunload', event => {
|
||||
event.preventDefault();
|
||||
event.returnValue = 'Do you want to close page?';
|
||||
});
|
||||
});
|
||||
await page.close({ runBeforeUnload: true });
|
||||
const dialog = await page.waitForEvent('dialog');
|
||||
await dialog.dismiss();
|
||||
await page.evaluate(() => document.title);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import type { Browser, BrowserContext, BrowserContextOptions, BrowserType, Launc
|
|||
export { expect, config } from 'folio';
|
||||
|
||||
// Test timeout for e2e tests is 30 seconds.
|
||||
config.timeout = 30000;
|
||||
config.timeout = Math.max(config.timeout, 30000);
|
||||
|
||||
// Parameters ------------------------------------------------------------------
|
||||
// ... these can be used to run tests in different modes.
|
||||
|
|
|
|||
Loading…
Reference in a new issue