Merge branch 'main' into ai-error-conversation
This commit is contained in:
commit
e6b81d85d8
|
|
@ -334,6 +334,8 @@ Whether to populate `'git.commit.info'` field of the [`property: TestConfig.meta
|
||||||
|
|
||||||
This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
This information will appear in the HTML and JSON reports and is available in the Reporter API.
|
||||||
|
|
||||||
|
On Github Actions, this feature is enabled by default.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
```js title="playwright.config.ts"
|
```js title="playwright.config.ts"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html style='scrollbar-gutter: stable both-edges;'>
|
||||||
<head>
|
<head>
|
||||||
<meta charset='UTF-8'>
|
<meta charset='UTF-8'>
|
||||||
<meta name='color-scheme' content='dark light'>
|
<meta name='color-scheme' content='dark light'>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webkit",
|
"name": "webkit",
|
||||||
"revision": "2132",
|
"revision": "2134",
|
||||||
"installByDefault": true,
|
"installByDefault": true,
|
||||||
"revisionOverrides": {
|
"revisionOverrides": {
|
||||||
"debian11-x64": "2105",
|
"debian11-x64": "2105",
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
||||||
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
|
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.1.90"
|
"node": ">=0.1.90"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,15 @@
|
||||||
**
|
**
|
||||||
|
|
||||||
[inprocess.ts]
|
[inprocess.ts]
|
||||||
|
common/
|
||||||
utils/
|
utils/
|
||||||
|
server/utils
|
||||||
|
|
||||||
[outofprocess.ts]
|
[outofprocess.ts]
|
||||||
client/
|
client/
|
||||||
|
common/
|
||||||
protocol/
|
protocol/
|
||||||
utils/
|
utils/
|
||||||
common/
|
utils/isomorphic
|
||||||
|
server/utils
|
||||||
|
common/
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import { PlaywrightServer } from './remote/playwrightServer';
|
import { PlaywrightServer } from './remote/playwrightServer';
|
||||||
import { createPlaywright } from './server/playwright';
|
import { createPlaywright } from './server/playwright';
|
||||||
import { createGuid } from './utils';
|
import { createGuid } from './server/utils/crypto';
|
||||||
import { ws } from './utilsBundle';
|
import { ws } from './utilsBundle';
|
||||||
|
|
||||||
import type { BrowserServer } from './client/browserType';
|
import type { BrowserServer } from './client/browserType';
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import { PlaywrightServer } from './remote/playwrightServer';
|
||||||
import { helper } from './server/helper';
|
import { helper } from './server/helper';
|
||||||
import { serverSideCallMetadata } from './server/instrumentation';
|
import { serverSideCallMetadata } from './server/instrumentation';
|
||||||
import { createPlaywright } from './server/playwright';
|
import { createPlaywright } from './server/playwright';
|
||||||
import { createGuid } from './utils';
|
import { createGuid } from './server/utils/crypto';
|
||||||
import { rewriteErrorMessage } from './utils/stackTrace';
|
import { rewriteErrorMessage } from './utils/isomorphic/stackTrace';
|
||||||
import { ws } from './utilsBundle';
|
import { ws } from './utilsBundle';
|
||||||
|
|
||||||
import type { BrowserServer, BrowserServerLauncher } from './client/browserType';
|
import type { BrowserServer, BrowserServerLauncher } from './client/browserType';
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import * as playwright from '../..';
|
import * as playwright from '../..';
|
||||||
import { PipeTransport } from '../protocol/transport';
|
import { PipeTransport } from '../utils/pipeTransport';
|
||||||
import { PlaywrightServer } from '../remote/playwrightServer';
|
import { PlaywrightServer } from '../remote/playwrightServer';
|
||||||
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
|
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
|
||||||
import { gracefullyProcessExitDoNotHang } from '../server/utils/processLauncher';
|
import { gracefullyProcessExitDoNotHang } from '../server/utils/processLauncher';
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,16 @@ import { ChannelOwner } from './channelOwner';
|
||||||
import { TargetClosedError, isTargetClosedError } from './errors';
|
import { TargetClosedError, isTargetClosedError } from './errors';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { isRegExp, isString } from '../utils/rtti';
|
import { isRegExp, isString } from '../utils/isomorphic/rtti';
|
||||||
import { monotonicTime } from '../utils/time';
|
import { monotonicTime } from '../utils/isomorphic/time';
|
||||||
import { raceAgainstDeadline } from '../utils/timeoutRunner';
|
import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';
|
||||||
|
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type { AndroidServerLauncherImpl } from '../androidServerImpl';
|
import type { AndroidServerLauncherImpl } from '../androidServerImpl';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
type Direction = 'down' | 'up' | 'left' | 'right';
|
type Direction = 'down' | 'up' | 'left' | 'right';
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { Stream } from './stream';
|
import { Stream } from './stream';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../common/fileUtils';
|
||||||
|
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import { CDPSession } from './cdpSession';
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { isTargetClosedError } from './errors';
|
import { isTargetClosedError } from './errors';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../common/fileUtils';
|
||||||
|
|
||||||
import type { BrowserType } from './browserType';
|
import type { BrowserType } from './browserType';
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,19 @@ import { Tracing } from './tracing';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { WebError } from './webError';
|
import { WebError } from './webError';
|
||||||
import { Worker } from './worker';
|
import { Worker } from './worker';
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../common/fileUtils';
|
||||||
import { headersObjectToArray } from '../utils/headers';
|
import { headersObjectToArray } from '../utils/isomorphic/headers';
|
||||||
import { urlMatchesEqual } from '../utils/isomorphic/urlMatch';
|
import { urlMatchesEqual } from '../utils/isomorphic/urlMatch';
|
||||||
import { isRegExp, isString } from '../utils/rtti';
|
import { isRegExp, isString } from '../utils/isomorphic/rtti';
|
||||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
import { rewriteErrorMessage } from '../utils/isomorphic/stackTrace';
|
||||||
|
|
||||||
import type { BrowserType } from './browserType';
|
import type { BrowserType } from './browserType';
|
||||||
import type { BrowserContextOptions, Headers, LaunchOptions, StorageState, WaitForEventOptions } from './types';
|
import type { BrowserContextOptions, Headers, LaunchOptions, StorageState, WaitForEventOptions } from './types';
|
||||||
import type * as structs from '../../types/structs';
|
import type * as structs from '../../types/structs';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type { URLMatch } from '../utils/isomorphic/urlMatch';
|
import type { URLMatch } from '../utils/isomorphic/urlMatch';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel> implements api.BrowserContext {
|
export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel> implements api.BrowserContext {
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ import { BrowserContext, prepareBrowserContextParams } from './browserContext';
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { envObjectToArray } from './clientHelper';
|
import { envObjectToArray } from './clientHelper';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { headersObjectToArray } from '../utils/headers';
|
import { headersObjectToArray } from '../utils/isomorphic/headers';
|
||||||
import { monotonicTime } from '../utils/time';
|
import { monotonicTime } from '../utils/isomorphic/time';
|
||||||
import { raceAgainstDeadline } from '../utils/timeoutRunner';
|
import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';
|
||||||
|
|
||||||
import type { Playwright } from './playwright';
|
import type { Playwright } from './playwright';
|
||||||
import type { ConnectOptions, LaunchOptions, LaunchPersistentContextOptions, LaunchServerOptions, Logger } from './types';
|
import type { ConnectOptions, LaunchOptions, LaunchPersistentContextOptions, LaunchServerOptions, Logger } from './types';
|
||||||
|
|
@ -100,7 +100,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||||
env: options.env ? envObjectToArray(options.env) : undefined,
|
env: options.env ? envObjectToArray(options.env) : undefined,
|
||||||
channel: options.channel,
|
channel: options.channel,
|
||||||
userDataDir: path.isAbsolute(userDataDir) ? userDataDir : path.resolve(userDataDir),
|
userDataDir: (path.isAbsolute(userDataDir) || !userDataDir) ? userDataDir : path.resolve(userDataDir),
|
||||||
};
|
};
|
||||||
return await this._wrapApiCall(async () => {
|
return await this._wrapApiCall(async () => {
|
||||||
const result = await this._channel.launchPersistentContext(persistentParams);
|
const result = await this._channel.launchPersistentContext(persistentParams);
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,15 @@
|
||||||
|
|
||||||
import { EventEmitter } from './eventEmitter';
|
import { EventEmitter } from './eventEmitter';
|
||||||
import { ValidationError, maybeFindValidator } from '../protocol/validator';
|
import { ValidationError, maybeFindValidator } from '../protocol/validator';
|
||||||
import { isUnderTest } from '../utils/debug';
|
import { isUnderTest } from '../utils/isomorphic/debug';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { captureLibraryStackTrace, stringifyStackFrames } from '../utils/isomorphic/stackTrace';
|
||||||
import { captureLibraryStackTrace, stringifyStackFrames } from '../utils/stackTrace';
|
|
||||||
import { zones } from '../utils/zones';
|
import { zones } from '../utils/zones';
|
||||||
|
|
||||||
import type { ClientInstrumentation } from './clientInstrumentation';
|
import type { ClientInstrumentation } from './clientInstrumentation';
|
||||||
import type { Connection } from './connection';
|
import type { Connection } from './connection';
|
||||||
import type { Logger } from './types';
|
import type { Logger } from './types';
|
||||||
import type { ValidatorContext } from '../protocol/validator';
|
import type { ValidatorContext } from '../protocol/validator';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
type Listener = (...args: any[]) => void;
|
type Listener = (...args: any[]) => void;
|
||||||
|
|
@ -158,7 +157,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
|
||||||
apiZone.params = params;
|
apiZone.params = params;
|
||||||
apiZone.reported = true;
|
apiZone.reported = true;
|
||||||
this._instrumentation.onApiCallBegin(apiZone);
|
this._instrumentation.onApiCallBegin(apiZone);
|
||||||
logApiCall(this._logger, `=> ${apiZone.apiName} started`);
|
logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);
|
||||||
return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);
|
return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);
|
||||||
}
|
}
|
||||||
// Since this api call is either internal, or has already been reported/traced once,
|
// Since this api call is either internal, or has already been reported/traced once,
|
||||||
|
|
@ -183,13 +182,13 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
|
||||||
|
|
||||||
if (isInternal === undefined)
|
if (isInternal === undefined)
|
||||||
isInternal = this._isInternalType;
|
isInternal = this._isInternalType;
|
||||||
const stackTrace = captureLibraryStackTrace();
|
const stackTrace = captureLibraryStackTrace(this._platform.pathSeparator);
|
||||||
const apiZone: ApiZone = { apiName: stackTrace.apiName, frames: stackTrace.frames, isInternal, reported: false, userData: undefined, stepId: undefined };
|
const apiZone: ApiZone = { apiName: stackTrace.apiName, frames: stackTrace.frames, isInternal, reported: false, userData: undefined, stepId: undefined };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await zones.run('apiZone', apiZone, async () => await func(apiZone));
|
const result = await zones.run('apiZone', apiZone, async () => await func(apiZone));
|
||||||
if (!isInternal) {
|
if (!isInternal) {
|
||||||
logApiCall(logger, `<= ${apiZone.apiName} succeeded`);
|
logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);
|
||||||
this._instrumentation.onApiCallEnd(apiZone);
|
this._instrumentation.onApiCallEnd(apiZone);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -204,7 +203,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
|
||||||
e.stack = '';
|
e.stack = '';
|
||||||
if (!isInternal) {
|
if (!isInternal) {
|
||||||
apiZone.error = e;
|
apiZone.error = e;
|
||||||
logApiCall(logger, `<= ${apiZone.apiName} failed`);
|
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
|
||||||
this._instrumentation.onApiCallEnd(apiZone);
|
this._instrumentation.onApiCallEnd(apiZone);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
@ -227,10 +226,10 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logApiCall(logger: Logger | undefined, message: string) {
|
function logApiCall(platform: Platform, logger: Logger | undefined, message: string) {
|
||||||
if (logger && logger.isEnabled('api', 'info'))
|
if (logger && logger.isEnabled('api', 'info'))
|
||||||
logger.log('api', 'info', message, [], { color: 'cyan' });
|
logger.log('api', 'info', message, [], { color: 'cyan' });
|
||||||
debugLogger.log('api', message);
|
platform.log('api', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {
|
function tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { isString } from '../utils/rtti';
|
import { isString } from '../utils/isomorphic/rtti';
|
||||||
|
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
|
|
||||||
export function envObjectToArray(env: types.Env): { name: string, value: string }[] {
|
export function envObjectToArray(env: types.Env): { name: string, value: string }[] {
|
||||||
const result: { name: string, value: string }[] = [];
|
const result: { name: string, value: string }[] = [];
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,13 @@ import { Tracing } from './tracing';
|
||||||
import { Worker } from './worker';
|
import { Worker } from './worker';
|
||||||
import { WritableStream } from './writableStream';
|
import { WritableStream } from './writableStream';
|
||||||
import { ValidationError, findValidator } from '../protocol/validator';
|
import { ValidationError, findValidator } from '../protocol/validator';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { formatCallLog, rewriteErrorMessage } from '../utils/isomorphic/stackTrace';
|
||||||
import { formatCallLog, rewriteErrorMessage } from '../utils/stackTrace';
|
|
||||||
import { zones } from '../utils/zones';
|
import { zones } from '../utils/zones';
|
||||||
|
|
||||||
import type { ClientInstrumentation } from './clientInstrumentation';
|
import type { ClientInstrumentation } from './clientInstrumentation';
|
||||||
import type { HeadersArray } from './types';
|
import type { HeadersArray } from './types';
|
||||||
import type { ValidatorContext } from '../protocol/validator';
|
import type { ValidatorContext } from '../protocol/validator';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
class Root extends ChannelOwner<channels.RootChannel> {
|
class Root extends ChannelOwner<channels.RootChannel> {
|
||||||
|
|
@ -139,9 +138,9 @@ export class Connection extends EventEmitter {
|
||||||
const type = object._type;
|
const type = object._type;
|
||||||
const id = ++this._lastId;
|
const id = ++this._lastId;
|
||||||
const message = { id, guid, method, params };
|
const message = { id, guid, method, params };
|
||||||
if (debugLogger.isEnabled('channel')) {
|
if (this.platform.isLogEnabled('channel')) {
|
||||||
// Do not include metadata in debug logs to avoid noise.
|
// Do not include metadata in debug logs to avoid noise.
|
||||||
debugLogger.log('channel', 'SEND> ' + JSON.stringify(message));
|
this.platform.log('channel', 'SEND> ' + JSON.stringify(message));
|
||||||
}
|
}
|
||||||
const location = frames[0] ? { file: frames[0].file, line: frames[0].line, column: frames[0].column } : undefined;
|
const location = frames[0] ? { file: frames[0].file, line: frames[0].line, column: frames[0].column } : undefined;
|
||||||
const metadata: channels.Metadata = { apiName, location, internal: !apiName, stepId };
|
const metadata: channels.Metadata = { apiName, location, internal: !apiName, stepId };
|
||||||
|
|
@ -159,15 +158,15 @@ export class Connection extends EventEmitter {
|
||||||
|
|
||||||
const { id, guid, method, params, result, error, log } = message as any;
|
const { id, guid, method, params, result, error, log } = message as any;
|
||||||
if (id) {
|
if (id) {
|
||||||
if (debugLogger.isEnabled('channel'))
|
if (this.platform.isLogEnabled('channel'))
|
||||||
debugLogger.log('channel', '<RECV ' + JSON.stringify(message));
|
this.platform.log('channel', '<RECV ' + JSON.stringify(message));
|
||||||
const callback = this._callbacks.get(id);
|
const callback = this._callbacks.get(id);
|
||||||
if (!callback)
|
if (!callback)
|
||||||
throw new Error(`Cannot find command to respond: ${id}`);
|
throw new Error(`Cannot find command to respond: ${id}`);
|
||||||
this._callbacks.delete(id);
|
this._callbacks.delete(id);
|
||||||
if (error && !result) {
|
if (error && !result) {
|
||||||
const parsedError = parseError(error);
|
const parsedError = parseError(error);
|
||||||
rewriteErrorMessage(parsedError, parsedError.message + formatCallLog(log));
|
rewriteErrorMessage(parsedError, parsedError.message + formatCallLog(this.platform, log));
|
||||||
callback.reject(parsedError);
|
callback.reject(parsedError);
|
||||||
} else {
|
} else {
|
||||||
const validator = findValidator(callback.type, callback.method, 'Result');
|
const validator = findValidator(callback.type, callback.method, 'Result');
|
||||||
|
|
@ -176,8 +175,8 @@ export class Connection extends EventEmitter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debugLogger.isEnabled('channel'))
|
if (this.platform.isLogEnabled('channel'))
|
||||||
debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));
|
this.platform.log('channel', '<EVENT ' + JSON.stringify(message));
|
||||||
if (method === '__create__') {
|
if (method === '__create__') {
|
||||||
this._createRemoteObject(guid, params.type, params.guid, params.initializer);
|
this._createRemoteObject(guid, params.type, params.guid, params.initializer);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { JSHandle } from './jsHandle';
|
||||||
import { Page } from './page';
|
import { Page } from './page';
|
||||||
|
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
type ConsoleMessageLocation = channels.BrowserContextConsoleEvent['location'];
|
type ConsoleMessageLocation = channels.BrowserContextConsoleEvent['location'];
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { TargetClosedError, isTargetClosedError } from './errors';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
|
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
|
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
import type { BrowserContextOptions, Env, Headers, WaitForEventOptions } from './types';
|
import type { BrowserContextOptions, Env, Headers, WaitForEventOptions } from './types';
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ import { promisify } from 'util';
|
||||||
|
|
||||||
import { Frame } from './frame';
|
import { Frame } from './frame';
|
||||||
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
|
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { fileUploadSizeLimit, mkdirIfNeeded } from '../utils/fileUtils';
|
import { fileUploadSizeLimit, mkdirIfNeeded } from '../common/fileUtils';
|
||||||
import { isString } from '../utils/rtti';
|
import { isString } from '../utils/isomorphic/rtti';
|
||||||
import { mime } from '../utilsBundle';
|
import { mime } from '../utilsBundle';
|
||||||
import { WritableStream } from './writableStream';
|
import { WritableStream } from './writableStream';
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ import type { Locator } from './locator';
|
||||||
import type { FilePayload, Rect, SelectOption, SelectOptionOptions } from './types';
|
import type { FilePayload, Rect, SelectOption, SelectOptionOptions } from './types';
|
||||||
import type * as structs from '../../types/structs';
|
import type * as structs from '../../types/structs';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
const pipelineAsync = promisify(pipeline);
|
const pipelineAsync = promisify(pipeline);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
|
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
|
||||||
import { isError } from '../utils/rtti';
|
import { isError } from '../utils/isomorphic/rtti';
|
||||||
|
|
||||||
import type { SerializedError } from '@protocol/channels';
|
import type { SerializedError } from '@protocol/channels';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
import { EventEmitter as OriginalEventEmitter } from 'events';
|
import { EventEmitter as OriginalEventEmitter } from 'events';
|
||||||
|
|
||||||
import { isUnderTest } from '../utils/debug';
|
import { isUnderTest } from '../utils/isomorphic/debug';
|
||||||
|
|
||||||
import type { EventEmitter as EventEmitterType } from 'events';
|
import type { EventEmitter as EventEmitterType } from 'events';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,17 @@ import { ChannelOwner } from './channelOwner';
|
||||||
import { TargetClosedError, isTargetClosedError } from './errors';
|
import { TargetClosedError, isTargetClosedError } from './errors';
|
||||||
import { RawHeaders } from './network';
|
import { RawHeaders } from './network';
|
||||||
import { Tracing } from './tracing';
|
import { Tracing } from './tracing';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../common/fileUtils';
|
||||||
import { headersObjectToArray } from '../utils/headers';
|
import { headersObjectToArray } from '../utils/isomorphic/headers';
|
||||||
import { isString } from '../utils/rtti';
|
import { isString } from '../utils/isomorphic/rtti';
|
||||||
|
|
||||||
import type { Playwright } from './playwright';
|
import type { Playwright } from './playwright';
|
||||||
import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState } from './types';
|
import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState } from './types';
|
||||||
import type { Serializable } from '../../types/structs';
|
import type { Serializable } from '../../types/structs';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type { HeadersArray, NameValue } from '../common/types';
|
import type { HeadersArray, NameValue } from '../common/types';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
import type * as fs from 'fs';
|
import type * as fs from 'fs';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import { FrameLocator, Locator, testIdAttributeName } from './locator';
|
||||||
import * as network from './network';
|
import * as network from './network';
|
||||||
import { kLifecycleEvents } from './types';
|
import { kLifecycleEvents } from './types';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
|
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
|
||||||
import { urlMatches } from '../utils/isomorphic/urlMatch';
|
import { urlMatches } from '../utils/isomorphic/urlMatch';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
|
||||||
|
|
||||||
import type { BrowserContext } from './browserContext';
|
import type { BrowserContext } from './browserContext';
|
||||||
import type { LocalUtils } from './localUtils';
|
import type { LocalUtils } from './localUtils';
|
||||||
import type { Route } from './network';
|
import type { Route } from './network';
|
||||||
|
|
@ -57,7 +55,7 @@ export class HarRouter {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.action === 'redirect') {
|
if (response.action === 'redirect') {
|
||||||
debugLogger.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
|
route._platform.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
|
||||||
await route._redirectNavigationRequest(response.redirectURL!);
|
await route._redirectNavigationRequest(response.redirectURL!);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +77,7 @@ export class HarRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.action === 'error')
|
if (response.action === 'error')
|
||||||
debugLogger.log('api', 'HAR: ' + response.message!);
|
route._platform.log('api', 'HAR: ' + response.message!);
|
||||||
// Report the error, but fall through to the default handler.
|
// Report the error, but fall through to the default handler.
|
||||||
|
|
||||||
if (this._notFoundAction === 'abort') {
|
if (this._notFoundAction === 'abort') {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { Connection } from './connection';
|
import { Connection } from './connection';
|
||||||
import * as localUtils from '../utils/localUtils';
|
import * as localUtils from '../common/localUtils';
|
||||||
|
|
||||||
import type { HeadersArray, Size } from './types';
|
import type { HeadersArray, Size } from './types';
|
||||||
import type { HarBackend } from '../utils/harBackend';
|
import type { HarBackend } from '../common/harBackend';
|
||||||
import type { Platform } from '../utils/platform';
|
import type { Platform } from '../common/platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
type DeviceDescriptor = {
|
type DeviceDescriptor = {
|
||||||
|
|
@ -51,7 +51,7 @@ export class LocalUtils extends ChannelOwner<channels.LocalUtilsChannel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async harOpen(params: channels.LocalUtilsHarOpenParams): Promise<channels.LocalUtilsHarOpenResult> {
|
async harOpen(params: channels.LocalUtilsHarOpenParams): Promise<channels.LocalUtilsHarOpenResult> {
|
||||||
return await localUtils.harOpen(this._harBackends, params);
|
return await localUtils.harOpen(this._platform, this._harBackends, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
async harLookup(params: channels.LocalUtilsHarLookupParams): Promise<channels.LocalUtilsHarLookupResult> {
|
async harLookup(params: channels.LocalUtilsHarLookupParams): Promise<channels.LocalUtilsHarLookupResult> {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ import { parseResult, serializeArgument } from './jsHandle';
|
||||||
import { asLocator } from '../utils/isomorphic/locatorGenerators';
|
import { asLocator } from '../utils/isomorphic/locatorGenerators';
|
||||||
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
|
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
|
||||||
import { escapeForTextSelector } from '../utils/isomorphic/stringUtils';
|
import { escapeForTextSelector } from '../utils/isomorphic/stringUtils';
|
||||||
import { isString } from '../utils/rtti';
|
import { isString } from '../utils/isomorphic/rtti';
|
||||||
import { monotonicTime } from '../utils/time';
|
import { monotonicTime } from '../utils/isomorphic/time';
|
||||||
|
|
||||||
import type { Frame } from './frame';
|
import type { Frame } from './frame';
|
||||||
import type { FilePayload, FrameExpectParams, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
import type { FilePayload, FrameExpectParams, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@ import { APIResponse } from './fetch';
|
||||||
import { Frame } from './frame';
|
import { Frame } from './frame';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { Worker } from './worker';
|
import { Worker } from './worker';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { headersObjectToArray } from '../utils/headers';
|
import { headersObjectToArray } from '../utils/isomorphic/headers';
|
||||||
import { urlMatches } from '../utils/isomorphic/urlMatch';
|
import { urlMatches } from '../utils/isomorphic/urlMatch';
|
||||||
import { LongStandingScope, ManualPromise } from '../utils/manualPromise';
|
import { LongStandingScope, ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
import { MultiMap } from '../utils/multimap';
|
import { MultiMap } from '../utils/isomorphic/multimap';
|
||||||
import { isRegExp, isString } from '../utils/rtti';
|
import { isRegExp, isString } from '../utils/isomorphic/rtti';
|
||||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
import { rewriteErrorMessage } from '../utils/isomorphic/stackTrace';
|
||||||
import { zones } from '../utils/zones';
|
import { zones } from '../utils/zones';
|
||||||
import { mime } from '../utilsBundle';
|
import { mime } from '../utilsBundle';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,14 @@ import { Response, Route, RouteHandler, WebSocket, WebSocketRoute, WebSocketRou
|
||||||
import { Video } from './video';
|
import { Video } from './video';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
import { Worker } from './worker';
|
import { Worker } from './worker';
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../common/fileUtils';
|
||||||
import { headersObjectToArray } from '../utils/headers';
|
import { headersObjectToArray } from '../utils/isomorphic/headers';
|
||||||
import { trimStringWithEllipsis } from '../utils/isomorphic/stringUtils';
|
import { trimStringWithEllipsis } from '../utils/isomorphic/stringUtils';
|
||||||
import { urlMatches, urlMatchesEqual } from '../utils/isomorphic/urlMatch';
|
import { urlMatches, urlMatchesEqual } from '../utils/isomorphic/urlMatch';
|
||||||
import { LongStandingScope } from '../utils/manualPromise';
|
import { LongStandingScope } from '../utils/isomorphic/manualPromise';
|
||||||
import { isObject, isRegExp, isString } from '../utils/rtti';
|
import { isObject, isRegExp, isString } from '../utils/isomorphic/rtti';
|
||||||
|
|
||||||
import type { BrowserContext } from './browserContext';
|
import type { BrowserContext } from './browserContext';
|
||||||
import type { Clock } from './clock';
|
import type { Clock } from './clock';
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,25 @@
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { evaluationScript } from './clientHelper';
|
import { evaluationScript } from './clientHelper';
|
||||||
import { setTestIdAttribute, testIdAttributeName } from './locator';
|
import { setTestIdAttribute, testIdAttributeName } from './locator';
|
||||||
import { nodePlatform } from '../utils/platform';
|
import { emptyPlatform } from '../common/platform';
|
||||||
|
|
||||||
import type { SelectorEngine } from './types';
|
import type { SelectorEngine } from './types';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
import type { Platform } from '../common/platform';
|
||||||
|
|
||||||
|
let platform = emptyPlatform;
|
||||||
|
|
||||||
|
export function setPlatformForSelectors(p: Platform) {
|
||||||
|
platform = p;
|
||||||
|
}
|
||||||
|
|
||||||
export class Selectors implements api.Selectors {
|
export class Selectors implements api.Selectors {
|
||||||
private _channels = new Set<SelectorsOwner>();
|
private _channels = new Set<SelectorsOwner>();
|
||||||
private _registrations: channels.SelectorsRegisterParams[] = [];
|
private _registrations: channels.SelectorsRegisterParams[] = [];
|
||||||
|
|
||||||
async register(name: string, script: string | (() => SelectorEngine) | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
|
async register(name: string, script: string | (() => SelectorEngine) | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
|
||||||
const source = await evaluationScript(nodePlatform, script, undefined, false);
|
const source = await evaluationScript(platform, script, undefined, false);
|
||||||
const params = { ...options, name, source };
|
const params = { ...options, name, source };
|
||||||
for (const channel of this._channels)
|
for (const channel of this._channels)
|
||||||
await channel._channel.register(params);
|
await channel._channel.register(params);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type { Artifact } from './artifact';
|
import type { Artifact } from './artifact';
|
||||||
import type { Connection } from './connection';
|
import type { Connection } from './connection';
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TimeoutError } from './errors';
|
import { TimeoutError } from './errors';
|
||||||
import { createGuid } from '../utils/crypto';
|
import { rewriteErrorMessage } from '../utils/isomorphic/stackTrace';
|
||||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
|
||||||
import { zones } from '../utils/zones';
|
import { zones } from '../utils/zones';
|
||||||
|
|
||||||
import type { ChannelOwner } from './channelOwner';
|
import type { ChannelOwner } from './channelOwner';
|
||||||
|
|
@ -35,7 +34,7 @@ export class Waiter {
|
||||||
private _savedZone: Zone;
|
private _savedZone: Zone;
|
||||||
|
|
||||||
constructor(channelOwner: ChannelOwner<channels.EventTargetChannel>, event: string) {
|
constructor(channelOwner: ChannelOwner<channels.EventTargetChannel>, event: string) {
|
||||||
this._waitId = createGuid();
|
this._waitId = channelOwner._platform.createGuid();
|
||||||
this._channelOwner = channelOwner;
|
this._channelOwner = channelOwner;
|
||||||
this._savedZone = zones.current().without('apiZone');
|
this._savedZone = zones.current().without('apiZone');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { ChannelOwner } from './channelOwner';
|
||||||
import { TargetClosedError } from './errors';
|
import { TargetClosedError } from './errors';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
|
import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
|
||||||
import { LongStandingScope } from '../utils/manualPromise';
|
import { LongStandingScope } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type { BrowserContext } from './browserContext';
|
import type { BrowserContext } from './browserContext';
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
[*]
|
[*]
|
||||||
../utils/
|
../utils/
|
||||||
|
../utils/isomorphic/
|
||||||
../utilsBundle.ts
|
../utilsBundle.ts
|
||||||
../zipBundle.ts
|
../zipBundle.ts
|
||||||
|
|
|
||||||
|
|
@ -14,24 +14,24 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import { ZipFile } from '../utils/zipFile';
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import { createGuid } from './crypto';
|
import type { HeadersArray } from './types';
|
||||||
import { ZipFile } from './zipFile';
|
|
||||||
|
|
||||||
import type { HeadersArray } from '../common/types';
|
|
||||||
import type * as har from '@trace/har';
|
import type * as har from '@trace/har';
|
||||||
|
import type { Platform } from './platform';
|
||||||
|
|
||||||
const redirectStatus = [301, 302, 303, 307, 308];
|
const redirectStatus = [301, 302, 303, 307, 308];
|
||||||
|
|
||||||
export class HarBackend {
|
export class HarBackend {
|
||||||
readonly id = createGuid();
|
readonly id: string;
|
||||||
private _harFile: har.HARFile;
|
private _harFile: har.HARFile;
|
||||||
private _zipFile: ZipFile | null;
|
private _zipFile: ZipFile | null;
|
||||||
private _baseDir: string | null;
|
private _baseDir: string | null;
|
||||||
|
private _platform: Platform;
|
||||||
|
|
||||||
constructor(harFile: har.HARFile, baseDir: string | null, zipFile: ZipFile | null) {
|
constructor(platform: Platform, harFile: har.HARFile, baseDir: string | null, zipFile: ZipFile | null) {
|
||||||
|
this._platform = platform;
|
||||||
|
this.id = platform.createGuid();
|
||||||
this._harFile = harFile;
|
this._harFile = harFile;
|
||||||
this._baseDir = baseDir;
|
this._baseDir = baseDir;
|
||||||
this._zipFile = zipFile;
|
this._zipFile = zipFile;
|
||||||
|
|
@ -79,7 +79,7 @@ export class HarBackend {
|
||||||
if (this._zipFile)
|
if (this._zipFile)
|
||||||
buffer = await this._zipFile.read(file);
|
buffer = await this._zipFile.read(file);
|
||||||
else
|
else
|
||||||
buffer = await fs.promises.readFile(path.resolve(this._baseDir!, file));
|
buffer = await this._platform.fs().promises.readFile(this._platform.path().resolve(this._baseDir!, file));
|
||||||
} else {
|
} else {
|
||||||
buffer = Buffer.from(content.text || '', content.encoding === 'base64' ? 'base64' : 'utf-8');
|
buffer = Buffer.from(content.text || '', content.encoding === 'base64' ? 'base64' : 'utf-8');
|
||||||
}
|
}
|
||||||
|
|
@ -20,11 +20,11 @@ import * as path from 'path';
|
||||||
|
|
||||||
import { removeFolders } from './fileUtils';
|
import { removeFolders } from './fileUtils';
|
||||||
import { HarBackend } from './harBackend';
|
import { HarBackend } from './harBackend';
|
||||||
import { ManualPromise } from './manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
import { ZipFile } from './zipFile';
|
import { ZipFile } from '../utils/zipFile';
|
||||||
import { yauzl, yazl } from '../zipBundle';
|
import { yauzl, yazl } from '../zipBundle';
|
||||||
import { serializeClientSideCallMetadata } from '../utils';
|
import { serializeClientSideCallMetadata } from '../utils/isomorphic/traceUtils';
|
||||||
import { assert, calculateSha1 } from '../utils';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
|
|
||||||
import type { Platform } from './platform';
|
import type { Platform } from './platform';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
@ -77,7 +77,7 @@ export async function zip(platform: Platform, stackSessions: Map<string, StackSe
|
||||||
sourceFiles.add(file);
|
sourceFiles.add(file);
|
||||||
}
|
}
|
||||||
for (const sourceFile of sourceFiles)
|
for (const sourceFile of sourceFiles)
|
||||||
addFile(sourceFile, 'resources/src@' + calculateSha1(sourceFile) + '.txt');
|
addFile(sourceFile, 'resources/src@' + await platform.calculateSha1(sourceFile) + '.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.mode === 'write') {
|
if (params.mode === 'write') {
|
||||||
|
|
@ -137,7 +137,7 @@ async function deleteStackSession(platform: Platform, stackSessions: Map<string,
|
||||||
stackSessions.delete(stacksId!);
|
stackSessions.delete(stacksId!);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function harOpen(harBackends: Map<string, HarBackend>, params: channels.LocalUtilsHarOpenParams): Promise<channels.LocalUtilsHarOpenResult> {
|
export async function harOpen(platform: Platform, harBackends: Map<string, HarBackend>, params: channels.LocalUtilsHarOpenParams): Promise<channels.LocalUtilsHarOpenResult> {
|
||||||
let harBackend: HarBackend;
|
let harBackend: HarBackend;
|
||||||
if (params.file.endsWith('.zip')) {
|
if (params.file.endsWith('.zip')) {
|
||||||
const zipFile = new ZipFile(params.file);
|
const zipFile = new ZipFile(params.file);
|
||||||
|
|
@ -147,10 +147,10 @@ export async function harOpen(harBackends: Map<string, HarBackend>, params: chan
|
||||||
return { error: 'Specified archive does not have a .har file' };
|
return { error: 'Specified archive does not have a .har file' };
|
||||||
const har = await zipFile.read(harEntryName);
|
const har = await zipFile.read(harEntryName);
|
||||||
const harFile = JSON.parse(har.toString()) as har.HARFile;
|
const harFile = JSON.parse(har.toString()) as har.HARFile;
|
||||||
harBackend = new HarBackend(harFile, null, zipFile);
|
harBackend = new HarBackend(platform, harFile, null, zipFile);
|
||||||
} else {
|
} else {
|
||||||
const harFile = JSON.parse(await fs.promises.readFile(params.file, 'utf-8')) as har.HARFile;
|
const harFile = JSON.parse(await fs.promises.readFile(params.file, 'utf-8')) as har.HARFile;
|
||||||
harBackend = new HarBackend(harFile, path.dirname(params.file), null);
|
harBackend = new HarBackend(platform, harFile, path.dirname(params.file), null);
|
||||||
}
|
}
|
||||||
harBackends.set(harBackend.id, harBackend);
|
harBackends.set(harBackend.id, harBackend);
|
||||||
return { harId: harBackend.id };
|
return { harId: harBackend.id };
|
||||||
102
packages/playwright-core/src/common/platform.ts
Normal file
102
packages/playwright-core/src/common/platform.ts
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Microsoft Corporation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as crypto from 'crypto';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
import { webColors, noColors } from '../utils/isomorphic/colors';
|
||||||
|
|
||||||
|
import type { Colors } from '../utils/isomorphic/colors';
|
||||||
|
|
||||||
|
|
||||||
|
export type Platform = {
|
||||||
|
calculateSha1(text: string): Promise<string>;
|
||||||
|
colors: Colors;
|
||||||
|
createGuid: () => string;
|
||||||
|
fs: () => typeof fs;
|
||||||
|
inspectCustom: symbol | undefined;
|
||||||
|
isLogEnabled(name: 'api' | 'channel'): boolean;
|
||||||
|
log(name: 'api' | 'channel', message: string | Error | object): void;
|
||||||
|
path: () => typeof path;
|
||||||
|
pathSeparator: string;
|
||||||
|
ws?: (url: string) => WebSocket;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const webPlatform: Platform = {
|
||||||
|
calculateSha1: async (text: string) => {
|
||||||
|
const bytes = new TextEncoder().encode(text);
|
||||||
|
const hashBuffer = await crypto.subtle.digest('SHA-1', bytes);
|
||||||
|
return Array.from(new Uint8Array(hashBuffer), b => b.toString(16).padStart(2, '0')).join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
colors: webColors,
|
||||||
|
|
||||||
|
createGuid: () => {
|
||||||
|
return Array.from(crypto.getRandomValues(new Uint8Array(16)), b => b.toString(16).padStart(2, '0')).join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
fs: () => {
|
||||||
|
throw new Error('File system is not available');
|
||||||
|
},
|
||||||
|
|
||||||
|
inspectCustom: undefined,
|
||||||
|
|
||||||
|
|
||||||
|
isLogEnabled(name: 'api' | 'channel') {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
log(name: 'api' | 'channel', message: string | Error | object) {},
|
||||||
|
|
||||||
|
path: () => {
|
||||||
|
throw new Error('Path module is not available');
|
||||||
|
},
|
||||||
|
|
||||||
|
pathSeparator: '/',
|
||||||
|
|
||||||
|
ws: (url: string) => new WebSocket(url),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const emptyPlatform: Platform = {
|
||||||
|
calculateSha1: async () => {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
|
colors: noColors,
|
||||||
|
|
||||||
|
createGuid: () => {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
|
fs: () => {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
|
inspectCustom: undefined,
|
||||||
|
|
||||||
|
isLogEnabled(name: 'api' | 'channel') {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
log(name: 'api' | 'channel', message: string | Error | object) { },
|
||||||
|
|
||||||
|
path: () => {
|
||||||
|
throw new Error('Function not implemented.');
|
||||||
|
},
|
||||||
|
|
||||||
|
pathSeparator: '/'
|
||||||
|
};
|
||||||
|
|
@ -14,17 +14,29 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { AndroidServerLauncherImpl } from './androidServerImpl';
|
import { AndroidServerLauncherImpl } from './androidServerImpl';
|
||||||
import { BrowserServerLauncherImpl } from './browserServerImpl';
|
import { BrowserServerLauncherImpl } from './browserServerImpl';
|
||||||
import { Connection } from './client/connection';
|
import { Connection } from './client/connection';
|
||||||
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from './server';
|
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from './server';
|
||||||
|
import { setLibraryStackPrefix } from './utils/isomorphic/stackTrace';
|
||||||
|
import { setDebugMode } from './utils/isomorphic/debug';
|
||||||
|
import { getFromENV } from './server/utils/env';
|
||||||
|
import { nodePlatform } from './server/utils/nodePlatform';
|
||||||
|
import { setPlatformForSelectors } from './client/selectors';
|
||||||
|
|
||||||
import type { Playwright as PlaywrightAPI } from './client/playwright';
|
import type { Playwright as PlaywrightAPI } from './client/playwright';
|
||||||
import type { Language } from './utils';
|
import type { Language } from './utils';
|
||||||
import type { Platform } from './utils/platform';
|
import type { Platform } from './common/platform';
|
||||||
|
|
||||||
|
|
||||||
export function createInProcessPlaywright(platform: Platform): PlaywrightAPI {
|
export function createInProcessPlaywright(platform: Platform): PlaywrightAPI {
|
||||||
const playwright = createPlaywright({ sdkLanguage: (process.env.PW_LANG_NAME as Language | undefined) || 'javascript' });
|
const playwright = createPlaywright({ sdkLanguage: (process.env.PW_LANG_NAME as Language | undefined) || 'javascript' });
|
||||||
|
setDebugMode(getFromENV('PWDEBUG') || '');
|
||||||
|
setPlatformForSelectors(nodePlatform);
|
||||||
|
|
||||||
|
setLibraryStackPrefix(path.join(__dirname, '..'));
|
||||||
|
|
||||||
const clientConnection = new Connection(undefined, platform, undefined, []);
|
const clientConnection = new Connection(undefined, platform, undefined, []);
|
||||||
clientConnection.useRawBuffers();
|
clientConnection.useRawBuffers();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createInProcessPlaywright } from './inProcessFactory';
|
import { createInProcessPlaywright } from './inProcessFactory';
|
||||||
import { nodePlatform } from './utils/platform';
|
import { nodePlatform } from './server/utils/nodePlatform';
|
||||||
|
|
||||||
module.exports = createInProcessPlaywright(nodePlatform);
|
module.exports = createInProcessPlaywright(nodePlatform);
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ import * as childProcess from 'child_process';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { Connection } from './client/connection';
|
import { Connection } from './client/connection';
|
||||||
import { PipeTransport } from './protocol/transport';
|
import { PipeTransport } from './utils/pipeTransport';
|
||||||
import { ManualPromise } from './utils/manualPromise';
|
import { ManualPromise } from './utils/isomorphic/manualPromise';
|
||||||
import { nodePlatform } from './utils/platform';
|
import { nodePlatform } from './server/utils/nodePlatform';
|
||||||
|
|
||||||
import type { Playwright } from './client/playwright';
|
import type { Playwright } from './client/playwright';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,5 @@
|
||||||
../server/dispatchers/
|
../server/dispatchers/
|
||||||
../server/utils/
|
../server/utils/
|
||||||
../utils/
|
../utils/
|
||||||
|
../utils/isomorphic
|
||||||
../utilsBundle.ts
|
../utilsBundle.ts
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { serverSideCallMetadata } from '../server/instrumentation';
|
||||||
import { assert, isUnderTest } from '../utils';
|
import { assert, isUnderTest } from '../utils';
|
||||||
import { startProfiling, stopProfiling } from '../server/utils/profiler';
|
import { startProfiling, stopProfiling } from '../server/utils/profiler';
|
||||||
import { monotonicTime } from '../utils';
|
import { monotonicTime } from '../utils';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from '../server/utils/debugLogger';
|
||||||
|
|
||||||
import type { DispatcherScope, Playwright } from '../server';
|
import type { DispatcherScope, Playwright } from '../server';
|
||||||
import type { LaunchOptions } from '../server/types';
|
import type { LaunchOptions } from '../server/types';
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
import { PlaywrightConnection } from './playwrightConnection';
|
import { PlaywrightConnection } from './playwrightConnection';
|
||||||
import { createPlaywright } from '../server/playwright';
|
import { createPlaywright } from '../server/playwright';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from '../server/utils/debugLogger';
|
||||||
import { Semaphore } from '../utils/semaphore';
|
import { Semaphore } from '../utils/isomorphic/semaphore';
|
||||||
import { WSServer } from '../server/utils/wsServer';
|
import { WSServer } from '../server/utils/wsServer';
|
||||||
import { wrapInASCIIBox } from '../server/utils/ascii';
|
import { wrapInASCIIBox } from '../server/utils/ascii';
|
||||||
import { getPlaywrightVersion } from '../utils/userAgent';
|
import { getPlaywrightVersion } from '../server/utils/userAgent';
|
||||||
|
|
||||||
import type { ClientType } from './playwrightConnection';
|
import type { ClientType } from './playwrightConnection';
|
||||||
import type { SocksProxy } from '../server/utils/socksProxy';
|
import type { SocksProxy } from '../server/utils/socksProxy';
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
../../common/
|
../../common/
|
||||||
../../protocol/
|
../../protocol/
|
||||||
../../utils/
|
../../utils/
|
||||||
|
../../utils/isomorphic/
|
||||||
../../utilsBundle.ts
|
../../utilsBundle.ts
|
||||||
../chromium/
|
../chromium/
|
||||||
../utils
|
../utils
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,13 @@ import * as fs from 'fs';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { TimeoutSettings } from '../../common/timeoutSettings';
|
import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';
|
||||||
import { PipeTransport } from '../../protocol/transport';
|
import { PipeTransport } from '../../utils/pipeTransport';
|
||||||
import { createGuid, getPackageManagerExecCommand, isUnderTest, makeWaitForNextTask } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
import { RecentLogsCollector } from '../../utils/debugLogger';
|
import { isUnderTest } from '../../utils/isomorphic/debug';
|
||||||
|
import { getPackageManagerExecCommand } from '../utils/env';
|
||||||
|
import { makeWaitForNextTask } from '../../utils/task';
|
||||||
|
import { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import { debug } from '../../utilsBundle';
|
import { debug } from '../../utilsBundle';
|
||||||
import { wsReceiver, wsSender } from '../../utilsBundle';
|
import { wsReceiver, wsSender } from '../../utilsBundle';
|
||||||
import { validateBrowserContextOptions } from '../browserContext';
|
import { validateBrowserContextOptions } from '../browserContext';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import * as net from 'net';
|
import * as net from 'net';
|
||||||
|
|
||||||
import { assert, createGuid } from '../../utils';
|
import { assert } from '../../utils/isomorphic/debug';
|
||||||
|
import { createGuid } from '../utils/crypto';
|
||||||
import { debug } from '../../utilsBundle';
|
import { debug } from '../../utilsBundle';
|
||||||
|
|
||||||
import type { Backend, DeviceBackend, SocketBackend } from './android';
|
import type { Backend, DeviceBackend, SocketBackend } from './android';
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import * as fs from 'fs';
|
||||||
import { assert } from '../utils';
|
import { assert } from '../utils';
|
||||||
import { TargetClosedError } from './errors';
|
import { TargetClosedError } from './errors';
|
||||||
import { SdkObject } from './instrumentation';
|
import { SdkObject } from './instrumentation';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
type SaveCallback = (localPath: string, error?: Error) => Promise<void>;
|
type SaveCallback = (localPath: string, error?: Error) => Promise<void>;
|
||||||
type CancelCallback = () => Promise<void>;
|
type CancelCallback = () => Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { Browser } from '../browser';
|
import { Browser } from '../browser';
|
||||||
import { BrowserContext, assertBrowserContextIsNotOwned } from '../browserContext';
|
import { BrowserContext, assertBrowserContextIsNotOwned } from '../browserContext';
|
||||||
import * as network from '../network';
|
import * as network from '../network';
|
||||||
|
|
@ -23,7 +23,7 @@ import { bidiBytesValueToString } from './bidiNetworkManager';
|
||||||
import { BidiPage } from './bidiPage';
|
import { BidiPage } from './bidiPage';
|
||||||
import * as bidi from './third_party/bidiProtocol';
|
import * as bidi from './third_party/bidiProtocol';
|
||||||
|
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type { BrowserOptions } from '../browser';
|
import type { BrowserOptions } from '../browser';
|
||||||
import type { SdkObject } from '../instrumentation';
|
import type { SdkObject } from '../instrumentation';
|
||||||
import type { InitScript, Page } from '../page';
|
import type { InitScript, Page } from '../page';
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { helper } from '../helper';
|
import { helper } from '../helper';
|
||||||
import { ProtocolError } from '../protocolError';
|
import { ProtocolError } from '../protocolError';
|
||||||
|
|
||||||
import type { RecentLogsCollector } from '../../utils/debugLogger';
|
import type { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
||||||
import type { ProtocolLogger } from '../types';
|
import type { ProtocolLogger } from '../types';
|
||||||
import type * as bidiCommands from './third_party/bidiCommands';
|
import type * as bidiCommands from './third_party/bidiCommands';
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import * as js from '../javascript';
|
import * as js from '../javascript';
|
||||||
|
import * as dom from '../dom';
|
||||||
import { BidiDeserializer } from './third_party/bidiDeserializer';
|
import { BidiDeserializer } from './third_party/bidiDeserializer';
|
||||||
import * as bidi from './third_party/bidiProtocol';
|
import * as bidi from './third_party/bidiProtocol';
|
||||||
import { BidiSerializer } from './third_party/bidiSerializer';
|
import { BidiSerializer } from './third_party/bidiSerializer';
|
||||||
|
|
@ -137,7 +138,45 @@ export class BidiExecutionContext implements js.ExecutionContextDelegate {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async rawCallFunction(functionDeclaration: string, arg: bidi.Script.LocalValue): Promise<bidi.Script.RemoteValue> {
|
|
||||||
|
async nodeIdForElementHandle(handle: dom.ElementHandle): Promise<bidi.Script.SharedReference> {
|
||||||
|
const shared = await this._remoteValueForReference({ handle: handle._objectId });
|
||||||
|
// TODO: store sharedId in the handle.
|
||||||
|
if (!('sharedId' in shared))
|
||||||
|
throw new Error('Element is not a node');
|
||||||
|
return {
|
||||||
|
sharedId: shared.sharedId!,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async remoteObjectForNodeId(nodeId: bidi.Script.SharedReference): Promise<js.RemoteObject> {
|
||||||
|
const result = await this._remoteValueForReference(nodeId);
|
||||||
|
if ('handle' in result)
|
||||||
|
return { objectId: result.handle!, ...result };
|
||||||
|
throw new Error('Can\'t get remote object for nodeId');
|
||||||
|
}
|
||||||
|
|
||||||
|
async contentFrameIdForFrame(handle: dom.ElementHandle) {
|
||||||
|
const contentWindow = await this._rawCallFunction('e => e.contentWindow', { handle: handle._objectId });
|
||||||
|
if (contentWindow?.type === 'window')
|
||||||
|
return contentWindow.value.context;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async frameIdForWindowHandle(handle: js.JSHandle): Promise<string | null> {
|
||||||
|
if (!handle._objectId)
|
||||||
|
throw new Error('JSHandle is not a DOM node handle');
|
||||||
|
const contentWindow = await this._remoteValueForReference({ handle: handle._objectId });
|
||||||
|
if (contentWindow.type === 'window')
|
||||||
|
return contentWindow.value.context;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _remoteValueForReference(reference: bidi.Script.RemoteReference) {
|
||||||
|
return await this._rawCallFunction('e => e', reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _rawCallFunction(functionDeclaration: string, arg: bidi.Script.LocalValue): Promise<bidi.Script.RemoteValue> {
|
||||||
const response = await this._session.send('script.callFunction', {
|
const response = await this._session.send('script.callFunction', {
|
||||||
functionDeclaration,
|
functionDeclaration,
|
||||||
target: this._target,
|
target: this._target,
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,9 @@ export class RawMouseImpl implements input.RawMouse {
|
||||||
}
|
}
|
||||||
|
|
||||||
async move(x: number, y: number, button: types.MouseButton | 'none', buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, forClick: boolean): Promise<void> {
|
async move(x: number, y: number, button: types.MouseButton | 'none', buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, forClick: boolean): Promise<void> {
|
||||||
|
// Bidi throws when x/y are not integers.
|
||||||
|
x = Math.floor(x);
|
||||||
|
y = Math.floor(y);
|
||||||
await this._performActions([{ type: 'pointerMove', x, y }]);
|
await this._performActions([{ type: 'pointerMove', x, y }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,6 +94,9 @@ export class RawMouseImpl implements input.RawMouse {
|
||||||
}
|
}
|
||||||
|
|
||||||
async wheel(x: number, y: number, buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, deltaX: number, deltaY: number): Promise<void> {
|
async wheel(x: number, y: number, buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, deltaX: number, deltaY: number): Promise<void> {
|
||||||
|
// Bidi throws when x/y are not integers.
|
||||||
|
x = Math.floor(x);
|
||||||
|
y = Math.floor(y);
|
||||||
await this._session.send('input.performActions', {
|
await this._session.send('input.performActions', {
|
||||||
context: this._session.sessionId,
|
context: this._session.sessionId,
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { parseRawCookie } from '../cookieStore';
|
import { parseRawCookie } from '../cookieStore';
|
||||||
import * as network from '../network';
|
import * as network from '../network';
|
||||||
import * as bidi from './third_party/bidiProtocol';
|
import * as bidi from './third_party/bidiProtocol';
|
||||||
|
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as frames from '../frames';
|
import type * as frames from '../frames';
|
||||||
import type { Page } from '../page';
|
import type { Page } from '../page';
|
||||||
import type * as types from '../types';
|
import type * as types from '../types';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
import * as bidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/BidiMapper';
|
import * as bidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/BidiMapper';
|
||||||
import * as bidiCdpConnection from 'chromium-bidi/lib/cjs/cdp/CdpConnection';
|
import * as bidiCdpConnection from 'chromium-bidi/lib/cjs/cdp/CdpConnection';
|
||||||
|
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
|
|
||||||
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
||||||
import type { ChromiumBidi } from 'chromium-bidi/lib/cjs/protocol/protocol';
|
import type { ChromiumBidi } from 'chromium-bidi/lib/cjs/protocol/protocol';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from '../../utils';
|
import { assert } from '../../utils';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { BrowserContext } from '../browserContext';
|
import { BrowserContext } from '../browserContext';
|
||||||
import * as dialog from '../dialog';
|
import * as dialog from '../dialog';
|
||||||
import * as dom from '../dom';
|
import * as dom from '../dom';
|
||||||
|
|
@ -26,7 +26,7 @@ import { BidiNetworkManager } from './bidiNetworkManager';
|
||||||
import { BidiPDF } from './bidiPdf';
|
import { BidiPDF } from './bidiPdf';
|
||||||
import * as bidi from './third_party/bidiProtocol';
|
import * as bidi from './third_party/bidiProtocol';
|
||||||
|
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as accessibility from '../accessibility';
|
import type * as accessibility from '../accessibility';
|
||||||
import type * as frames from '../frames';
|
import type * as frames from '../frames';
|
||||||
import type { InitScript, PageDelegate } from '../page';
|
import type { InitScript, PageDelegate } from '../page';
|
||||||
|
|
@ -413,17 +413,22 @@ export class BidiPage implements PageDelegate {
|
||||||
|
|
||||||
async getContentFrame(handle: dom.ElementHandle): Promise<frames.Frame | null> {
|
async getContentFrame(handle: dom.ElementHandle): Promise<frames.Frame | null> {
|
||||||
const executionContext = toBidiExecutionContext(handle._context);
|
const executionContext = toBidiExecutionContext(handle._context);
|
||||||
const contentWindow = await executionContext.rawCallFunction('e => e.contentWindow', { handle: handle._objectId });
|
const frameId = await executionContext.contentFrameIdForFrame(handle);
|
||||||
if (contentWindow.type === 'window') {
|
if (!frameId)
|
||||||
const frameId = contentWindow.value.context;
|
return null;
|
||||||
const result = this._page._frameManager.frame(frameId);
|
return this._page._frameManager.frame(frameId);
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getOwnerFrame(handle: dom.ElementHandle): Promise<string | null> {
|
async getOwnerFrame(handle: dom.ElementHandle): Promise<string | null> {
|
||||||
throw new Error('Method not implemented.');
|
// TODO: switch to utility world?
|
||||||
|
const windowHandle = await handle.evaluateHandle(node => {
|
||||||
|
const doc = node.ownerDocument ?? node as Document;
|
||||||
|
return doc.defaultView;
|
||||||
|
});
|
||||||
|
if (!windowHandle)
|
||||||
|
return null;
|
||||||
|
const executionContext = toBidiExecutionContext(handle._context);
|
||||||
|
return executionContext.frameIdForWindowHandle(windowHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
isElementHandle(remoteObject: bidi.Script.RemoteValue): boolean {
|
isElementHandle(remoteObject: bidi.Script.RemoteValue): boolean {
|
||||||
|
|
@ -515,24 +520,25 @@ export class BidiPage implements PageDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setInputFiles(handle: dom.ElementHandle<HTMLInputElement>, files: types.FilePayload[]): Promise<void> {
|
async setInputFiles(handle: dom.ElementHandle<HTMLInputElement>, files: types.FilePayload[]): Promise<void> {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Setting FilePayloads is not supported in Bidi.');
|
||||||
}
|
}
|
||||||
|
|
||||||
async setInputFilePaths(handle: dom.ElementHandle<HTMLInputElement>, paths: string[]): Promise<void> {
|
async setInputFilePaths(handle: dom.ElementHandle<HTMLInputElement>, paths: string[]): Promise<void> {
|
||||||
throw new Error('Method not implemented.');
|
const fromContext = toBidiExecutionContext(handle._context);
|
||||||
|
await this._session.send('input.setFiles', {
|
||||||
|
context: this._session.sessionId,
|
||||||
|
element: await fromContext.nodeIdForElementHandle(handle),
|
||||||
|
files: paths,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async adoptElementHandle<T extends Node>(handle: dom.ElementHandle<T>, to: dom.FrameExecutionContext): Promise<dom.ElementHandle<T>> {
|
async adoptElementHandle<T extends Node>(handle: dom.ElementHandle<T>, to: dom.FrameExecutionContext): Promise<dom.ElementHandle<T>> {
|
||||||
const fromContext = toBidiExecutionContext(handle._context);
|
const fromContext = toBidiExecutionContext(handle._context);
|
||||||
const shared = await fromContext.rawCallFunction('x => x', { handle: handle._objectId });
|
const nodeId = await fromContext.nodeIdForElementHandle(handle);
|
||||||
// TODO: store sharedId in the handle.
|
|
||||||
if (!('sharedId' in shared))
|
|
||||||
throw new Error('Element is not a node');
|
|
||||||
const sharedId = shared.sharedId!;
|
|
||||||
const executionContext = toBidiExecutionContext(to);
|
const executionContext = toBidiExecutionContext(to);
|
||||||
const result = await executionContext.rawCallFunction('x => x', { sharedId });
|
const objectId = await executionContext.remoteObjectForNodeId(nodeId);
|
||||||
if ('handle' in result)
|
if (objectId)
|
||||||
return to.createHandle({ objectId: result.handle!, ...result }) as dom.ElementHandle<T>;
|
return to.createHandle(objectId) as dom.ElementHandle<T>;
|
||||||
throw new Error('Failed to adopt element handle.');
|
throw new Error('Failed to adopt element handle.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
|
||||||
import type { CallMetadata } from './instrumentation';
|
import type { CallMetadata } from './instrumentation';
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type { ProxySettings } from './types';
|
import type { ProxySettings } from './types';
|
||||||
import type { RecentLogsCollector } from '../utils/debugLogger';
|
import type { RecentLogsCollector } from './utils/debugLogger';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
import type { ChildProcess } from 'child_process';
|
import type { ChildProcess } from 'child_process';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { createGuid, debugMode } from '../utils';
|
import { createGuid } from './utils/crypto';
|
||||||
|
import { debugMode } from '../utils/isomorphic/debug';
|
||||||
import { Clock } from './clock';
|
import { Clock } from './clock';
|
||||||
import { Debugger } from './debugger';
|
import { Debugger } from './debugger';
|
||||||
import { BrowserContextAPIRequestContext } from './fetch';
|
import { BrowserContextAPIRequestContext } from './fetch';
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
|
import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
|
||||||
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings';
|
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { ManualPromise, assert, debugMode } from '../utils';
|
import { ManualPromise, assert, debugMode } from '../utils';
|
||||||
import { existsAsync } from './utils/fileUtils';
|
import { existsAsync } from './utils/fileUtils';
|
||||||
import { helper } from './helper';
|
import { helper } from './helper';
|
||||||
|
|
@ -31,7 +31,7 @@ import { isProtocolError } from './protocolError';
|
||||||
import { registry } from './registry';
|
import { registry } from './registry';
|
||||||
import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
|
import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
|
||||||
import { WebSocketTransport } from './transport';
|
import { WebSocketTransport } from './transport';
|
||||||
import { RecentLogsCollector } from '../utils/debugLogger';
|
import { RecentLogsCollector } from './utils/debugLogger';
|
||||||
|
|
||||||
import type { Browser, BrowserOptions, BrowserProcess } from './browser';
|
import type { Browser, BrowserOptions, BrowserProcess } from './browser';
|
||||||
import type { BrowserContext } from './browserContext';
|
import type { BrowserContext } from './browserContext';
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ import * as path from 'path';
|
||||||
import { chromiumSwitches } from './chromiumSwitches';
|
import { chromiumSwitches } from './chromiumSwitches';
|
||||||
import { CRBrowser } from './crBrowser';
|
import { CRBrowser } from './crBrowser';
|
||||||
import { kBrowserCloseMessageId } from './crConnection';
|
import { kBrowserCloseMessageId } from './crConnection';
|
||||||
import { TimeoutSettings } from '../../common/timeoutSettings';
|
import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';
|
||||||
import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
|
import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
|
||||||
import { wrapInASCIIBox } from '../utils/ascii';
|
import { wrapInASCIIBox } from '../utils/ascii';
|
||||||
import { RecentLogsCollector } from '../../utils/debugLogger';
|
import { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import { ManualPromise } from '../../utils/manualPromise';
|
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
|
||||||
import { fetchData } from '../utils/network';
|
import { fetchData } from '../utils/network';
|
||||||
import { getUserAgent } from '../../utils/userAgent';
|
import { getUserAgent } from '../utils/userAgent';
|
||||||
import { validateBrowserContextOptions } from '../browserContext';
|
import { validateBrowserContextOptions } from '../browserContext';
|
||||||
import { BrowserType, kNoXServerRunningError } from '../browserType';
|
import { BrowserType, kNoXServerRunningError } from '../browserType';
|
||||||
import { BrowserReadyState } from '../browserType';
|
import { BrowserReadyState } from '../browserType';
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,10 @@ export const chromiumSwitches = [
|
||||||
// PaintHolding - https://github.com/microsoft/playwright/issues/28023
|
// PaintHolding - https://github.com/microsoft/playwright/issues/28023
|
||||||
// ThirdPartyStoragePartitioning - https://github.com/microsoft/playwright/issues/32230
|
// ThirdPartyStoragePartitioning - https://github.com/microsoft/playwright/issues/32230
|
||||||
// LensOverlay - Hides the Lens feature in the URL address bar. Its not working in unofficial builds.
|
// LensOverlay - Hides the Lens feature in the URL address bar. Its not working in unofficial builds.
|
||||||
// PlzDedicatedWorker - https://github.com/microsoft/playwright/issues/31747
|
|
||||||
// DeferRendererTasksAfterInput - this makes Page.frameScheduledNavigation arrive much later after a click,
|
// DeferRendererTasksAfterInput - this makes Page.frameScheduledNavigation arrive much later after a click,
|
||||||
// making our navigation auto-wait after click not working. Can be removed once we deperecate noWaitAfter.
|
// making our navigation auto-wait after click not working. Can be removed once we deperecate noWaitAfter.
|
||||||
// See https://github.com/microsoft/playwright/pull/34372.
|
// See https://github.com/microsoft/playwright/pull/34372.
|
||||||
'--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning,LensOverlay,PlzDedicatedWorker,DeferRendererTasksAfterInput',
|
'--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning,LensOverlay,DeferRendererTasksAfterInput',
|
||||||
'--allow-pre-commit-input',
|
'--allow-pre-commit-input',
|
||||||
'--disable-hang-monitor',
|
'--disable-hang-monitor',
|
||||||
'--disable-ipc-flooding-protection',
|
'--disable-ipc-flooding-protection',
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { assert, createGuid } from '../../utils';
|
import { assert } from '../../utils/isomorphic/debug';
|
||||||
|
import { createGuid } from '../utils/crypto';
|
||||||
import { Artifact } from '../artifact';
|
import { Artifact } from '../artifact';
|
||||||
import { Browser } from '../browser';
|
import { Browser } from '../browser';
|
||||||
import { BrowserContext, assertBrowserContextIsNotOwned, verifyGeolocation } from '../browserContext';
|
import { BrowserContext, assertBrowserContextIsNotOwned, verifyGeolocation } from '../browserContext';
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { assert, eventsHelper } from '../../utils';
|
import { assert, eventsHelper } from '../../utils';
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { helper } from '../helper';
|
import { helper } from '../helper';
|
||||||
import { ProtocolError } from '../protocolError';
|
import { ProtocolError } from '../protocolError';
|
||||||
|
|
||||||
import type { RegisteredListener } from '../../utils';
|
import type { RegisteredListener } from '../../utils';
|
||||||
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RecentLogsCollector } from '../../utils/debugLogger';
|
import type { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import type { ProtocolLogger } from '../types';
|
import type { ProtocolLogger } from '../types';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from '../../utils';
|
import { assert } from '../../utils';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
|
|
||||||
import type { CRSession } from './crConnection';
|
import type { CRSession } from './crConnection';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
|
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
|
||||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
import { rewriteErrorMessage } from '../../utils/isomorphic/stackTrace';
|
||||||
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import * as js from '../javascript';
|
import * as js from '../javascript';
|
||||||
import { isSessionClosedError } from '../protocolError';
|
import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
|
import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { helper } from '../helper';
|
import { helper } from '../helper';
|
||||||
import * as network from '../network';
|
import * as network from '../network';
|
||||||
import { isProtocolError, isSessionClosedError } from '../protocolError';
|
import { isProtocolError, isSessionClosedError } from '../protocolError';
|
||||||
|
|
||||||
import type { CRSession } from './crConnection';
|
import type { CRSession } from './crConnection';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as contexts from '../browserContext';
|
import type * as contexts from '../browserContext';
|
||||||
import type * as frames from '../frames';
|
import type * as frames from '../frames';
|
||||||
import type { Page } from '../page';
|
import type { Page } from '../page';
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { assert, createGuid } from '../../utils';
|
import { assert } from '../../utils/isomorphic/debug';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { createGuid } from '../utils/crypto';
|
||||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
|
import { rewriteErrorMessage } from '../../utils/isomorphic/stackTrace';
|
||||||
import * as dialog from '../dialog';
|
import * as dialog from '../dialog';
|
||||||
import * as dom from '../dom';
|
import * as dom from '../dom';
|
||||||
import * as frames from '../frames';
|
import * as frames from '../frames';
|
||||||
|
|
@ -45,7 +46,7 @@ import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
||||||
import type { CRSession } from './crConnection';
|
import type { CRSession } from './crConnection';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type { InitScript, PageDelegate } from '../page';
|
import type { InitScript, PageDelegate } from '../page';
|
||||||
import type { Progress } from '../progress';
|
import type { Progress } from '../progress';
|
||||||
import type * as types from '../types';
|
import type * as types from '../types';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { splitErrorMessage } from '../../utils/stackTrace';
|
import { splitErrorMessage } from '../../utils/isomorphic/stackTrace';
|
||||||
import { mkdirIfNeeded } from '../utils/fileUtils';
|
import { mkdirIfNeeded } from '../utils/fileUtils';
|
||||||
|
|
||||||
import type { CRSession } from './crConnection';
|
import type { CRSession } from './crConnection';
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ import { Recorder } from '../recorder';
|
||||||
import { TracingDispatcher } from './tracingDispatcher';
|
import { TracingDispatcher } from './tracingDispatcher';
|
||||||
import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
|
import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
|
||||||
import { WritableStreamDispatcher } from './writableStreamDispatcher';
|
import { WritableStreamDispatcher } from './writableStreamDispatcher';
|
||||||
import { createGuid, urlMatches } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
|
import { urlMatches } from '../../utils/isomorphic/urlMatch';
|
||||||
import { RecorderApp } from '../recorder/recorderApp';
|
import { RecorderApp } from '../recorder/recorderApp';
|
||||||
|
|
||||||
import type { Artifact } from '../artifact';
|
import type { Artifact } from '../artifact';
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import { DebugController } from '../debugController';
|
||||||
import { Dispatcher } from './dispatcher';
|
import { Dispatcher } from './dispatcher';
|
||||||
|
|
||||||
import type { DispatcherConnection, RootDispatcher } from './dispatcher';
|
import type { DispatcherConnection, RootDispatcher } from './dispatcher';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { eventsHelper } from '../..//utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { ValidationError, createMetadataValidator, findValidator } from '../../protocol/validator';
|
import { ValidationError, createMetadataValidator, findValidator } from '../../protocol/validator';
|
||||||
import { LongStandingScope, assert, compressCallLog, isUnderTest, monotonicTime, rewriteErrorMessage } from '../../utils';
|
import { LongStandingScope, assert, compressCallLog, isUnderTest, monotonicTime, rewriteErrorMessage } from '../../utils';
|
||||||
import { TargetClosedError, isTargetClosedError, serializeError } from '../errors';
|
import { TargetClosedError, isTargetClosedError, serializeError } from '../errors';
|
||||||
|
|
@ -25,7 +25,7 @@ import { isProtocolError } from '../protocolError';
|
||||||
|
|
||||||
import type { CallMetadata } from '../instrumentation';
|
import type { CallMetadata } from '../instrumentation';
|
||||||
import type { PlaywrightDispatcher } from './playwrightDispatcher';
|
import type { PlaywrightDispatcher } from './playwrightDispatcher';
|
||||||
import type { RegisteredListener } from '../..//utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type { ValidatorContext } from '../../protocol/validator';
|
import type { ValidatorContext } from '../../protocol/validator';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Dispatcher } from './dispatcher';
|
import { Dispatcher } from './dispatcher';
|
||||||
import { createGuid } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
|
|
||||||
import type { LocalUtilsDispatcher } from './localUtilsDispatcher';
|
import type { LocalUtilsDispatcher } from './localUtilsDispatcher';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
import { Dispatcher } from './dispatcher';
|
import { Dispatcher } from './dispatcher';
|
||||||
import { SdkObject } from '../../server/instrumentation';
|
import { SdkObject } from '../../server/instrumentation';
|
||||||
import * as localUtils from '../../utils/localUtils';
|
import * as localUtils from '../../common/localUtils';
|
||||||
import { nodePlatform } from '../../utils/platform';
|
import { nodePlatform } from '../utils/nodePlatform';
|
||||||
import { getUserAgent } from '../../utils/userAgent';
|
import { getUserAgent } from '../utils/userAgent';
|
||||||
import { deviceDescriptors as descriptors } from '../deviceDescriptors';
|
import { deviceDescriptors as descriptors } from '../deviceDescriptors';
|
||||||
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
|
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
|
||||||
import { Progress, ProgressController } from '../progress';
|
import { Progress, ProgressController } from '../progress';
|
||||||
|
|
@ -26,7 +26,7 @@ import { SocksInterceptor } from '../socksInterceptor';
|
||||||
import { WebSocketTransport } from '../transport';
|
import { WebSocketTransport } from '../transport';
|
||||||
import { fetchData } from '../utils/network';
|
import { fetchData } from '../utils/network';
|
||||||
|
|
||||||
import type { HarBackend } from '../../utils/harBackend';
|
import type { HarBackend } from '../../common/harBackend';
|
||||||
import type { CallMetadata } from '../instrumentation';
|
import type { CallMetadata } from '../instrumentation';
|
||||||
import type { Playwright } from '../playwright';
|
import type { Playwright } from '../playwright';
|
||||||
import type { RootDispatcher } from './dispatcher';
|
import type { RootDispatcher } from './dispatcher';
|
||||||
|
|
@ -54,7 +54,7 @@ export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.
|
||||||
}
|
}
|
||||||
|
|
||||||
async harOpen(params: channels.LocalUtilsHarOpenParams, metadata: CallMetadata): Promise<channels.LocalUtilsHarOpenResult> {
|
async harOpen(params: channels.LocalUtilsHarOpenParams, metadata: CallMetadata): Promise<channels.LocalUtilsHarOpenResult> {
|
||||||
return await localUtils.harOpen(this._harBackends, params);
|
return await localUtils.harOpen(nodePlatform, this._harBackends, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
async harLookup(params: channels.LocalUtilsHarLookupParams, metadata: CallMetadata): Promise<channels.LocalUtilsHarLookupResult> {
|
async harLookup(params: channels.LocalUtilsHarLookupParams, metadata: CallMetadata): Promise<channels.LocalUtilsHarLookupResult> {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ import { RequestDispatcher } from './networkDispatchers';
|
||||||
import { ResponseDispatcher } from './networkDispatchers';
|
import { ResponseDispatcher } from './networkDispatchers';
|
||||||
import { RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
|
import { RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
|
||||||
import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
|
import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
|
||||||
import { createGuid, urlMatches } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
|
import { urlMatches } from '../../utils/isomorphic/urlMatch';
|
||||||
|
|
||||||
import type { Artifact } from '../artifact';
|
import type { Artifact } from '../artifact';
|
||||||
import type { BrowserContext } from '../browserContext';
|
import type { BrowserContext } from '../browserContext';
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ import { ElectronDispatcher } from './electronDispatcher';
|
||||||
import { LocalUtilsDispatcher } from './localUtilsDispatcher';
|
import { LocalUtilsDispatcher } from './localUtilsDispatcher';
|
||||||
import { APIRequestContextDispatcher } from './networkDispatchers';
|
import { APIRequestContextDispatcher } from './networkDispatchers';
|
||||||
import { SelectorsDispatcher } from './selectorsDispatcher';
|
import { SelectorsDispatcher } from './selectorsDispatcher';
|
||||||
import { createGuid } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
|
|
||||||
import type { RootDispatcher } from './dispatcher';
|
import type { RootDispatcher } from './dispatcher';
|
||||||
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
|
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type { AndroidDevice } from '../android/android';
|
import type { AndroidDevice } from '../android/android';
|
||||||
import type { Browser } from '../browser';
|
import type { Browser } from '../browser';
|
||||||
import type { Playwright } from '../playwright';
|
import type { Playwright } from '../playwright';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Dispatcher } from './dispatcher';
|
import { Dispatcher } from './dispatcher';
|
||||||
import { ManualPromise, createGuid } from '../../utils';
|
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
|
||||||
|
import { createGuid } from '../utils/crypto';
|
||||||
|
|
||||||
import type { ArtifactDispatcher } from './artifactDispatcher';
|
import type { ArtifactDispatcher } from './artifactDispatcher';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ import { Page } from '../page';
|
||||||
import { Dispatcher, existingDispatcher } from './dispatcher';
|
import { Dispatcher, existingDispatcher } from './dispatcher';
|
||||||
import { PageDispatcher } from './pageDispatcher';
|
import { PageDispatcher } from './pageDispatcher';
|
||||||
import * as webSocketMockSource from '../../generated/webSocketMockSource';
|
import * as webSocketMockSource from '../../generated/webSocketMockSource';
|
||||||
import { createGuid, urlMatches } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { urlMatches } from '../../utils/isomorphic/urlMatch';
|
||||||
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
|
|
||||||
import type { BrowserContextDispatcher } from './browserContextDispatcher';
|
import type { BrowserContextDispatcher } from './browserContextDispatcher';
|
||||||
import type { BrowserContext } from '../browserContext';
|
import type { BrowserContext } from '../browserContext';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { Dispatcher } from './dispatcher';
|
import { Dispatcher } from './dispatcher';
|
||||||
import { createGuid } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
|
|
||||||
import type { BrowserContextDispatcher } from './browserContextDispatcher';
|
import type { BrowserContextDispatcher } from './browserContextDispatcher';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
../
|
../
|
||||||
../../common/
|
../../common/
|
||||||
../../utils/
|
../../utils/
|
||||||
|
../../utils/isomorphic/
|
||||||
../chromium/
|
../chromium/
|
||||||
../utils
|
../utils
|
||||||
|
|
@ -19,11 +19,11 @@ import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as readline from 'readline';
|
import * as readline from 'readline';
|
||||||
|
|
||||||
import { TimeoutSettings } from '../../common/timeoutSettings';
|
import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';
|
||||||
import { ManualPromise } from '../../utils';
|
import { ManualPromise } from '../../utils';
|
||||||
import { wrapInASCIIBox } from '../utils/ascii';
|
import { wrapInASCIIBox } from '../utils/ascii';
|
||||||
import { RecentLogsCollector } from '../../utils/debugLogger';
|
import { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { validateBrowserContextOptions } from '../browserContext';
|
import { validateBrowserContextOptions } from '../browserContext';
|
||||||
import { CRBrowser } from '../chromium/crBrowser';
|
import { CRBrowser } from '../chromium/crBrowser';
|
||||||
import { CRConnection } from '../chromium/crConnection';
|
import { CRConnection } from '../chromium/crConnection';
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,10 @@ import { TLSSocket } from 'tls';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
import * as zlib from 'zlib';
|
import * as zlib from 'zlib';
|
||||||
|
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { assert, constructURLBasedOnBaseURL, createGuid, eventsHelper, monotonicTime } from '../utils';
|
import { assert, constructURLBasedOnBaseURL, eventsHelper, monotonicTime } from '../utils';
|
||||||
import { getUserAgent } from '../utils/userAgent';
|
import { createGuid } from './utils/crypto';
|
||||||
|
import { getUserAgent } from './utils/userAgent';
|
||||||
import { HttpsProxyAgent, SocksProxyAgent } from '../utilsBundle';
|
import { HttpsProxyAgent, SocksProxyAgent } from '../utilsBundle';
|
||||||
import { BrowserContext, verifyClientCertificates } from './browserContext';
|
import { BrowserContext, verifyClientCertificates } from './browserContext';
|
||||||
import { CookieStore, domainMatches, parseRawCookie } from './cookieStore';
|
import { CookieStore, domainMatches, parseRawCookie } from './cookieStore';
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { assert } from '../utils/debug';
|
import { assert } from '../utils/isomorphic/debug';
|
||||||
import { fileUploadSizeLimit } from '../utils/fileUtils';
|
import { fileUploadSizeLimit } from '../common/fileUtils';
|
||||||
import { mime } from '../utilsBundle';
|
import { mime } from '../utilsBundle';
|
||||||
|
|
||||||
import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispatcher';
|
import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispatcher';
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { helper } from '../helper';
|
import { helper } from '../helper';
|
||||||
import { ProtocolError } from '../protocolError';
|
import { ProtocolError } from '../protocolError';
|
||||||
|
|
||||||
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RecentLogsCollector } from '../../utils/debugLogger';
|
import type { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import type { ProtocolLogger } from '../types';
|
import type { ProtocolLogger } from '../types';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
import { rewriteErrorMessage } from '../../utils/isomorphic/stackTrace';
|
||||||
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import * as js from '../javascript';
|
import * as js from '../javascript';
|
||||||
import { isSessionClosedError } from '../protocolError';
|
import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import * as network from '../network';
|
import * as network from '../network';
|
||||||
|
|
||||||
import type { FFSession } from './ffConnection';
|
import type { FFSession } from './ffConnection';
|
||||||
import type { HeadersArray } from '../../server/types';
|
import type { HeadersArray } from '../../server/types';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as frames from '../frames';
|
import type * as frames from '../frames';
|
||||||
import type { Page } from '../page';
|
import type { Page } from '../page';
|
||||||
import type * as types from '../types';
|
import type * as types from '../types';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import * as dialog from '../dialog';
|
import * as dialog from '../dialog';
|
||||||
import * as dom from '../dom';
|
import * as dom from '../dom';
|
||||||
import { InitScript } from '../page';
|
import { InitScript } from '../page';
|
||||||
|
|
@ -25,15 +25,15 @@ import { FFSession } from './ffConnection';
|
||||||
import { FFExecutionContext } from './ffExecutionContext';
|
import { FFExecutionContext } from './ffExecutionContext';
|
||||||
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './ffInput';
|
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './ffInput';
|
||||||
import { FFNetworkManager } from './ffNetworkManager';
|
import { FFNetworkManager } from './ffNetworkManager';
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { splitErrorMessage } from '../../utils/stackTrace';
|
import { splitErrorMessage } from '../../utils/isomorphic/stackTrace';
|
||||||
import { BrowserContext } from '../browserContext';
|
import { BrowserContext } from '../browserContext';
|
||||||
import { TargetClosedError } from '../errors';
|
import { TargetClosedError } from '../errors';
|
||||||
|
|
||||||
import type { Progress } from '../progress';
|
import type { Progress } from '../progress';
|
||||||
import type { FFBrowserContext } from './ffBrowser';
|
import type { FFBrowserContext } from './ffBrowser';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type * as frames from '../frames';
|
import type * as frames from '../frames';
|
||||||
import type { PageDelegate } from '../page';
|
import type { PageDelegate } from '../page';
|
||||||
import type * as types from '../types';
|
import type * as types from '../types';
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@ import { ProgressController } from './progress';
|
||||||
import * as types from './types';
|
import * as types from './types';
|
||||||
import { LongStandingScope, asLocator, assert, compressCallLog, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime } from '../utils';
|
import { LongStandingScope, asLocator, assert, compressCallLog, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime } from '../utils';
|
||||||
import { isSessionClosedError } from './protocolError';
|
import { isSessionClosedError } from './protocolError';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from './utils/debugLogger';
|
||||||
import { eventsHelper } from '../utils/eventsHelper';
|
import { eventsHelper } from './utils/eventsHelper';
|
||||||
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type { ConsoleMessage } from './console';
|
import type { ConsoleMessage } from './console';
|
||||||
import type { Dialog } from './dialog';
|
import type { Dialog } from './dialog';
|
||||||
|
|
@ -40,7 +40,7 @@ import type { ElementStateWithoutStable, FrameExpectParams, InjectedScript } fro
|
||||||
import type { CallMetadata } from './instrumentation';
|
import type { CallMetadata } from './instrumentation';
|
||||||
import type { Progress } from './progress';
|
import type { Progress } from './progress';
|
||||||
import type { ScreenshotOptions } from './screenshotter';
|
import type { ScreenshotOptions } from './screenshotter';
|
||||||
import type { RegisteredListener } from '../utils/eventsHelper';
|
import type { RegisteredListener } from './utils/eventsHelper';
|
||||||
import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
|
import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ import * as path from 'path';
|
||||||
|
|
||||||
import { Artifact } from '../artifact';
|
import { Artifact } from '../artifact';
|
||||||
import { HarTracer } from './harTracer';
|
import { HarTracer } from './harTracer';
|
||||||
import { createGuid } from '../../utils';
|
import { createGuid } from '../utils/crypto';
|
||||||
import { ManualPromise } from '../../utils/manualPromise';
|
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
|
||||||
import { yazl } from '../../zipBundle';
|
import { yazl } from '../../zipBundle';
|
||||||
|
|
||||||
import type { BrowserContext } from '../browserContext';
|
import type { BrowserContext } from '../browserContext';
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
import { assert, calculateSha1, monotonicTime } from '../../utils';
|
import { assert, calculateSha1, monotonicTime } from '../../utils';
|
||||||
import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
|
import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
|
||||||
import { eventsHelper } from '../../utils/eventsHelper';
|
import { eventsHelper } from '../utils/eventsHelper';
|
||||||
import { ManualPromise } from '../../utils/manualPromise';
|
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
|
||||||
import { mime } from '../../utilsBundle';
|
import { mime } from '../../utilsBundle';
|
||||||
import { BrowserContext } from '../browserContext';
|
import { BrowserContext } from '../browserContext';
|
||||||
import { APIRequestContext } from '../fetch';
|
import { APIRequestContext } from '../fetch';
|
||||||
|
|
@ -25,7 +25,7 @@ import { Frame } from '../frames';
|
||||||
import { helper } from '../helper';
|
import { helper } from '../helper';
|
||||||
import * as network from '../network';
|
import * as network from '../network';
|
||||||
|
|
||||||
import type { RegisteredListener } from '../../utils/eventsHelper';
|
import type { RegisteredListener } from '../utils/eventsHelper';
|
||||||
import type { APIRequestEvent, APIRequestFinishedEvent } from '../fetch';
|
import type { APIRequestEvent, APIRequestFinishedEvent } from '../fetch';
|
||||||
import type { Page } from '../page';
|
import type { Page } from '../page';
|
||||||
import type { Worker } from '../page';
|
import type { Worker } from '../page';
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from './utils/debugLogger';
|
||||||
import { eventsHelper } from '../utils/eventsHelper';
|
import { eventsHelper } from './utils/eventsHelper';
|
||||||
|
|
||||||
import type { Progress } from './progress';
|
import type { Progress } from './progress';
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type { RegisteredListener } from '../utils/eventsHelper';
|
import type { RegisteredListener } from './utils/eventsHelper';
|
||||||
import type { EventEmitter } from 'events';
|
import type { EventEmitter } from 'events';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { createGuid } from '../utils';
|
import { createGuid } from './utils/crypto';
|
||||||
|
|
||||||
import type { Browser } from './browser';
|
import type { Browser } from './browser';
|
||||||
import type { BrowserContext } from './browserContext';
|
import type { BrowserContext } from './browserContext';
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { SdkObject } from './instrumentation';
|
||||||
import * as utilityScriptSource from '../generated/utilityScriptSource';
|
import * as utilityScriptSource from '../generated/utilityScriptSource';
|
||||||
import { isUnderTest } from '../utils';
|
import { isUnderTest } from '../utils';
|
||||||
import { serializeAsCallArgument } from './isomorphic/utilityScriptSerializers';
|
import { serializeAsCallArgument } from './isomorphic/utilityScriptSerializers';
|
||||||
import { LongStandingScope } from '../utils/manualPromise';
|
import { LongStandingScope } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type * as dom from './dom';
|
import type * as dom from './dom';
|
||||||
import type { UtilityScript } from './injected/utilityScript';
|
import type { UtilityScript } from './injected/utilityScript';
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { assert } from '../utils';
|
||||||
import { BrowserContext } from './browserContext';
|
import { BrowserContext } from './browserContext';
|
||||||
import { APIRequestContext } from './fetch';
|
import { APIRequestContext } from './fetch';
|
||||||
import { SdkObject } from './instrumentation';
|
import { SdkObject } from './instrumentation';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type * as contexts from './browserContext';
|
import type * as contexts from './browserContext';
|
||||||
import type * as frames from './frames';
|
import type * as frames from './frames';
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ import { parseEvaluationResultValue, source } from './isomorphic/utilityScriptSe
|
||||||
import * as js from './javascript';
|
import * as js from './javascript';
|
||||||
import { ProgressController } from './progress';
|
import { ProgressController } from './progress';
|
||||||
import { Screenshotter, validateScreenshotOptions } from './screenshotter';
|
import { Screenshotter, validateScreenshotOptions } from './screenshotter';
|
||||||
import { TimeoutSettings } from '../common/timeoutSettings';
|
import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';
|
||||||
import { LongStandingScope, assert, compressCallLog, createGuid, trimStringWithEllipsis } from '../utils';
|
import { LongStandingScope, assert, compressCallLog, trimStringWithEllipsis } from '../utils';
|
||||||
|
import { createGuid } from './utils/crypto';
|
||||||
import { asLocator } from '../utils';
|
import { asLocator } from '../utils';
|
||||||
import { getComparator } from './utils/comparators';
|
import { getComparator } from './utils/comparators';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from './utils/debugLogger';
|
||||||
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type { Artifact } from './artifact';
|
import type { Artifact } from './artifact';
|
||||||
import type * as dom from './dom';
|
import type * as dom from './dom';
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { makeWaitForNextTask } from '../utils';
|
import { makeWaitForNextTask } from '../utils';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from './utils/debugLogger';
|
||||||
|
|
||||||
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
|
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
import { TimeoutError } from './errors';
|
import { TimeoutError } from './errors';
|
||||||
import { assert, monotonicTime } from '../utils';
|
import { assert, monotonicTime } from '../utils';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/isomorphic/manualPromise';
|
||||||
|
|
||||||
import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
|
import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
|
||||||
import type { Progress as CommonProgress } from '../common/progress';
|
import type { Progress as CommonProgress } from '../common/progress';
|
||||||
import type { LogName } from '../utils/debugLogger';
|
import type { LogName } from './utils/debugLogger';
|
||||||
|
|
||||||
export interface Progress extends CommonProgress {
|
export interface Progress extends CommonProgress {
|
||||||
metadata: CallMetadata;
|
metadata: CallMetadata;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
import { rewriteErrorMessage } from '../utils/isomorphic/stackTrace';
|
||||||
|
|
||||||
export class ProtocolError extends Error {
|
export class ProtocolError extends Error {
|
||||||
type: 'error' | 'closed' | 'crashed';
|
type: 'error' | 'closed' | 'crashed';
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import { EventEmitter } from 'events';
|
||||||
import { RecorderCollection } from './recorderCollection';
|
import { RecorderCollection } from './recorderCollection';
|
||||||
import * as recorderSource from '../../generated/pollingRecorderSource';
|
import * as recorderSource from '../../generated/pollingRecorderSource';
|
||||||
import { eventsHelper, monotonicTime, quoteCSSAttributeValue } from '../../utils';
|
import { eventsHelper, monotonicTime, quoteCSSAttributeValue } from '../../utils';
|
||||||
import { raceAgainstDeadline } from '../../utils/timeoutRunner';
|
import { raceAgainstDeadline } from '../../utils/isomorphic/timeoutRunner';
|
||||||
import { BrowserContext } from '../browserContext';
|
import { BrowserContext } from '../browserContext';
|
||||||
import { languageSet } from '../codegen/languages';
|
import { languageSet } from '../codegen/languages';
|
||||||
import { Frame } from '../frames';
|
import { Frame } from '../frames';
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { performAction } from './recorderRunner';
|
import { performAction } from './recorderRunner';
|
||||||
import { collapseActions } from './recorderUtils';
|
import { collapseActions } from './recorderUtils';
|
||||||
import { isUnderTest } from '../../utils/debug';
|
import { isUnderTest } from '../../utils/isomorphic/debug';
|
||||||
import { monotonicTime } from '../../utils/time';
|
import { monotonicTime } from '../../utils/isomorphic/time';
|
||||||
|
|
||||||
import type { Signal } from '../../../../recorder/src/actions';
|
import type { Signal } from '../../../../recorder/src/actions';
|
||||||
import type { Frame } from '../frames';
|
import type { Frame } from '../frames';
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ import * as fs from 'fs';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { ManualPromise } from '../../utils/manualPromise';
|
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
|
||||||
import { getUserAgent } from '../../utils/userAgent';
|
import { getUserAgent } from '../utils/userAgent';
|
||||||
import { colors, progress as ProgressBar } from '../../utilsBundle';
|
import { progress as ProgressBar, colors } from '../../utilsBundle';
|
||||||
import { existsAsync } from '../utils/fileUtils';
|
import { existsAsync } from '../utils/fileUtils';
|
||||||
|
|
||||||
import { browserDirectoryToMarkerFilePath } from '.';
|
import { browserDirectoryToMarkerFilePath } from '.';
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ import * as path from 'path';
|
||||||
|
|
||||||
import { deps } from './nativeDeps';
|
import { deps } from './nativeDeps';
|
||||||
import { wrapInASCIIBox } from '../utils/ascii';
|
import { wrapInASCIIBox } from '../utils/ascii';
|
||||||
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
|
import { hostPlatform, isOfficiallySupportedPlatform } from '../utils/hostPlatform';
|
||||||
import { spawnAsync } from '../utils/spawnAsync';
|
import { spawnAsync } from '../utils/spawnAsync';
|
||||||
import { getPlaywrightVersion } from '../../utils/userAgent';
|
import { getPlaywrightVersion } from '../utils/userAgent';
|
||||||
|
|
||||||
import { buildPlaywrightCLICommand, registry } from '.';
|
import { buildPlaywrightCLICommand, registry } from '.';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,16 @@ import { dockerVersion, readDockerVersionSync, transformCommandsForRoot } from '
|
||||||
import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
|
import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
|
||||||
import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand } from '../../utils';
|
import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand } from '../../utils';
|
||||||
import { wrapInASCIIBox } from '../utils/ascii';
|
import { wrapInASCIIBox } from '../utils/ascii';
|
||||||
import { debugLogger } from '../../utils/debugLogger';
|
import { debugLogger } from '../utils/debugLogger';
|
||||||
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
|
import { hostPlatform, isOfficiallySupportedPlatform } from '../utils/hostPlatform';
|
||||||
import { fetchData } from '../utils/network';
|
import { fetchData } from '../utils/network';
|
||||||
import { spawnAsync } from '../utils/spawnAsync';
|
import { spawnAsync } from '../utils/spawnAsync';
|
||||||
import { getEmbedderName } from '../../utils/userAgent';
|
import { getEmbedderName } from '../utils/userAgent';
|
||||||
import { lockfile } from '../../utilsBundle';
|
import { lockfile } from '../../utilsBundle';
|
||||||
import { canAccessFile, existsAsync, removeFolders } from '../utils/fileUtils';
|
import { canAccessFile, existsAsync, removeFolders } from '../utils/fileUtils';
|
||||||
|
|
||||||
import type { DependencyGroup } from './dependencies';
|
import type { DependencyGroup } from './dependencies';
|
||||||
import type { HostPlatform } from '../../utils/hostPlatform';
|
import type { HostPlatform } from '../utils/hostPlatform';
|
||||||
|
|
||||||
export { writeDockerVersion } from './dependencies';
|
export { writeDockerVersion } from './dependencies';
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue