mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: move src/rpc/client to src/client (#3581)
This commit is contained in:
parent
72f11fdb0b
commit
9fca63f8ec
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PageChannel, AXNode } from '../../protocol/channels';
|
||||
import { PageChannel, AXNode } from '../protocol/channels';
|
||||
import { ElementHandle } from './elementHandle';
|
||||
|
||||
type SerializedAXNode = Omit<AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & {
|
||||
@ -25,7 +25,7 @@ export { Download } from './download';
|
||||
export { ElementHandle } from './elementHandle';
|
||||
export { FileChooser } from './fileChooser';
|
||||
export { Logger } from './types';
|
||||
export { TimeoutError } from '../../utils/errors';
|
||||
export { TimeoutError } from '../utils/errors';
|
||||
export { Frame } from './frame';
|
||||
export { Keyboard, Mouse } from './input';
|
||||
export { JSHandle } from './jsHandle';
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../../protocol/channels';
|
||||
import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../protocol/channels';
|
||||
import { BrowserContext } from './browserContext';
|
||||
import { Page } from './page';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
@ -22,7 +22,7 @@ import { Events } from './events';
|
||||
import { BrowserType } from './browserType';
|
||||
import { BrowserContextOptions } from './types';
|
||||
import { validateHeaders } from './network';
|
||||
import { headersObjectToArray } from '../../utils/utils';
|
||||
import { headersObjectToArray } from '../utils/utils';
|
||||
|
||||
export class Browser extends ChannelOwner<BrowserChannel, BrowserInitializer> {
|
||||
readonly _contexts = new Set<BrowserContext>();
|
||||
@ -18,15 +18,15 @@
|
||||
import * as frames from './frame';
|
||||
import { Page, BindingCall } from './page';
|
||||
import * as network from './network';
|
||||
import { BrowserContextChannel, BrowserContextInitializer } from '../../protocol/channels';
|
||||
import { BrowserContextChannel, BrowserContextInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { deprecate, evaluationScript, urlMatches } from './clientHelper';
|
||||
import { Browser } from './browser';
|
||||
import { Events } from './events';
|
||||
import { TimeoutSettings } from '../../utils/timeoutSettings';
|
||||
import { TimeoutSettings } from '../utils/timeoutSettings';
|
||||
import { Waiter } from './waiter';
|
||||
import { URLMatch, Headers, WaitForEventOptions } from './types';
|
||||
import { isUnderTest, headersObjectToArray } from '../../utils/utils';
|
||||
import { isUnderTest, headersObjectToArray } from '../utils/utils';
|
||||
|
||||
export class BrowserContext extends ChannelOwner<BrowserContextChannel, BrowserContextInitializer> {
|
||||
_pages = new Set<Page>();
|
||||
@ -14,20 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../../protocol/channels';
|
||||
import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../protocol/channels';
|
||||
import { Browser } from './browser';
|
||||
import { BrowserContext } from './browserContext';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types';
|
||||
import * as WebSocket from 'ws';
|
||||
import { Connection } from './connection';
|
||||
import { serializeError } from '../../protocol/serializers';
|
||||
import { serializeError } from '../protocol/serializers';
|
||||
import { Events } from './events';
|
||||
import { TimeoutSettings } from '../../utils/timeoutSettings';
|
||||
import { TimeoutSettings } from '../utils/timeoutSettings';
|
||||
import { ChildProcess } from 'child_process';
|
||||
import { envObjectToArray } from './clientHelper';
|
||||
import { validateHeaders } from './network';
|
||||
import { assert, makeWaitForNextTask, headersObjectToArray } from '../../utils/utils';
|
||||
import { assert, makeWaitForNextTask, headersObjectToArray } from '../utils/utils';
|
||||
|
||||
export interface BrowserServerLauncher {
|
||||
launchServer(options?: LaunchServerOptions): Promise<BrowserServer>;
|
||||
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CDPSessionChannel, CDPSessionInitializer } from '../../protocol/channels';
|
||||
import { CDPSessionChannel, CDPSessionInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { Protocol } from '../../chromium/protocol';
|
||||
import { Protocol } from '../chromium/protocol';
|
||||
|
||||
export class CDPSession extends ChannelOwner<CDPSessionChannel, CDPSessionInitializer> {
|
||||
static from(cdpSession: CDPSessionChannel): CDPSession {
|
||||
@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import type { Channel } from '../../protocol/channels';
|
||||
import type { Channel } from '../protocol/channels';
|
||||
import type { Connection } from './connection';
|
||||
import type { LoggerSink } from './types';
|
||||
import { debugLogger } from '../../utils/debugLogger';
|
||||
import { debugLogger } from '../utils/debugLogger';
|
||||
|
||||
export abstract class ChannelOwner<T extends Channel = Channel, Initializer = {}> extends EventEmitter {
|
||||
private _connection: Connection;
|
||||
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Page } from './page';
|
||||
import { BrowserContextInitializer } from '../../protocol/channels';
|
||||
import { BrowserContextInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { CDPSession } from './cdpSession';
|
||||
import { Events } from './events';
|
||||
@ -14,12 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../../protocol/channels';
|
||||
|
||||
let __dummyJSResult: PageCrStopJSCoverageResult;
|
||||
type PageCrStopJSCoverageResultEntries = typeof __dummyJSResult.entries;
|
||||
let __dummyCSSResult: PageCrStopCSSCoverageResult;
|
||||
type PageCrStopCSSCoverageResultEntries = typeof __dummyCSSResult.entries;
|
||||
import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../protocol/channels';
|
||||
|
||||
export class ChromiumCoverage {
|
||||
private _channel: PageChannel;
|
||||
@ -32,7 +27,7 @@ export class ChromiumCoverage {
|
||||
await this._channel.crStartJSCoverage(options);
|
||||
}
|
||||
|
||||
async stopJSCoverage(): Promise<PageCrStopJSCoverageResultEntries> {
|
||||
async stopJSCoverage(): Promise<PageCrStopJSCoverageResult['entries']> {
|
||||
return (await this._channel.crStopJSCoverage()).entries;
|
||||
}
|
||||
|
||||
@ -40,7 +35,7 @@ export class ChromiumCoverage {
|
||||
await this._channel.crStartCSSCoverage(options);
|
||||
}
|
||||
|
||||
async stopCSSCoverage(): Promise<PageCrStopCSSCoverageResultEntries> {
|
||||
async stopCSSCoverage(): Promise<PageCrStopCSSCoverageResult['entries']> {
|
||||
return (await this._channel.crStopCSSCoverage()).entries;
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
import * as types from './types';
|
||||
import * as fs from 'fs';
|
||||
import * as util from 'util';
|
||||
import { isString, isRegExp } from '../../utils/utils';
|
||||
import { isString, isRegExp } from '../utils/utils';
|
||||
|
||||
const deprecatedHits = new Set();
|
||||
export function deprecate(methodName: string, message: string) {
|
||||
@ -27,19 +27,19 @@ import { Worker } from './worker';
|
||||
import { ConsoleMessage } from './consoleMessage';
|
||||
import { Dialog } from './dialog';
|
||||
import { Download } from './download';
|
||||
import { parseError } from '../../protocol/serializers';
|
||||
import { parseError } from '../protocol/serializers';
|
||||
import { CDPSession } from './cdpSession';
|
||||
import { Playwright } from './playwright';
|
||||
import { Electron, ElectronApplication } from './electron';
|
||||
import { Channel } from '../../protocol/channels';
|
||||
import { Channel } from '../protocol/channels';
|
||||
import { ChromiumBrowser } from './chromiumBrowser';
|
||||
import { ChromiumBrowserContext } from './chromiumBrowserContext';
|
||||
import { Selectors } from './selectors';
|
||||
import { Stream } from './stream';
|
||||
import { createScheme, Validator, ValidationError } from '../../protocol/validator';
|
||||
import { createScheme, Validator, ValidationError } from '../protocol/validator';
|
||||
import { WebKitBrowser } from './webkitBrowser';
|
||||
import { FirefoxBrowser } from './firefoxBrowser';
|
||||
import { debugLogger } from '../../utils/debugLogger';
|
||||
import { debugLogger } from '../utils/debugLogger';
|
||||
|
||||
class Root extends ChannelOwner<Channel, {}> {
|
||||
constructor(connection: Connection) {
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
import * as util from 'util';
|
||||
import { JSHandle } from './jsHandle';
|
||||
import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../../protocol/channels';
|
||||
import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
|
||||
type ConsoleMessageLocation = ConsoleMessageInitializer['location'];
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DialogChannel, DialogInitializer } from '../../protocol/channels';
|
||||
import { DialogChannel, DialogInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
|
||||
export class Dialog extends ChannelOwner<DialogChannel, DialogInitializer> {
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DownloadChannel, DownloadInitializer } from '../../protocol/channels';
|
||||
import { DownloadChannel, DownloadInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { Readable } from 'stream';
|
||||
import { Stream } from './stream';
|
||||
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../../protocol/channels';
|
||||
import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../protocol/channels';
|
||||
import { BrowserContext } from './browserContext';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { Page } from './page';
|
||||
import { serializeArgument, FuncOn, parseResult, SmartHandle, JSHandle } from './jsHandle';
|
||||
import { TimeoutSettings } from '../../utils/timeoutSettings';
|
||||
import { TimeoutSettings } from '../utils/timeoutSettings';
|
||||
import { Waiter } from './waiter';
|
||||
import { Events } from './events';
|
||||
import { WaitForEventOptions, Env, LoggerSink } from './types';
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementHandleChannel, JSHandleInitializer, ElementHandleScrollIntoViewIfNeededOptions, ElementHandleHoverOptions, ElementHandleClickOptions, ElementHandleDblclickOptions, ElementHandleFillOptions, ElementHandleSetInputFilesOptions, ElementHandlePressOptions, ElementHandleCheckOptions, ElementHandleUncheckOptions, ElementHandleScreenshotOptions, ElementHandleTypeOptions, ElementHandleSelectTextOptions, ElementHandleWaitForSelectorOptions, ElementHandleWaitForElementStateOptions, ElementHandleSetInputFilesParams } from '../../protocol/channels';
|
||||
import { ElementHandleChannel, JSHandleInitializer, ElementHandleScrollIntoViewIfNeededOptions, ElementHandleHoverOptions, ElementHandleClickOptions, ElementHandleDblclickOptions, ElementHandleFillOptions, ElementHandleSetInputFilesOptions, ElementHandlePressOptions, ElementHandleCheckOptions, ElementHandleUncheckOptions, ElementHandleScreenshotOptions, ElementHandleTypeOptions, ElementHandleSelectTextOptions, ElementHandleWaitForSelectorOptions, ElementHandleWaitForElementStateOptions, ElementHandleSetInputFilesParams } from '../protocol/channels';
|
||||
import { Frame } from './frame';
|
||||
import { FuncOn, JSHandle, serializeArgument, parseResult } from './jsHandle';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
@ -23,7 +23,7 @@ import * as fs from 'fs';
|
||||
import * as mime from 'mime';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
import { assert, isString, mkdirIfNeeded } from '../../utils/utils';
|
||||
import { assert, isString, mkdirIfNeeded } from '../utils/utils';
|
||||
|
||||
const fsWriteFileAsync = util.promisify(fs.writeFile.bind(fs));
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
import { ElementHandle } from './elementHandle';
|
||||
import { Page } from './page';
|
||||
import { FilePayload } from './types';
|
||||
import { ElementHandleSetInputFilesOptions } from '../../protocol/channels';
|
||||
import { ElementHandleSetInputFilesOptions } from '../protocol/channels';
|
||||
|
||||
export class FileChooser {
|
||||
private _page: Page;
|
||||
@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from '../../utils/utils';
|
||||
import { FrameChannel, FrameInitializer, FrameNavigatedEvent, FrameGotoOptions, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../../protocol/channels';
|
||||
import { assert } from '../utils/utils';
|
||||
import { FrameChannel, FrameInitializer, FrameNavigatedEvent, FrameGotoOptions, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../protocol/channels';
|
||||
import { BrowserContext } from './browserContext';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';
|
||||
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../../protocol/channels';
|
||||
import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../protocol/channels';
|
||||
|
||||
export class Keyboard {
|
||||
private _channel: PageChannel;
|
||||
@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../../protocol/channels';
|
||||
import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../protocol/channels';
|
||||
import { ElementHandle } from './elementHandle';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { parseSerializedValue, serializeValue } from '../../protocol/serializers';
|
||||
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
|
||||
|
||||
type NoHandles<Arg> = Arg extends JSHandle ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles<Arg[Key]> } : Arg);
|
||||
type Unboxed<Arg> =
|
||||
@ -15,14 +15,14 @@
|
||||
*/
|
||||
|
||||
import { URLSearchParams } from 'url';
|
||||
import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../../protocol/channels';
|
||||
import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { Frame } from './frame';
|
||||
import { Headers } from './types';
|
||||
import * as fs from 'fs';
|
||||
import * as mime from 'mime';
|
||||
import * as util from 'util';
|
||||
import { isString, headersObjectToArray, headersArrayToObject } from '../../utils/utils';
|
||||
import { isString, headersObjectToArray, headersArrayToObject } from '../utils/utils';
|
||||
|
||||
export type NetworkCookie = {
|
||||
name: string,
|
||||
@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
import { Events } from './events';
|
||||
import { assert } from '../../utils/utils';
|
||||
import { TimeoutSettings } from '../../utils/timeoutSettings';
|
||||
import { BindingCallChannel, BindingCallInitializer, PageChannel, PageInitializer, PagePdfParams, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameGotoOptions, PageReloadOptions, PageGoBackOptions, PageGoForwardOptions, PageScreenshotOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../../protocol/channels';
|
||||
import { parseError, serializeError } from '../../protocol/serializers';
|
||||
import { assert } from '../utils/utils';
|
||||
import { TimeoutSettings } from '../utils/timeoutSettings';
|
||||
import { BindingCallChannel, BindingCallInitializer, PageChannel, PageInitializer, PagePdfParams, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameGotoOptions, PageReloadOptions, PageGoBackOptions, PageGoForwardOptions, PageScreenshotOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../protocol/channels';
|
||||
import { parseError, serializeError } from '../protocol/serializers';
|
||||
import { Accessibility } from './accessibility';
|
||||
import { BrowserContext } from './browserContext';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
@ -41,7 +41,7 @@ import * as fs from 'fs';
|
||||
import * as util from 'util';
|
||||
import { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
|
||||
import { evaluationScript, urlMatches } from './clientHelper';
|
||||
import { isString, isRegExp, isObject, mkdirIfNeeded, headersObjectToArray } from '../../utils/utils';
|
||||
import { isString, isRegExp, isObject, mkdirIfNeeded, headersObjectToArray } from '../utils/utils';
|
||||
|
||||
type PDFOptions = Omit<PagePdfParams, 'width' | 'height' | 'margin'> & {
|
||||
width?: string | number,
|
||||
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PlaywrightChannel, PlaywrightInitializer } from '../../protocol/channels';
|
||||
import { PlaywrightChannel, PlaywrightInitializer } from '../protocol/channels';
|
||||
import { BrowserType } from './browserType';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { Selectors } from './selectors';
|
||||
import { Electron } from './electron';
|
||||
import { TimeoutError } from '../../utils/errors';
|
||||
import { TimeoutError } from '../utils/errors';
|
||||
import { Size } from './types';
|
||||
|
||||
type DeviceDescriptor = {
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SelectorsChannel, SelectorsInitializer } from '../../protocol/channels';
|
||||
import { SelectorsChannel, SelectorsInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { ElementHandle } from './elementHandle';
|
||||
import { evaluationScript } from './clientHelper';
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Readable } from 'stream';
|
||||
import { StreamChannel, StreamInitializer } from '../../protocol/channels';
|
||||
import { StreamChannel, StreamInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
|
||||
export class Stream extends ChannelOwner<StreamChannel, StreamInitializer> {
|
||||
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../../protocol/channels';
|
||||
import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../protocol/channels';
|
||||
|
||||
type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error';
|
||||
export interface LoggerSink {
|
||||
@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
||||
import { TimeoutError } from '../../utils/errors';
|
||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
||||
import { TimeoutError } from '../utils/errors';
|
||||
|
||||
export class Waiter {
|
||||
private _dispose: (() => void)[] = [];
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Events } from './events';
|
||||
import { WorkerChannel, WorkerInitializer } from '../../protocol/channels';
|
||||
import { WorkerChannel, WorkerInitializer } from '../protocol/channels';
|
||||
import { ChannelOwner } from './channelOwner';
|
||||
import { assertMaxArguments, Func1, JSHandle, parseResult, serializeArgument, SmartHandle } from './jsHandle';
|
||||
import { Page } from './page';
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LaunchServerOptions } from './client/types';
|
||||
import { LaunchServerOptions } from '../client/types';
|
||||
import { BrowserTypeBase } from '../server/browserType';
|
||||
import * as ws from 'ws';
|
||||
import { helper } from '../helper';
|
||||
@ -26,8 +26,8 @@ import { BrowserTypeDispatcher } from './server/browserTypeDispatcher';
|
||||
import { BrowserDispatcher } from './server/browserDispatcher';
|
||||
import { BrowserContextDispatcher } from './server/browserContextDispatcher';
|
||||
import { BrowserNewContextParams, BrowserContextChannel } from '../protocol/channels';
|
||||
import { BrowserServerLauncher, BrowserServer } from './client/browserType';
|
||||
import { envObjectToArray } from './client/clientHelper';
|
||||
import { BrowserServerLauncher, BrowserServer } from '../client/browserType';
|
||||
import { envObjectToArray } from '../client/clientHelper';
|
||||
|
||||
export class BrowserServerLauncherImpl implements BrowserServerLauncher {
|
||||
private _browserType: BrowserTypeBase;
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 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 childProcess from 'child_process';
|
||||
import * as path from 'path';
|
||||
import { Connection } from './client/connection';
|
||||
import { Transport } from '../protocol/transport';
|
||||
|
||||
(async () => {
|
||||
const spawnedProcess = childProcess.fork(path.join(__dirname, 'server'), [], { stdio: 'pipe' });
|
||||
const transport = new Transport(spawnedProcess.stdin, spawnedProcess.stdout);
|
||||
transport.onclose = () => process.exit(0);
|
||||
const connection = new Connection();
|
||||
connection.onmessage = message => transport.send(JSON.stringify(message));
|
||||
transport.onmessage = message => connection.dispatch(JSON.parse(message));
|
||||
|
||||
const playwright = await connection.waitForObjectWithKnownName('Playwright');
|
||||
const browser = await playwright.chromium.launch({ headless: false });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://example.com');
|
||||
})();
|
||||
@ -16,9 +16,9 @@
|
||||
|
||||
import { DispatcherConnection } from './server/dispatcher';
|
||||
import type { Playwright as PlaywrightImpl } from '../server/playwright';
|
||||
import type { Playwright as PlaywrightAPI } from './client/playwright';
|
||||
import type { Playwright as PlaywrightAPI } from '../client/playwright';
|
||||
import { PlaywrightDispatcher } from './server/playwrightDispatcher';
|
||||
import { Connection } from './client/connection';
|
||||
import { Connection } from '../client/connection';
|
||||
import { BrowserServerLauncherImpl } from './browserServerImpl';
|
||||
import { isUnderTest } from '../utils/utils';
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ function traceAPICoverage(apiCoverage, api, events) {
|
||||
* @param {string} browserName
|
||||
*/
|
||||
function apiForBrowser(browserName) {
|
||||
const events = require('../lib/rpc/client/events').Events;
|
||||
const api = require('../lib/rpc/client/api');
|
||||
const events = require('../lib/client/events').Events;
|
||||
const api = require('../lib/client/api');
|
||||
const otherBrowsers = ['chromium', 'webkit', 'firefox'].filter(name => name.toLowerCase() !== browserName.toLowerCase());
|
||||
const filteredKeys = Object.keys(api).filter(apiName => {
|
||||
return !otherBrowsers.some(otherName => apiName.toLowerCase().startsWith(otherName));
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
import './playwright.fixtures';
|
||||
|
||||
import { globToRegex } from '../lib/rpc/client/clientHelper';
|
||||
import { globToRegex } from '../lib/client/clientHelper';
|
||||
import vm from 'vm';
|
||||
|
||||
it('should work with navigation', async({page, server}) => {
|
||||
|
||||
@ -20,7 +20,7 @@ import os from 'os';
|
||||
import childProcess from 'child_process';
|
||||
import { LaunchOptions, BrowserType, Browser, BrowserContext, Page, BrowserServer } from '../index';
|
||||
import { TestServer } from '../utils/testserver';
|
||||
import { Connection } from '../lib/rpc/client/connection';
|
||||
import { Connection } from '../lib/client/connection';
|
||||
import { Transport } from '../lib/protocol/transport';
|
||||
import { setUnderTest } from '../lib/utils/utils';
|
||||
import { installCoverageHooks } from './coverage';
|
||||
|
||||
@ -69,8 +69,9 @@ async function checkDeps() {
|
||||
|
||||
const DEPS = new Map([
|
||||
['src/utils/', ['src/utils/']],
|
||||
['src/common/', ['src/common/']],
|
||||
['src/protocol/', ['src/protocol/', 'src/utils/']],
|
||||
['src/rpc/client/', ['src/rpc/client/', 'src/utils/', 'src/protocol/', 'src/chromium/protocol.ts']],
|
||||
['src/client/', ['src/client/', 'src/utils/', 'src/protocol/', 'src/chromium/protocol.ts']],
|
||||
['src/', ['src/']], // Allow everything else for now.
|
||||
]);
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ async function run() {
|
||||
const browser = await playwright.chromium.launch();
|
||||
const page = await browser.newPage();
|
||||
const checkPublicAPI = require('./check_public_api');
|
||||
const jsSources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'rpc', 'client'), '', []);
|
||||
const jsSources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'client'), '', []);
|
||||
messages.push(...await checkPublicAPI(page, [api], jsSources));
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ let documentation;
|
||||
const api = await Source.readFile(path.join(PROJECT_DIR, 'docs', 'api.md'));
|
||||
const {documentation: mdDocumentation} = await require('../doclint/check_public_api/MDBuilder')(page, [api]);
|
||||
await browser.close();
|
||||
const sources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'rpc', 'client'), '', []);
|
||||
const sources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'client'), '', []);
|
||||
const {documentation: jsDocumentation} = await require('../doclint/check_public_api/JSBuilder').checkSources(sources);
|
||||
documentation = mergeDocumentation(mdDocumentation, jsDocumentation);
|
||||
const handledClasses = new Set();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user