Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: submit form with target=_blank (#20462)

Yury Semikhatsky03b15f655044
diff --git a/tests/page/page-navigation.spec.ts b/tests/page/page-navigation.spec.ts
index 07571a32b5..eb85adad01 100644
--- a/tests/page/page-navigation.spec.ts
+++ b/tests/page/page-navigation.spec.ts
@@ -32,3 +32,28 @@ it('should work with cross-process _blank target', async ({ page, server }) => {
await page.goto(server.EMPTY_PAGE);
await page.click('"Click me"');
});
+
+it('should work with _blank target in form', async ({ page, server, browserName }) => {
+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18392' });
+ it.fixme(browserName === 'webkit');
+ server.setRoute('/done.html?', (req, res) => {
+ res.end(`Done`);
+ });
+ await page.goto(server.EMPTY_PAGE);
+
+ page.setContent(`<form target="_blank" action="done.html" >
+ <input type="submit" value="Click me">
+ </form>`);
+ await Promise.all([
+ page.waitForEvent('popup'),
+ page.click('"Click me"')
+ ]);
+
+ page.setContent(`<form target="_blank" action="done.html" method="post">
+ <input type="submit" value="Click me">
+ </form>`);
+ await Promise.all([
+ page.waitForEvent('popup'),
+ page.click('"Click me"')
+ ]);
+});