|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -const {FFOX, CHROMIUM, WEBKIT} = require('./utils').testOptions(browserType); |
| 17 | +const {FFOX, CHROMIUM, WEBKIT, MAC} = require('./utils').testOptions(browserType); |
18 | 18 |
|
19 | 19 | describe('Link navigation', function() {
|
20 | 20 | it('should inherit user agent from browser context', async function({browser, server}) {
|
@@ -304,6 +304,43 @@ describe('Page.Events.Popup', function() {
|
304 | 304 | expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
305 | 305 | await context.close();
|
306 | 306 | });
|
| 307 | + it.fail(true)('should work with Shift-clicking', async({browser, server}) => { |
| 308 | + // Chromium: |
| 309 | + // - Shift+Click fires frameRequestedNavigation that never materializes |
| 310 | + // because it actually opens a new window. |
| 311 | + // - New window does not report an opener. |
| 312 | + // WebKit: Shift+Click does not open a new window. |
| 313 | + // Firefox: new window does not report an opener. |
| 314 | + const context = await browser.newContext(); |
| 315 | + const page = await context.newPage(); |
| 316 | + await page.goto(server.EMPTY_PAGE); |
| 317 | + await page.setContent('<a href="/one-style.html">yo</a>'); |
| 318 | + const [popup] = await Promise.all([ |
| 319 | + page.waitForEvent('popup'), |
| 320 | + page.click('a', { modifiers: ['Shift'] }), |
| 321 | + ]); |
| 322 | + expect(await page.evaluate(() => !!window.opener)).toBe(false); |
| 323 | + expect(await popup.evaluate(() => !!window.opener)).toBe(true); |
| 324 | + await context.close(); |
| 325 | + }); |
| 326 | + it.fail(CHROMIUM || WEBKIT)('should work with Control-clicking', async({browser, server}) => { |
| 327 | + // Chromium: |
| 328 | + // - Shift+Click fires frameRequestedNavigation that never materializes |
| 329 | + // because it actually opens a new tab. |
| 330 | + // - New tab does not report an opener. |
| 331 | + // WebKit: Shift+Click does not open a new tab. |
| 332 | + const context = await browser.newContext(); |
| 333 | + const page = await context.newPage(); |
| 334 | + await page.goto(server.EMPTY_PAGE); |
| 335 | + await page.setContent('<a href="/one-style.html">yo</a>'); |
| 336 | + const [popup] = await Promise.all([ |
| 337 | + page.waitForEvent('popup'), |
| 338 | + page.click('a', { modifiers: [MAC ? 'Meta' : 'Control'] }), |
| 339 | + ]); |
| 340 | + expect(await page.evaluate(() => !!window.opener)).toBe(false); |
| 341 | + expect(await popup.evaluate(() => !!window.opener)).toBe(false); |
| 342 | + await context.close(); |
| 343 | + }); |
307 | 344 | it('should work with fake-clicking target=_blank and rel=noopener', async({browser, server}) => {
|
308 | 345 | const context = await browser.newContext();
|
309 | 346 | const page = await context.newPage();
|
|
0 commit comments