test: add test for navigator.userAgent in popups (#985)
This commit is contained in:
parent
05f8d001f8
commit
cb63021b2f
|
|
@ -20,18 +20,20 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('window.open', function() {
|
describe('window.open', function() {
|
||||||
it.skip(CHROMIUM)('should inherit user agent from browser context', async function({newContext, server}) {
|
it.skip(CHROMIUM || WEBKIT)('should inherit user agent from browser context', async function({newContext, server}) {
|
||||||
const context = await newContext({
|
const context = await newContext({
|
||||||
userAgent: 'hey'
|
userAgent: 'hey'
|
||||||
});
|
});
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const evaluatePromise = page.evaluate(url => window.open(url), server.PREFIX + '/dummy.html');
|
const requestPromise = server.waitForRequest('/dummy.html');
|
||||||
const popupPromise = page.waitForEvent('popup');
|
const userAgent = await page.evaluate(url => {
|
||||||
const request = await server.waitForRequest('/dummy.html');
|
const win = window.open(url);
|
||||||
await evaluatePromise;
|
return win.navigator.userAgent;
|
||||||
await popupPromise;
|
}, server.PREFIX + '/dummy.html');
|
||||||
|
const request = await requestPromise;
|
||||||
await context.close();
|
await context.close();
|
||||||
|
expect(userAgent).toBe('hey');
|
||||||
expect(request.headers['user-agent']).toBe('hey');
|
expect(request.headers['user-agent']).toBe('hey');
|
||||||
});
|
});
|
||||||
it.skip(CHROMIUM)('should inherit touch support from browser context', async function({newContext, server}) {
|
it.skip(CHROMIUM)('should inherit touch support from browser context', async function({newContext, server}) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue