test: rebase headless-shell/--headless=new/Edge tests (#33350)
This commit is contained in:
parent
64802fc284
commit
512645463e
|
|
@ -163,6 +163,7 @@ export async function openTraceViewerApp(url: string, browserName: string, optio
|
||||||
...options?.persistentContextOptions,
|
...options?.persistentContextOptions,
|
||||||
useWebSocket: isUnderTest(),
|
useWebSocket: isUnderTest(),
|
||||||
headless: !!options?.headless,
|
headless: !!options?.headless,
|
||||||
|
colorScheme: isUnderTest() ? 'light' : undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ import net from 'net';
|
||||||
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy';
|
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy';
|
||||||
import { SocksProxy } from '../../packages/playwright-core/lib/common/socksProxy';
|
import { SocksProxy } from '../../packages/playwright-core/lib/common/socksProxy';
|
||||||
|
|
||||||
|
// Certain browsers perform telemetry requests which we want to ignore.
|
||||||
|
const kConnectHostsToIgnore = new Set([
|
||||||
|
'www.bing.com:443',
|
||||||
|
]);
|
||||||
|
|
||||||
export class TestProxy {
|
export class TestProxy {
|
||||||
readonly PORT: number;
|
readonly PORT: number;
|
||||||
readonly URL: string;
|
readonly URL: string;
|
||||||
|
|
@ -63,6 +68,8 @@ export class TestProxy {
|
||||||
this._prependHandler('connect', (req: IncomingMessage) => {
|
this._prependHandler('connect', (req: IncomingMessage) => {
|
||||||
if (!options?.allowConnectRequests)
|
if (!options?.allowConnectRequests)
|
||||||
return;
|
return;
|
||||||
|
if (kConnectHostsToIgnore.has(req.url))
|
||||||
|
return;
|
||||||
this.connectHosts.push(req.url);
|
this.connectHosts.push(req.url);
|
||||||
req.url = `127.0.0.1:${port}`;
|
req.url = `127.0.0.1:${port}`;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,8 @@ for (const kind of ['launchServer', 'run-server'] as const) {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should ignore page.pause when headed', async ({ connect, startRemoteServer, browserType }) => {
|
test('should ignore page.pause when headed', async ({ connect, startRemoteServer, browserType, channel }) => {
|
||||||
|
test.skip(channel === 'chromium-headless-shell', 'Headless Shell does not support headed mode');
|
||||||
const headless = (browserType as any)._defaultLaunchOptions.headless;
|
const headless = (browserType as any)._defaultLaunchOptions.headless;
|
||||||
(browserType as any)._defaultLaunchOptions.headless = false;
|
(browserType as any)._defaultLaunchOptions.headless = false;
|
||||||
const remoteServer = await startRemoteServer(kind);
|
const remoteServer = await startRemoteServer(kind);
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ it('should not generate dispatchers for subresources w/o listeners', async ({ pa
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work with the domain module', async ({ browserType, server, browserName }) => {
|
it('should work with the domain module', async ({ browserType, server, browserName, channel }) => {
|
||||||
const local = domain.create();
|
const local = domain.create();
|
||||||
local.run(() => { });
|
local.run(() => { });
|
||||||
let err;
|
let err;
|
||||||
|
|
@ -262,7 +262,7 @@ it('should work with the domain module', async ({ browserType, server, browserNa
|
||||||
if (browserName === 'firefox')
|
if (browserName === 'firefox')
|
||||||
expect(message).toBe('CLOSE_ABNORMAL');
|
expect(message).toBe('CLOSE_ABNORMAL');
|
||||||
else
|
else
|
||||||
expect(message).toContain(': 400');
|
expect(message).toContain(channel?.includes('msedge') ? '' : ': 400');
|
||||||
|
|
||||||
await browser.close();
|
await browser.close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,8 @@ it('should click a button when it overlays oopif', async function({ page, browse
|
||||||
expect(await page.evaluate(() => (window as any)['BUTTON_CLICKED'])).toBe(true);
|
expect(await page.evaluate(() => (window as any)['BUTTON_CLICKED'])).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should report google.com frame with headed', async ({ browserType, server }) => {
|
it('should report google.com frame with headed', async ({ browserType, server, channel }) => {
|
||||||
|
it.skip(channel === 'chromium-headless-shell', 'Headless Shell does not support headed mode');
|
||||||
// @see https://github.com/GoogleChrome/puppeteer/issues/2548
|
// @see https://github.com/GoogleChrome/puppeteer/issues/2548
|
||||||
// https://google.com is isolated by default in Chromium embedder.
|
// https://google.com is isolated by default in Chromium embedder.
|
||||||
const browser = await browserType.launch({ headless: false });
|
const browser = await browserType.launch({ headless: false });
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ it('should emit binary frame events', async ({ page, server }) => {
|
||||||
expect(sent[1][i]).toBe(i);
|
expect(sent[1][i]).toBe(i);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit error', async ({ page, server, browserName }) => {
|
it('should emit error', async ({ page, server, browserName, channel }) => {
|
||||||
let callback;
|
let callback;
|
||||||
const result = new Promise(f => callback = f);
|
const result = new Promise(f => callback = f);
|
||||||
page.on('websocket', ws => ws.on('socketerror', callback));
|
page.on('websocket', ws => ws.on('socketerror', callback));
|
||||||
|
|
@ -148,7 +148,7 @@ it('should emit error', async ({ page, server, browserName }) => {
|
||||||
if (browserName === 'firefox')
|
if (browserName === 'firefox')
|
||||||
expect(message).toBe('CLOSE_ABNORMAL');
|
expect(message).toBe('CLOSE_ABNORMAL');
|
||||||
else
|
else
|
||||||
expect(message).toContain(': 400');
|
expect(message).toContain(channel?.includes('msedge') ? '' : ': 400');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not have stray error events', async ({ page, server }) => {
|
it('should not have stray error events', async ({ page, server }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue