test: add failing popup tests (#1849)
This commit is contained in:
parent
39c9a45219
commit
cf415bb45a
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
const utils = require('./utils');
|
||||
const {FFOX, CHROMIUM, WEBKIT} = utils.testOptions(browserType);
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC} = utils.testOptions(browserType);
|
||||
|
||||
describe('BrowserContext', function() {
|
||||
it('should create new context', async function({browser}) {
|
||||
|
|
@ -651,4 +651,36 @@ describe('Events.BrowserContext.Page', function() {
|
|||
]);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// Chromium: Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new window.
|
||||
// WebKit: Shift+Click does not open a new window.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
context.waitForEvent('page'),
|
||||
page.click('a', { modifiers: ['Shift'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Ctrl-clicking', async({browser, server}) => {
|
||||
// Chromium: Ctrl+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new tab.
|
||||
// WebKit: Ctrl+Click does not open a new tab.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
context.waitForEvent('page'),
|
||||
page.click('a', { modifiers: [ MAC ? 'Meta' : 'Control'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
await context.close();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = require('./utils').testOptions(browserType);
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC} = require('./utils').testOptions(browserType);
|
||||
|
||||
describe('Link navigation', function() {
|
||||
it('should inherit user agent from browser context', async function({browser, server}) {
|
||||
|
|
@ -304,6 +304,43 @@ describe('Page.Events.Popup', function() {
|
|||
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(true)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// Chromium:
|
||||
// - Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new window.
|
||||
// - New window does not report an opener.
|
||||
// WebKit: Shift+Click does not open a new window.
|
||||
// Firefox: new window does not report an opener.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.click('a', { modifiers: ['Shift'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Control-clicking', async({browser, server}) => {
|
||||
// Chromium:
|
||||
// - Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new tab.
|
||||
// - New tab does not report an opener.
|
||||
// WebKit: Shift+Click does not open a new tab.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.click('a', { modifiers: [MAC ? 'Meta' : 'Control'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
await context.close();
|
||||
});
|
||||
it('should work with fake-clicking target=_blank and rel=noopener', async({browser, server}) => {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
|
|
|||
Loading…
Reference in a new issue