Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move protocol files to src/protocol (#3571)
Dmitry Gozman6fe1cd981232
diff --git a/packages/build_package.js b/packages/build_package.jsindex 715456a79a..da442f93f5 100755--- a/packages/build_package.js+++ b/packages/build_package.js@@ -120,7 +120,7 @@ if (!args.some(arg => arg === '--no-cleanup')) {await copyToPackage(path.join(ROOT_PATH, file), path.join(packagePath, file));await copyToPackage(path.join(ROOT_PATH, 'docs/api.md'), path.join(packagePath, 'api.md'));- await copyToPackage(path.join(ROOT_PATH, 'src/rpc/protocol.yml'), path.join(packagePath, 'protocol.yml'));+ await copyToPackage(path.join(ROOT_PATH, 'src/protocol/protocol.yml'), path.join(packagePath, 'protocol.yml'));// 4. Generate package.jsonconst pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));diff --git a/packages/installation-tests/esm-playwright-chromium.mjs b/packages/installation-tests/esm-playwright-chromium.mjsindex a68fed8b76..821b386cd6 100644--- a/packages/installation-tests/esm-playwright-chromium.mjs+++ b/packages/installation-tests/esm-playwright-chromium.mjs@@ -16,7 +16,7 @@import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-chromium';import playwright from 'playwright-chromium';-import errorsFile from 'playwright-chromium/lib/errors.js';+import errorsFile from 'playwright-chromium/lib/utils/errors.js';import testESM from './esm.mjs';testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium]);diff --git a/packages/installation-tests/esm-playwright-firefox.mjs b/packages/installation-tests/esm-playwright-firefox.mjsindex 74758eec9a..0818faec69 100644--- a/packages/installation-tests/esm-playwright-firefox.mjs+++ b/packages/installation-tests/esm-playwright-firefox.mjs@@ -16,7 +16,7 @@import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-firefox';import playwright from 'playwright-firefox';-import errorsFile from 'playwright-firefox/lib/errors.js';+import errorsFile from 'playwright-firefox/lib/utils/errors.js';import testESM from './esm.mjs';testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [firefox]);diff --git a/packages/installation-tests/esm-playwright-webkit.mjs b/packages/installation-tests/esm-playwright-webkit.mjsindex 444c55c0f7..fff2213da7 100644--- a/packages/installation-tests/esm-playwright-webkit.mjs+++ b/packages/installation-tests/esm-playwright-webkit.mjs@@ -16,7 +16,7 @@import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-webkit';import playwright from 'playwright-webkit';-import errorsFile from 'playwright-webkit/lib/errors.js';+import errorsFile from 'playwright-webkit/lib/utils/errors.js';import testESM from './esm.mjs';testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [webkit]);diff --git a/packages/installation-tests/esm-playwright.mjs b/packages/installation-tests/esm-playwright.mjsindex 1e1f5516ad..9380f52b51 100644--- a/packages/installation-tests/esm-playwright.mjs+++ b/packages/installation-tests/esm-playwright.mjs@@ -16,7 +16,7 @@import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright';import playwright from 'playwright';-import errorsFile from 'playwright/lib/errors.js';+import errorsFile from 'playwright/lib/utils/errors.js';import testESM from './esm.mjs';testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium, firefox, webkit]);diff --git a/packages/installation-tests/sanity.js b/packages/installation-tests/sanity.jsindex 3b414dfadc..49337a3b46 100644--- a/packages/installation-tests/sanity.js+++ b/packages/installation-tests/sanity.js@@ -29,7 +29,7 @@ if (process.argv[3] === 'all')const playwright = require(requireName);// Requiring internals should work.-const errors = require(requireName + '/lib/errors');+const errors = require(requireName + '/lib/utils/errors');const installer = require(requireName + '/lib/install/installer');(async () => {diff --git a/src/progress.ts b/src/progress.tsindex ae3ff0fe2d..436bc096e8 100644--- a/src/progress.ts+++ b/src/progress.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { TimeoutError } from './errors';+import { TimeoutError } from './utils/errors';import { assert, debugLogger, LogName } from './helper';import { rewriteErrorMessage } from './utils/stackTrace';diff --git a/src/rpc/channels.ts b/src/protocol/channels.tssimilarity index 100%rename from src/rpc/channels.tsrename to src/protocol/channels.tsdiff --git a/src/rpc/protocol.yml b/src/protocol/protocol.ymlsimilarity index 100%rename from src/rpc/protocol.ymlrename to src/protocol/protocol.ymldiff --git a/src/rpc/serializers.ts b/src/protocol/serializers.tssimilarity index 99%rename from src/rpc/serializers.tsrename to src/protocol/serializers.tsindex 9c0c882f12..aee1c99c9e 100644--- a/src/rpc/serializers.ts+++ b/src/protocol/serializers.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { TimeoutError } from '../errors';+import { TimeoutError } from '../utils/errors';import { helper } from '../helper';import { SerializedError, SerializedValue } from './channels';diff --git a/src/rpc/transport.ts b/src/protocol/transport.tssimilarity index 100%rename from src/rpc/transport.tsrename to src/protocol/transport.tsdiff --git a/src/rpc/validator.ts b/src/protocol/validator.tssimilarity index 100%rename from src/rpc/validator.tsrename to src/protocol/validator.tsdiff --git a/src/rpc/validatorPrimitives.ts b/src/protocol/validatorPrimitives.tssimilarity index 100%rename from src/rpc/validatorPrimitives.tsrename to src/protocol/validatorPrimitives.tsdiff --git a/src/rpc/browserServerImpl.ts b/src/rpc/browserServerImpl.tsindex 9214648999..573ac55450 100644--- a/src/rpc/browserServerImpl.ts+++ b/src/rpc/browserServerImpl.ts@@ -25,7 +25,7 @@ import { DispatcherScope, DispatcherConnection } from './server/dispatcher';import { BrowserTypeDispatcher } from './server/browserTypeDispatcher';import { BrowserDispatcher } from './server/browserDispatcher';import { BrowserContextDispatcher } from './server/browserContextDispatcher';-import { BrowserNewContextParams, BrowserContextChannel } from './channels';+import { BrowserNewContextParams, BrowserContextChannel } from '../protocol/channels';import { BrowserServerLauncher, BrowserServer } from './client/browserType';import { envObjectToArray } from './client/clientHelper';diff --git a/src/rpc/client.ts b/src/rpc/client.tsindex 92edd4f9da..51f7576e9f 100644--- a/src/rpc/client.ts+++ b/src/rpc/client.ts@@ -17,7 +17,7 @@import * as childProcess from 'child_process';import * as path from 'path';import { Connection } from './client/connection';-import { Transport } from './transport';+import { Transport } from '../protocol/transport';(async () => {const spawnedProcess = childProcess.fork(path.join(__dirname, 'server'), [], { stdio: 'pipe' });diff --git a/src/rpc/client/accessibility.ts b/src/rpc/client/accessibility.tsindex 170870ef9f..4ac7616331 100644--- a/src/rpc/client/accessibility.ts+++ b/src/rpc/client/accessibility.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { PageChannel, AXNode } from '../channels';+import { PageChannel, AXNode } from '../../protocol/channels';import { ElementHandle } from './elementHandle';type SerializedAXNode = Omit<AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & {diff --git a/src/rpc/client/api.ts b/src/rpc/client/api.tsindex 2997005f76..6959f02e5e 100644--- a/src/rpc/client/api.ts+++ b/src/rpc/client/api.ts@@ -25,7 +25,7 @@ export { Download } from './download';export { ElementHandle } from './elementHandle';export { FileChooser } from './fileChooser';export { Logger } from './types';-export { TimeoutError } from '../../errors';+export { TimeoutError } from '../../utils/errors';export { Frame } from './frame';export { Keyboard, Mouse } from './input';export { JSHandle } from './jsHandle';diff --git a/src/rpc/client/browser.ts b/src/rpc/client/browser.tsindex 4471787948..912e2b7bac 100644--- a/src/rpc/client/browser.ts+++ b/src/rpc/client/browser.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../channels';+import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../../protocol/channels';import { BrowserContext } from './browserContext';import { Page } from './page';import { ChannelOwner } from './channelOwner';diff --git a/src/rpc/client/browserContext.ts b/src/rpc/client/browserContext.tsindex 5e20ae320a..7b48f8017b 100644--- a/src/rpc/client/browserContext.ts+++ b/src/rpc/client/browserContext.ts@@ -18,7 +18,7 @@import * as frames from './frame';import { Page, BindingCall } from './page';import * as network from './network';-import { BrowserContextChannel, BrowserContextInitializer } from '../channels';+import { BrowserContextChannel, BrowserContextInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { isUnderTest, deprecate, evaluationScript, urlMatches } from './clientHelper';import { Browser } from './browser';diff --git a/src/rpc/client/browserType.ts b/src/rpc/client/browserType.tsindex 0e68b2f6fc..8675e73ce1 100644--- a/src/rpc/client/browserType.ts+++ b/src/rpc/client/browserType.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../channels';+import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../../protocol/channels';import { Browser } from './browser';import { BrowserContext } from './browserContext';import { ChannelOwner } from './channelOwner';@@ -23,7 +23,7 @@ import { assert, helper } from '../../helper';import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types';import * as WebSocket from 'ws';import { Connection } from './connection';-import { serializeError } from '../serializers';+import { serializeError } from '../../protocol/serializers';import { Events } from './events';import { TimeoutSettings } from '../../timeoutSettings';import { ChildProcess } from 'child_process';diff --git a/src/rpc/client/cdpSession.ts b/src/rpc/client/cdpSession.tsindex 904ade04e1..b71824c3e7 100644--- a/src/rpc/client/cdpSession.ts+++ b/src/rpc/client/cdpSession.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { CDPSessionChannel, CDPSessionInitializer } from '../channels';+import { CDPSessionChannel, CDPSessionInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { Protocol } from '../../chromium/protocol';diff --git a/src/rpc/client/channelOwner.ts b/src/rpc/client/channelOwner.tsindex 666df912ac..89251f5772 100644--- a/src/rpc/client/channelOwner.ts+++ b/src/rpc/client/channelOwner.ts@@ -15,7 +15,7 @@*/import { EventEmitter } from 'events';-import type { Channel } from '../channels';+import type { Channel } from '../../protocol/channels';import type { Connection } from './connection';import type { LoggerSink } from './types';import { debugLogger } from '../../helper';diff --git a/src/rpc/client/chromiumBrowserContext.ts b/src/rpc/client/chromiumBrowserContext.tsindex 675eae7024..fd04232e11 100644--- a/src/rpc/client/chromiumBrowserContext.ts+++ b/src/rpc/client/chromiumBrowserContext.ts@@ -16,7 +16,7 @@*/import { Page } from './page';-import { BrowserContextInitializer } from '../channels';+import { BrowserContextInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { CDPSession } from './cdpSession';import { Events } from './events';diff --git a/src/rpc/client/chromiumCoverage.ts b/src/rpc/client/chromiumCoverage.tsindex 25c196f19e..20ad9c0cc4 100644--- a/src/rpc/client/chromiumCoverage.ts+++ b/src/rpc/client/chromiumCoverage.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../channels';+import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../../protocol/channels';let __dummyJSResult: PageCrStopJSCoverageResult;type PageCrStopJSCoverageResultEntries = typeof __dummyJSResult.entries;diff --git a/src/rpc/client/connection.ts b/src/rpc/client/connection.tsindex 7be038e85f..b55d2f67de 100644--- a/src/rpc/client/connection.ts+++ b/src/rpc/client/connection.ts@@ -27,16 +27,16 @@ import { Worker } from './worker';import { ConsoleMessage } from './consoleMessage';import { Dialog } from './dialog';import { Download } from './download';-import { parseError } from '../serializers';+import { parseError } from '../../protocol/serializers';import { CDPSession } from './cdpSession';import { Playwright } from './playwright';import { Electron, ElectronApplication } from './electron';-import { Channel } from '../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 '../validator';+import { createScheme, Validator, ValidationError } from '../../protocol/validator';import { WebKitBrowser } from './webkitBrowser';import { FirefoxBrowser } from './firefoxBrowser';import { debugLogger } from '../../helper';diff --git a/src/rpc/client/consoleMessage.ts b/src/rpc/client/consoleMessage.tsindex 17909cdde6..cba8e812e8 100644--- a/src/rpc/client/consoleMessage.ts+++ b/src/rpc/client/consoleMessage.ts@@ -16,7 +16,7 @@import * as util from 'util';import { JSHandle } from './jsHandle';-import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../channels';+import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';type ConsoleMessageLocation = ConsoleMessageInitializer['location'];diff --git a/src/rpc/client/dialog.ts b/src/rpc/client/dialog.tsindex c0117094f1..99564d5abe 100644--- a/src/rpc/client/dialog.ts+++ b/src/rpc/client/dialog.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { DialogChannel, DialogInitializer } from '../channels';+import { DialogChannel, DialogInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';export class Dialog extends ChannelOwner<DialogChannel, DialogInitializer> {diff --git a/src/rpc/client/download.ts b/src/rpc/client/download.tsindex 080de5b359..ab08f1f3df 100644--- a/src/rpc/client/download.ts+++ b/src/rpc/client/download.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { DownloadChannel, DownloadInitializer } from '../channels';+import { DownloadChannel, DownloadInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { Readable } from 'stream';import { Stream } from './stream';diff --git a/src/rpc/client/electron.ts b/src/rpc/client/electron.tsindex cb351d5a8d..6ecedd309a 100644--- a/src/rpc/client/electron.ts+++ b/src/rpc/client/electron.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../channels';+import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../../protocol/channels';import { BrowserContext } from './browserContext';import { ChannelOwner } from './channelOwner';import { Page } from './page';diff --git a/src/rpc/client/elementHandle.ts b/src/rpc/client/elementHandle.tsindex 625b6063c1..7ceabb7236 100644--- a/src/rpc/client/elementHandle.ts+++ b/src/rpc/client/elementHandle.ts@@ -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 '../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';diff --git a/src/rpc/client/fileChooser.ts b/src/rpc/client/fileChooser.tsindex 2b20bd3005..4c49091175 100644--- a/src/rpc/client/fileChooser.ts+++ b/src/rpc/client/fileChooser.ts@@ -17,7 +17,7 @@import { ElementHandle } from './elementHandle';import { Page } from './page';import { FilePayload } from './types';-import { ElementHandleSetInputFilesOptions } from '../channels';+import { ElementHandleSetInputFilesOptions } from '../../protocol/channels';export class FileChooser {private _page: Page;diff --git a/src/rpc/client/frame.ts b/src/rpc/client/frame.tsindex 2abfa54390..ed8d51ba07 100644--- a/src/rpc/client/frame.ts+++ b/src/rpc/client/frame.ts@@ -16,7 +16,7 @@*/import { assert } from '../../helper';-import { FrameChannel, FrameInitializer, FrameNavigatedEvent, FrameGotoOptions, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../channels';+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';diff --git a/src/rpc/client/input.ts b/src/rpc/client/input.tsindex 7184b9e127..1139e323cd 100644--- a/src/rpc/client/input.ts+++ b/src/rpc/client/input.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../channels';+import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../../protocol/channels';export class Keyboard {private _channel: PageChannel;diff --git a/src/rpc/client/jsHandle.ts b/src/rpc/client/jsHandle.tsindex 8f3212288e..9cd35ca657 100644--- a/src/rpc/client/jsHandle.ts+++ b/src/rpc/client/jsHandle.ts@@ -14,10 +14,10 @@* limitations under the License.*/-import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../channels';+import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../../protocol/channels';import { ElementHandle } from './elementHandle';import { ChannelOwner } from './channelOwner';-import { parseSerializedValue, serializeValue } from '../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> =diff --git a/src/rpc/client/network.ts b/src/rpc/client/network.tsindex 5af92a017e..1d95bf8fa4 100644--- a/src/rpc/client/network.ts+++ b/src/rpc/client/network.ts@@ -15,7 +15,7 @@*/import { URLSearchParams } from 'url';-import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../channels';+import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { Frame } from './frame';import { headersArrayToObject, headersObjectToArray } from '../../converters';diff --git a/src/rpc/client/page.ts b/src/rpc/client/page.tsindex b9b94eb93c..9ba7c6bb3b 100644--- a/src/rpc/client/page.ts+++ b/src/rpc/client/page.ts@@ -18,8 +18,8 @@import { Events } from './events';import { assert, helper, Listener, mkdirIfNeeded } from '../../helper';import { TimeoutSettings } from '../../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 '../channels';-import { parseError, serializeError } from '../serializers';+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 { headersObjectToArray } from '../../converters';import { Accessibility } from './accessibility';import { BrowserContext } from './browserContext';diff --git a/src/rpc/client/playwright.ts b/src/rpc/client/playwright.tsindex c6a6d70697..63b7b3d028 100644--- a/src/rpc/client/playwright.ts+++ b/src/rpc/client/playwright.ts@@ -14,12 +14,12 @@* limitations under the License.*/-import { PlaywrightChannel, PlaywrightInitializer } from '../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 '../../errors';+import { TimeoutError } from '../../utils/errors';import { Size } from './types';type DeviceDescriptor = {diff --git a/src/rpc/client/selectors.ts b/src/rpc/client/selectors.tsindex 92a3605015..3aba2639de 100644--- a/src/rpc/client/selectors.ts+++ b/src/rpc/client/selectors.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { SelectorsChannel, SelectorsInitializer } from '../channels';+import { SelectorsChannel, SelectorsInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { ElementHandle } from './elementHandle';import { evaluationScript } from './clientHelper';diff --git a/src/rpc/client/stream.ts b/src/rpc/client/stream.tsindex 738d52d712..f0e88dd1a2 100644--- a/src/rpc/client/stream.ts+++ b/src/rpc/client/stream.ts@@ -15,7 +15,7 @@*/import { Readable } from 'stream';-import { StreamChannel, StreamInitializer } from '../channels';+import { StreamChannel, StreamInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';export class Stream extends ChannelOwner<StreamChannel, StreamInitializer> {diff --git a/src/rpc/client/types.ts b/src/rpc/client/types.tsindex eda04a8b93..c43b8f05a1 100644--- a/src/rpc/client/types.ts+++ b/src/rpc/client/types.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../channels';+import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../../protocol/channels';type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error';export interface LoggerSink {diff --git a/src/rpc/client/waiter.ts b/src/rpc/client/waiter.tsindex 471188e17b..2e1d8ee427 100644--- a/src/rpc/client/waiter.ts+++ b/src/rpc/client/waiter.ts@@ -16,7 +16,7 @@import { EventEmitter } from 'events';import { rewriteErrorMessage } from '../../utils/stackTrace';-import { TimeoutError } from '../../errors';+import { TimeoutError } from '../../utils/errors';export class Waiter {private _dispose: (() => void)[] = [];diff --git a/src/rpc/client/worker.ts b/src/rpc/client/worker.tsindex c7dee8b718..e3725baade 100644--- a/src/rpc/client/worker.ts+++ b/src/rpc/client/worker.ts@@ -15,7 +15,7 @@*/import { Events } from './events';-import { WorkerChannel, WorkerInitializer } from '../channels';+import { WorkerChannel, WorkerInitializer } from '../../protocol/channels';import { ChannelOwner } from './channelOwner';import { assertMaxArguments, Func1, JSHandle, parseResult, serializeArgument, SmartHandle } from './jsHandle';import { Page } from './page';diff --git a/src/rpc/server.ts b/src/rpc/server.tsindex 4a8a61e328..8ac606cc5d 100644--- a/src/rpc/server.ts+++ b/src/rpc/server.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { Transport } from './transport';+import { Transport } from '../protocol/transport';import { DispatcherConnection } from './server/dispatcher';import { Playwright } from '../server/playwright';import { PlaywrightDispatcher } from './server/playwrightDispatcher';diff --git a/src/rpc/server/browserContextDispatcher.ts b/src/rpc/server/browserContextDispatcher.tsindex 4183401830..9c9c32e47f 100644--- a/src/rpc/server/browserContextDispatcher.ts+++ b/src/rpc/server/browserContextDispatcher.ts@@ -17,7 +17,7 @@import { BrowserContext } from '../../browserContext';import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { RouteDispatcher, RequestDispatcher } from './networkDispatchers';import { CRBrowserContext } from '../../chromium/crBrowser';import { CDPSessionDispatcher } from './cdpSessionDispatcher';diff --git a/src/rpc/server/browserDispatcher.ts b/src/rpc/server/browserDispatcher.tsindex d690b19946..8bc90b222c 100644--- a/src/rpc/server/browserDispatcher.ts+++ b/src/rpc/server/browserDispatcher.ts@@ -15,7 +15,7 @@*/import { Browser } from '../../browser';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { BrowserContextDispatcher } from './browserContextDispatcher';import { CDPSessionDispatcher } from './cdpSessionDispatcher';import { Dispatcher, DispatcherScope } from './dispatcher';diff --git a/src/rpc/server/browserTypeDispatcher.ts b/src/rpc/server/browserTypeDispatcher.tsindex 1286400fb4..48d68ca3eb 100644--- a/src/rpc/server/browserTypeDispatcher.ts+++ b/src/rpc/server/browserTypeDispatcher.ts@@ -16,7 +16,7 @@import { BrowserTypeBase, BrowserType } from '../../server/browserType';import { BrowserDispatcher } from './browserDispatcher';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';import { BrowserContextDispatcher } from './browserContextDispatcher';diff --git a/src/rpc/server/cdpSessionDispatcher.ts b/src/rpc/server/cdpSessionDispatcher.tsindex 0b9414c4e2..49c88e6248 100644--- a/src/rpc/server/cdpSessionDispatcher.ts+++ b/src/rpc/server/cdpSessionDispatcher.ts@@ -15,7 +15,7 @@*/import { CRSession, CRSessionEvents } from '../../chromium/crConnection';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionInitializer> implements channels.CDPSessionChannel {diff --git a/src/rpc/server/consoleMessageDispatcher.ts b/src/rpc/server/consoleMessageDispatcher.tsindex 5ff601d636..3ab93d0e38 100644--- a/src/rpc/server/consoleMessageDispatcher.ts+++ b/src/rpc/server/consoleMessageDispatcher.ts@@ -15,7 +15,7 @@*/import { ConsoleMessage } from '../../console';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';import { createHandle } from './elementHandlerDispatcher';diff --git a/src/rpc/server/dialogDispatcher.ts b/src/rpc/server/dialogDispatcher.tsindex 55b678efaf..2e77c28115 100644--- a/src/rpc/server/dialogDispatcher.ts+++ b/src/rpc/server/dialogDispatcher.ts@@ -15,7 +15,7 @@*/import { Dialog } from '../../dialog';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogInitializer> implements channels.DialogChannel {diff --git a/src/rpc/server/dispatcher.ts b/src/rpc/server/dispatcher.tsindex e122efc696..13cb007e1d 100644--- a/src/rpc/server/dispatcher.ts+++ b/src/rpc/server/dispatcher.ts@@ -16,9 +16,9 @@import { EventEmitter } from 'events';import { helper, debugAssert, assert } from '../../helper';-import * as channels from '../channels';-import { serializeError } from '../serializers';-import { createScheme, Validator, ValidationError } from '../validator';+import * as channels from '../../protocol/channels';+import { serializeError } from '../../protocol/serializers';+import { createScheme, Validator, ValidationError } from '../../protocol/validator';export const dispatcherSymbol = Symbol('dispatcher');diff --git a/src/rpc/server/downloadDispatcher.ts b/src/rpc/server/downloadDispatcher.tsindex 450b3c9768..ce9a2c1a62 100644--- a/src/rpc/server/downloadDispatcher.ts+++ b/src/rpc/server/downloadDispatcher.ts@@ -15,7 +15,7 @@*/import { Download } from '../../download';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';import { StreamDispatcher } from './streamDispatcher';diff --git a/src/rpc/server/electronDispatcher.ts b/src/rpc/server/electronDispatcher.tsindex 190cfcf7ad..ce1e0f2ce6 100644--- a/src/rpc/server/electronDispatcher.ts+++ b/src/rpc/server/electronDispatcher.ts@@ -16,7 +16,7 @@import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';import { Electron, ElectronApplication, ElectronPage } from '../../server/electron';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { BrowserContextDispatcher } from './browserContextDispatcher';import { PageDispatcher } from './pageDispatcher';import { parseArgument, serializeResult } from './jsHandleDispatcher';diff --git a/src/rpc/server/elementHandlerDispatcher.ts b/src/rpc/server/elementHandlerDispatcher.tsindex e76e3fb3ac..cb86c3a902 100644--- a/src/rpc/server/elementHandlerDispatcher.ts+++ b/src/rpc/server/elementHandlerDispatcher.ts@@ -16,7 +16,7 @@import { ElementHandle } from '../../dom';import * as js from '../../javascript';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { DispatcherScope, lookupNullableDispatcher } from './dispatcher';import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';import { FrameDispatcher } from './frameDispatcher';diff --git a/src/rpc/server/frameDispatcher.ts b/src/rpc/server/frameDispatcher.tsindex c918bfc6bc..6296f0ce4b 100644--- a/src/rpc/server/frameDispatcher.ts+++ b/src/rpc/server/frameDispatcher.ts@@ -16,7 +16,7 @@import { Frame, NavigationEvent } from '../../frames';import * as types from '../../types';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';import { parseArgument, serializeResult } from './jsHandleDispatcher';diff --git a/src/rpc/server/jsHandleDispatcher.ts b/src/rpc/server/jsHandleDispatcher.tsindex 9fc363064f..1780681f0b 100644--- a/src/rpc/server/jsHandleDispatcher.ts+++ b/src/rpc/server/jsHandleDispatcher.ts@@ -15,10 +15,10 @@*/import * as js from '../../javascript';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';import { createHandle } from './elementHandlerDispatcher';-import { parseSerializedValue, serializeValue } from '../serializers';+import { parseSerializedValue, serializeValue } from '../../protocol/serializers';export class JSHandleDispatcher extends Dispatcher<js.JSHandle, channels.JSHandleInitializer> implements channels.JSHandleChannel {diff --git a/src/rpc/server/networkDispatchers.ts b/src/rpc/server/networkDispatchers.tsindex be8c0d8caf..4ef557bdb7 100644--- a/src/rpc/server/networkDispatchers.ts+++ b/src/rpc/server/networkDispatchers.ts@@ -15,7 +15,7 @@*/import { Request, Response, Route } from '../../network';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';import { FrameDispatcher } from './frameDispatcher';diff --git a/src/rpc/server/pageDispatcher.ts b/src/rpc/server/pageDispatcher.tsindex 1f83bcad3d..865647485e 100644--- a/src/rpc/server/pageDispatcher.ts+++ b/src/rpc/server/pageDispatcher.ts@@ -18,9 +18,9 @@ import { BrowserContext } from '../../browserContext';import { Frame } from '../../frames';import { Request } from '../../network';import { Page, Worker } from '../../page';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';-import { parseError, serializeError } from '../serializers';+import { parseError, serializeError } from '../../protocol/serializers';import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';import { DialogDispatcher } from './dialogDispatcher';import { DownloadDispatcher } from './downloadDispatcher';diff --git a/src/rpc/server/playwrightDispatcher.ts b/src/rpc/server/playwrightDispatcher.tsindex 5d22da73f8..c28a211213 100644--- a/src/rpc/server/playwrightDispatcher.ts+++ b/src/rpc/server/playwrightDispatcher.ts@@ -15,7 +15,7 @@*/import { Playwright } from '../../server/playwright';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { BrowserTypeDispatcher } from './browserTypeDispatcher';import { Dispatcher, DispatcherScope } from './dispatcher';import { SelectorsDispatcher } from './selectorsDispatcher';diff --git a/src/rpc/server/selectorsDispatcher.ts b/src/rpc/server/selectorsDispatcher.tsindex 3d291b3c04..a4db3f1d5a 100644--- a/src/rpc/server/selectorsDispatcher.ts+++ b/src/rpc/server/selectorsDispatcher.ts@@ -15,7 +15,7 @@*/import { Dispatcher, DispatcherScope } from './dispatcher';-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Selectors } from '../../selectors';import { ElementHandleDispatcher } from './elementHandlerDispatcher';import * as dom from '../../dom';diff --git a/src/rpc/server/streamDispatcher.ts b/src/rpc/server/streamDispatcher.tsindex dc28f08abf..997270465f 100644--- a/src/rpc/server/streamDispatcher.ts+++ b/src/rpc/server/streamDispatcher.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import * as channels from '../channels';+import * as channels from '../../protocol/channels';import { Dispatcher, DispatcherScope } from './dispatcher';import * as stream from 'stream';diff --git a/src/errors.ts b/src/utils/errors.tssimilarity index 100%rename from src/errors.tsrename to src/utils/errors.tsdiff --git a/test/launcher.spec.ts b/test/launcher.spec.tsindex 5efa99a071..e35c4eda53 100644--- a/test/launcher.spec.ts+++ b/test/launcher.spec.ts@@ -20,7 +20,7 @@ import path from 'path';import utils from './utils';it('should require top-level Errors', async({}) => {- const Errors = require(path.join(utils.projectRoot(), '/lib/errors.js'));+ const Errors = require(path.join(utils.projectRoot(), '/lib/utils/errors.js'));expect(String(Errors.TimeoutError)).toContain('TimeoutError');});diff --git a/test/playwright.fixtures.ts b/test/playwright.fixtures.tsindex f76a03f150..96a10b9645 100644--- a/test/playwright.fixtures.ts+++ b/test/playwright.fixtures.ts@@ -21,7 +21,7 @@ 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 { Transport } from '../lib/rpc/transport';+import { Transport } from '../lib/protocol/transport';import { setUnderTest } from '../lib/helper';import { installCoverageHooks } from './coverage';import { parameters, registerFixture, registerWorkerFixture } from '../test-runner';diff --git a/utils/generate_channels.js b/utils/generate_channels.jsindex e9556df489..3cb857cb45 100755--- a/utils/generate_channels.js+++ b/utils/generate_channels.js@@ -157,7 +157,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {};`];-const yml = fs.readFileSync(path.join(__dirname, '..', 'src', 'rpc', 'protocol.yml'), 'utf-8');+const yml = fs.readFileSync(path.join(__dirname, '..', 'src', 'protocol', 'protocol.yml'), 'utf-8');const protocol = yaml.parse(yml);function addScheme(name, s) {@@ -243,6 +243,6 @@ function writeFile(filePath, content) {fs.writeFileSync(filePath, content, 'utf8');}-writeFile(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n'));-writeFile(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n'));+writeFile(path.join(__dirname, '..', 'src', 'protocol', 'channels.ts'), channels_ts.join('\n'));+writeFile(path.join(__dirname, '..', 'src', 'protocol', 'validator.ts'), validator_ts.join('\n'));process.exit(hasChanges ? 1 : 0);diff --git a/utils/watch.js b/utils/watch.jsindex b94228eb51..0c4c3b1406 100644--- a/utils/watch.js+++ b/utils/watch.js@@ -25,11 +25,11 @@ const spawns = [];process.on('exit', () => spawns.forEach(s => s.kill()));-runOnChanges(['src/rpc/protocol.yml'], 'utils/generate_channels.js');+runOnChanges(['src/protocol/protocol.yml'], 'utils/generate_channels.js');runOnChanges(['docs/api.md', 'utils/generate_types/overrides.d.ts', 'utils/generate_types/exported.json'], 'utils/generate_types/index.js');/**- * @param {string[][]} paths+ * @param {string[][]} paths* @param {string} nodeFile*/function runOnChanges(paths, nodeFile) {@@ -41,9 +41,9 @@ function runOnChanges(paths, nodeFile) {}fs.watchFile(filePath, callback);}-+callback();-+function callback() {child_process.spawnSync('node', [path.join(__dirname, '..', ...nodeFile.split('/'))]);}