Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: move src files to server (#3593)

Dmitry Gozmancd220daa839a
diff --git a/docs/api.md b/docs/api.md
index f43cdc2987..e61bb52b1e 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -74,7 +74,7 @@ This object can be used to launch or connect to Chromium, returning instances of
#### playwright.devices
- returns: <[Object]>
-Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
+Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).
```js
const { webkit, devices } = require('playwright');
diff --git a/src/rpc/browserServerImpl.ts b/src/rpc/browserServerImpl.ts
index 7cca64e7a7..e89dcf3c81 100644
--- a/src/rpc/browserServerImpl.ts
+++ b/src/rpc/browserServerImpl.ts
@@ -17,8 +17,8 @@
import { LaunchServerOptions } from '../client/types';
import { BrowserTypeBase } from '../server/browserType';
import * as ws from 'ws';
-import { helper } from '../helper';
-import { Browser } from '../browser';
+import { helper } from '../server/helper';
+import { Browser } from '../server/browser';
import { ChildProcess } from 'child_process';
import { EventEmitter } from 'ws';
import { DispatcherScope, DispatcherConnection } from './server/dispatcher';
diff --git a/src/rpc/server/browserContextDispatcher.ts b/src/rpc/server/browserContextDispatcher.ts
index 3edcb5fe9e..d483560fde 100644
--- a/src/rpc/server/browserContextDispatcher.ts
+++ b/src/rpc/server/browserContextDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { BrowserContext } from '../../browserContext';
+import { BrowserContext } from '../../server/browserContext';
import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
import * as channels from '../../protocol/channels';
diff --git a/src/rpc/server/browserDispatcher.ts b/src/rpc/server/browserDispatcher.ts
index e2ecd9482c..6a927f8467 100644
--- a/src/rpc/server/browserDispatcher.ts
+++ b/src/rpc/server/browserDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Browser } from '../../browser';
+import { Browser } from '../../server/browser';
import * as channels from '../../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
diff --git a/src/rpc/server/consoleMessageDispatcher.ts b/src/rpc/server/consoleMessageDispatcher.ts
index 3ab93d0e38..572be021fc 100644
--- a/src/rpc/server/consoleMessageDispatcher.ts
+++ b/src/rpc/server/consoleMessageDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ConsoleMessage } from '../../console';
+import { ConsoleMessage } from '../../server/console';
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.ts
index 2e77c28115..78d61c3d15 100644
--- a/src/rpc/server/dialogDispatcher.ts
+++ b/src/rpc/server/dialogDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Dialog } from '../../dialog';
+import { Dialog } from '../../server/dialog';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
diff --git a/src/rpc/server/dispatcher.ts b/src/rpc/server/dispatcher.ts
index 7ccc00a9d3..e1392b1d53 100644
--- a/src/rpc/server/dispatcher.ts
+++ b/src/rpc/server/dispatcher.ts
@@ -15,7 +15,7 @@
*/
import { EventEmitter } from 'events';
-import { helper } from '../../helper';
+import { helper } from '../../server/helper';
import * as channels from '../../protocol/channels';
import { serializeError } from '../../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../../protocol/validator';
diff --git a/src/rpc/server/downloadDispatcher.ts b/src/rpc/server/downloadDispatcher.ts
index ce9a2c1a62..0487b18869 100644
--- a/src/rpc/server/downloadDispatcher.ts
+++ b/src/rpc/server/downloadDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Download } from '../../download';
+import { Download } from '../../server/download';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';
diff --git a/src/rpc/server/elementHandlerDispatcher.ts b/src/rpc/server/elementHandlerDispatcher.ts
index cb86c3a902..434d8638c9 100644
--- a/src/rpc/server/elementHandlerDispatcher.ts
+++ b/src/rpc/server/elementHandlerDispatcher.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { ElementHandle } from '../../dom';
-import * as js from '../../javascript';
+import { ElementHandle } from '../../server/dom';
+import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
import { DispatcherScope, lookupNullableDispatcher } from './dispatcher';
import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';
diff --git a/src/rpc/server/frameDispatcher.ts b/src/rpc/server/frameDispatcher.ts
index 312ceffacd..f12302718f 100644
--- a/src/rpc/server/frameDispatcher.ts
+++ b/src/rpc/server/frameDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Frame, NavigationEvent } from '../../frames';
+import { Frame, NavigationEvent } from '../../server/frames';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
diff --git a/src/rpc/server/jsHandleDispatcher.ts b/src/rpc/server/jsHandleDispatcher.ts
index 1780681f0b..69668f9a98 100644
--- a/src/rpc/server/jsHandleDispatcher.ts
+++ b/src/rpc/server/jsHandleDispatcher.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as js from '../../javascript';
+import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher';
diff --git a/src/rpc/server/networkDispatchers.ts b/src/rpc/server/networkDispatchers.ts
index 4ef557bdb7..af55900f94 100644
--- a/src/rpc/server/networkDispatchers.ts
+++ b/src/rpc/server/networkDispatchers.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Request, Response, Route } from '../../network';
+import { Request, Response, Route } from '../../server/network';
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.ts
index 8bf5c60b3a..57dd91221b 100644
--- a/src/rpc/server/pageDispatcher.ts
+++ b/src/rpc/server/pageDispatcher.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { BrowserContext } from '../../browserContext';
-import { Frame } from '../../frames';
-import { Request } from '../../network';
-import { Page, Worker } from '../../page';
+import { BrowserContext } from '../../server/browserContext';
+import { Frame } from '../../server/frames';
+import { Request } from '../../server/network';
+import { Page, Worker } from '../../server/page';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import { parseError, serializeError } from '../../protocol/serializers';
@@ -28,7 +28,7 @@ import { FrameDispatcher } from './frameDispatcher';
import { RequestDispatcher, ResponseDispatcher, RouteDispatcher } from './networkDispatchers';
import { serializeResult, parseArgument } from './jsHandleDispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
-import { FileChooser } from '../../fileChooser';
+import { FileChooser } from '../../server/fileChooser';
import { CRCoverage } from '../../server/chromium/crCoverage';
export class PageDispatcher extends Dispatcher<Page, channels.PageInitializer> implements channels.PageChannel {
diff --git a/src/rpc/server/playwrightDispatcher.ts b/src/rpc/server/playwrightDispatcher.ts
index 40c6e963e8..41e533a538 100644
--- a/src/rpc/server/playwrightDispatcher.ts
+++ b/src/rpc/server/playwrightDispatcher.ts
@@ -21,7 +21,7 @@ import { Dispatcher, DispatcherScope } from './dispatcher';
import { SelectorsDispatcher } from './selectorsDispatcher';
import { Electron } from '../../server/electron/electron';
import { ElectronDispatcher } from './electronDispatcher';
-import { DeviceDescriptors } from '../../deviceDescriptors';
+import { DeviceDescriptors } from '../../server/deviceDescriptors';
export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.PlaywrightInitializer> implements channels.PlaywrightChannel {
constructor(scope: DispatcherScope, playwright: Playwright) {
diff --git a/src/rpc/server/selectorsDispatcher.ts b/src/rpc/server/selectorsDispatcher.ts
index a4db3f1d5a..308bb754f8 100644
--- a/src/rpc/server/selectorsDispatcher.ts
+++ b/src/rpc/server/selectorsDispatcher.ts
@@ -16,9 +16,9 @@
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as channels from '../../protocol/channels';
-import { Selectors } from '../../selectors';
+import { Selectors } from '../../server/selectors';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
-import * as dom from '../../dom';
+import * as dom from '../../server/dom';
export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsInitializer> implements channels.SelectorsChannel {
constructor(scope: DispatcherScope, selectors: Selectors) {
diff --git a/src/accessibility.ts b/src/server/accessibility.ts
similarity index 100%
rename from src/accessibility.ts
rename to src/server/accessibility.ts
diff --git a/src/browser.ts b/src/server/browser.ts
similarity index 100%
rename from src/browser.ts
rename to src/server/browser.ts
diff --git a/src/browserContext.ts b/src/server/browserContext.ts
similarity index 98%
rename from src/browserContext.ts
rename to src/server/browserContext.ts
index 44d69d7c52..12277c445f 100644
--- a/src/browserContext.ts
+++ b/src/server/browserContext.ts
@@ -20,15 +20,15 @@ import { helper } from './helper';
import * as network from './network';
import * as path from 'path';
import { Page, PageBinding } from './page';
-import { TimeoutSettings } from './utils/timeoutSettings';
+import { TimeoutSettings } from '../utils/timeoutSettings';
import * as frames from './frames';
import * as types from './types';
import { Download } from './download';
import { Browser } from './browser';
import { EventEmitter } from 'events';
import { Progress } from './progress';
-import { DebugController } from './server/debug/debugController';
-import { isDebugMode } from './utils/utils';
+import { DebugController } from './debug/debugController';
+import { isDebugMode } from '../utils/utils';
export class Screencast {
readonly path: string;
diff --git a/src/server/browserType.ts b/src/server/browserType.ts
index 88993a29dd..07ab7aa786 100644
--- a/src/server/browserType.ts
+++ b/src/server/browserType.ts
@@ -18,14 +18,14 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as util from 'util';
-import { BrowserContext, verifyProxySettings, validateBrowserContextOptions } from '../browserContext';
+import { BrowserContext, verifyProxySettings, validateBrowserContextOptions } from './browserContext';
import * as browserPaths from '../utils/browserPaths';
-import { ConnectionTransport, WebSocketTransport } from '../transport';
-import { BrowserOptions, Browser, BrowserProcess } from '../browser';
+import { ConnectionTransport, WebSocketTransport } from './transport';
+import { BrowserOptions, Browser, BrowserProcess } from './browser';
import { launchProcess, Env, waitForLine, envArrayToObject } from './processLauncher';
import { PipeTransport } from './pipeTransport';
-import { Progress, runAbortableTask } from '../progress';
-import * as types from '../types';
+import { Progress, runAbortableTask } from './progress';
+import * as types from './types';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { validateHostRequirements } from './validateDependencies';
import { assert, isDebugMode } from '../utils/utils';
diff --git a/src/server/chromium/chromium.ts b/src/server/chromium/chromium.ts
index b68c1e92ce..044235e4d4 100644
--- a/src/server/chromium/chromium.ts
+++ b/src/server/chromium/chromium.ts
@@ -22,11 +22,11 @@ import { Env } from '../processLauncher';
import { kBrowserCloseMessageId } from './crConnection';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { BrowserTypeBase } from '../browserType';
-import { ConnectionTransport, ProtocolRequest } from '../../transport';
+import { ConnectionTransport, ProtocolRequest } from '../transport';
import type { BrowserDescriptor } from '../../utils/browserPaths';
import { CRDevTools } from './crDevTools';
-import { BrowserOptions } from '../../browser';
-import * as types from '../../types';
+import { BrowserOptions } from '../browser';
+import * as types from '../types';
import { isDebugMode, getFromENV } from '../../utils/utils';
export class Chromium extends BrowserTypeBase {
diff --git a/src/server/chromium/crAccessibility.ts b/src/server/chromium/crAccessibility.ts
index ede3c94f28..de94f274d2 100644
--- a/src/server/chromium/crAccessibility.ts
+++ b/src/server/chromium/crAccessibility.ts
@@ -17,9 +17,9 @@
import { CRSession } from './crConnection';
import { Protocol } from './protocol';
-import * as dom from '../../dom';
-import * as accessibility from '../../accessibility';
-import * as types from '../../types';
+import * as dom from '../dom';
+import * as accessibility from '../accessibility';
+import * as types from '../types';
export async function getAccessibilityTree(client: CRSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const {nodes} = await client.send('Accessibility.getFullAXTree');
diff --git a/src/server/chromium/crBrowser.ts b/src/server/chromium/crBrowser.ts
index 0fe6f15f43..80e6f47286 100644
--- a/src/server/chromium/crBrowser.ts
+++ b/src/server/chromium/crBrowser.ts
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-import { Browser, BrowserOptions } from '../../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
+import { Browser, BrowserOptions } from '../browser';
+import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { assert } from '../../utils/utils';
-import * as network from '../../network';
-import { Page, PageBinding, Worker } from '../../page';
-import { ConnectionTransport } from '../../transport';
-import * as types from '../../types';
+import * as network from '../network';
+import { Page, PageBinding, Worker } from '../page';
+import { ConnectionTransport } from '../transport';
+import * as types from '../types';
import { ConnectionEvents, CRConnection, CRSession } from './crConnection';
import { CRPage } from './crPage';
import { readProtocolStream } from './crProtocolHelper';
diff --git a/src/server/chromium/crConnection.ts b/src/server/chromium/crConnection.ts
index 32506a6142..31c7a5c3d2 100644
--- a/src/server/chromium/crConnection.ts
+++ b/src/server/chromium/crConnection.ts
@@ -16,7 +16,7 @@
*/
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
+import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../../utils/stackTrace';
diff --git a/src/server/chromium/crCoverage.ts b/src/server/chromium/crCoverage.ts
index 9a4d692d67..379621432a 100644
--- a/src/server/chromium/crCoverage.ts
+++ b/src/server/chromium/crCoverage.ts
@@ -16,9 +16,9 @@
*/
import { CRSession } from './crConnection';
-import { helper, RegisteredListener } from '../../helper';
+import { helper, RegisteredListener } from '../helper';
import { Protocol } from './protocol';
-import * as types from '../../types';
+import * as types from '../types';
import * as sourceMap from '../../utils/sourceMap';
import { assert } from '../../utils/utils';
diff --git a/src/server/chromium/crExecutionContext.ts b/src/server/chromium/crExecutionContext.ts
index 087c0a7cb6..6543d613ab 100644
--- a/src/server/chromium/crExecutionContext.ts
+++ b/src/server/chromium/crExecutionContext.ts
@@ -18,10 +18,10 @@
import { CRSession } from './crConnection';
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
import { Protocol } from './protocol';
-import * as js from '../../javascript';
+import * as js from '../javascript';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
+import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export class CRExecutionContext implements js.ExecutionContextDelegate {
_client: CRSession;
diff --git a/src/server/chromium/crInput.ts b/src/server/chromium/crInput.ts
index 224c4e393d..63faf1eb93 100644
--- a/src/server/chromium/crInput.ts
+++ b/src/server/chromium/crInput.ts
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import * as input from '../../input';
-import * as types from '../../types';
+import * as input from '../input';
+import * as types from '../types';
import { CRSession } from './crConnection';
-import { macEditingCommands } from '../../macEditingCommands';
+import { macEditingCommands } from '../macEditingCommands';
import { isString } from '../../utils/utils';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
diff --git a/src/server/chromium/crNetworkManager.ts b/src/server/chromium/crNetworkManager.ts
index 6e3c2f6002..7b4ddec722 100644
--- a/src/server/chromium/crNetworkManager.ts
+++ b/src/server/chromium/crNetworkManager.ts
@@ -16,12 +16,12 @@
*/
import { CRSession } from './crConnection';
-import { Page } from '../../page';
-import { helper, RegisteredListener } from '../../helper';
+import { Page } from '../page';
+import { helper, RegisteredListener } from '../helper';
import { Protocol } from './protocol';
-import * as network from '../../network';
-import * as frames from '../../frames';
-import * as types from '../../types';
+import * as network from '../network';
+import * as frames from '../frames';
+import * as types from '../types';
import { CRPage } from './crPage';
import { assert, headersObjectToArray } from '../../utils/utils';
diff --git a/src/server/chromium/crPage.ts b/src/server/chromium/crPage.ts
index 1203fd70da..a7f92f6cbd 100644
--- a/src/server/chromium/crPage.ts
+++ b/src/server/chromium/crPage.ts
@@ -15,25 +15,25 @@
* limitations under the License.
*/
-import * as dom from '../../dom';
-import * as frames from '../../frames';
-import { helper, RegisteredListener } from '../../helper';
-import * as network from '../../network';
+import * as dom from '../dom';
+import * as frames from '../frames';
+import { helper, RegisteredListener } from '../helper';
+import * as network from '../network';
import { CRSession, CRConnection, CRSessionEvents } from './crConnection';
import { CRExecutionContext } from './crExecutionContext';
import { CRNetworkManager } from './crNetworkManager';
-import { Page, Worker, PageBinding } from '../../page';
+import { Page, Worker, PageBinding } from '../page';
import { Protocol } from './protocol';
import { toConsoleMessageLocation, exceptionToError, releaseObject } from './crProtocolHelper';
-import * as dialog from '../../dialog';
-import { PageDelegate } from '../../page';
+import * as dialog from '../dialog';
+import { PageDelegate } from '../page';
import { RawMouseImpl, RawKeyboardImpl } from './crInput';
import { getAccessibilityTree } from './crAccessibility';
import { CRCoverage } from './crCoverage';
import { CRPDF } from './crPdf';
import { CRBrowserContext } from './crBrowser';
-import * as types from '../../types';
-import { ConsoleMessage } from '../../console';
+import * as types from '../types';
+import { ConsoleMessage } from '../console';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { assert, headersArrayToObject } from '../../utils/utils';
diff --git a/src/server/chromium/crPdf.ts b/src/server/chromium/crPdf.ts
index 676b57cc87..ec9186a404 100644
--- a/src/server/chromium/crPdf.ts
+++ b/src/server/chromium/crPdf.ts
@@ -16,7 +16,7 @@
*/
import { assert } from '../../utils/utils';
-import * as types from '../../types';
+import * as types from '../types';
import { CRSession } from './crConnection';
import { readProtocolStream } from './crProtocolHelper';
diff --git a/src/server/chromium/crProtocolHelper.ts b/src/server/chromium/crProtocolHelper.ts
index 5245d2f8be..66fed49638 100644
--- a/src/server/chromium/crProtocolHelper.ts
+++ b/src/server/chromium/crProtocolHelper.ts
@@ -19,7 +19,7 @@ import { CRSession } from './crConnection';
import { Protocol } from './protocol';
import * as fs from 'fs';
import * as util from 'util';
-import * as types from '../../types';
+import * as types from '../types';
import { mkdirIfNeeded } from '../../utils/utils';
export function getExceptionMessage(exceptionDetails: Protocol.Runtime.ExceptionDetails): string {
diff --git a/src/common/README.md b/src/server/common/README.md
similarity index 100%
rename from src/common/README.md
rename to src/server/common/README.md
diff --git a/src/common/domErrors.ts b/src/server/common/domErrors.ts
similarity index 100%
rename from src/common/domErrors.ts
rename to src/server/common/domErrors.ts
diff --git a/src/common/selectorParser.ts b/src/server/common/selectorParser.ts
similarity index 100%
rename from src/common/selectorParser.ts
rename to src/server/common/selectorParser.ts
diff --git a/src/common/utilityScriptSerializers.ts b/src/server/common/utilityScriptSerializers.ts
similarity index 100%
rename from src/common/utilityScriptSerializers.ts
rename to src/server/common/utilityScriptSerializers.ts
diff --git a/src/console.ts b/src/server/console.ts
similarity index 100%
rename from src/console.ts
rename to src/server/console.ts
diff --git a/src/server/debug/debugController.ts b/src/server/debug/debugController.ts
index eeb17e97b6..fee9786c64 100644
--- a/src/server/debug/debugController.ts
+++ b/src/server/debug/debugController.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { BrowserContext } from '../../browserContext';
-import * as frames from '../../frames';
-import * as js from '../../javascript';
-import { Page } from '../../page';
+import { BrowserContext } from '../browserContext';
+import * as frames from '../frames';
+import * as js from '../javascript';
+import { Page } from '../page';
import type DebugScript from './injected/debugScript';
export class DebugController {
diff --git a/src/server/debug/injected/consoleApi.ts b/src/server/debug/injected/consoleApi.ts
index d2f1682d27..6290eb0876 100644
--- a/src/server/debug/injected/consoleApi.ts
+++ b/src/server/debug/injected/consoleApi.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ParsedSelector, parseSelector } from '../../../common/selectorParser';
+import { ParsedSelector, parseSelector } from '../../common/selectorParser';
import type InjectedScript from '../../injected/injectedScript';
import { html } from './html';
diff --git a/src/deviceDescriptors.ts b/src/server/deviceDescriptors.ts
similarity index 100%
rename from src/deviceDescriptors.ts
rename to src/server/deviceDescriptors.ts
diff --git a/src/dialog.ts b/src/server/dialog.ts
similarity index 95%
rename from src/dialog.ts
rename to src/server/dialog.ts
index 1b38557eb2..77c7aa01e6 100644
--- a/src/dialog.ts
+++ b/src/server/dialog.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { assert } from './utils/utils';
-import { debugLogger } from './utils/debugLogger';
+import { assert } from '../utils/utils';
+import { debugLogger } from '../utils/debugLogger';
type OnHandle = (accept: boolean, promptText?: string) => Promise<void>;
diff --git a/src/dom.ts b/src/server/dom.ts
similarity index 99%
rename from src/dom.ts
rename to src/server/dom.ts
index 44c0b4fa6c..85f4e87453 100644
--- a/src/dom.ts
+++ b/src/server/dom.ts
@@ -15,16 +15,16 @@
*/
import * as frames from './frames';
-import { assert } from './utils/utils';
-import type InjectedScript from './server/injected/injectedScript';
-import * as injectedScriptSource from './generated/injectedScriptSource';
-import * as debugScriptSource from './generated/debugScriptSource';
+import { assert } from '../utils/utils';
+import type InjectedScript from './injected/injectedScript';
+import * as injectedScriptSource from '../generated/injectedScriptSource';
+import * as debugScriptSource from '../generated/debugScriptSource';
import * as js from './javascript';
import { Page } from './page';
import { selectors, SelectorInfo } from './selectors';
import * as types from './types';
import { Progress } from './progress';
-import type DebugScript from './server/debug/injected/debugScript';
+import type DebugScript from './debug/injected/debugScript';
import { FatalDOMError, RetargetableDOMError } from './common/domErrors';
export class FrameExecutionContext extends js.ExecutionContext {
diff --git a/src/download.ts b/src/server/download.ts
similarity index 98%
rename from src/download.ts
rename to src/server/download.ts
index 4cf3a1e699..f067146eeb 100644
--- a/src/download.ts
+++ b/src/server/download.ts
@@ -19,7 +19,7 @@ import * as fs from 'fs';
import * as util from 'util';
import { Page } from './page';
import { Readable } from 'stream';
-import { assert, mkdirIfNeeded } from './utils/utils';
+import { assert, mkdirIfNeeded } from '../utils/utils';
export class Download {
private _downloadsPath: string;
diff --git a/src/server/electron/electron.ts b/src/server/electron/electron.ts
index 96a99aa9f4..822df4d3db 100644
--- a/src/server/electron/electron.ts
+++ b/src/server/electron/electron.ts
@@ -18,18 +18,18 @@ import * as path from 'path';
import { CRBrowser, CRBrowserContext } from '../chromium/crBrowser';
import { CRConnection, CRSession } from '../chromium/crConnection';
import { CRExecutionContext } from '../chromium/crExecutionContext';
-import * as js from '../../javascript';
-import { Page } from '../../page';
+import * as js from '../javascript';
+import { Page } from '../page';
import { TimeoutSettings } from '../../utils/timeoutSettings';
-import { WebSocketTransport } from '../../transport';
-import * as types from '../../types';
+import { WebSocketTransport } from '../transport';
+import * as types from '../types';
import { launchProcess, waitForLine, envArrayToObject } from '../processLauncher';
-import { BrowserContext } from '../../browserContext';
+import { BrowserContext } from '../browserContext';
import type {BrowserWindow} from 'electron';
-import { runAbortableTask, ProgressController } from '../../progress';
+import { runAbortableTask, ProgressController } from '../progress';
import { EventEmitter } from 'events';
-import { helper } from '../../helper';
-import { BrowserProcess } from '../../browser';
+import { helper } from '../helper';
+import { BrowserProcess } from '../browser';
export type ElectronLaunchOptionsBase = {
args?: string[],
diff --git a/src/fileChooser.ts b/src/server/fileChooser.ts
similarity index 100%
rename from src/fileChooser.ts
rename to src/server/fileChooser.ts
diff --git a/src/server/firefox/ffAccessibility.ts b/src/server/firefox/ffAccessibility.ts
index 6b3b02e97d..ce057dba0f 100644
--- a/src/server/firefox/ffAccessibility.ts
+++ b/src/server/firefox/ffAccessibility.ts
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import * as accessibility from '../../accessibility';
+import * as accessibility from '../accessibility';
import { FFSession } from './ffConnection';
import { Protocol } from './protocol';
-import * as dom from '../../dom';
-import * as types from '../../types';
+import * as dom from '../dom';
+import * as types from '../types';
export async function getAccessibilityTree(session: FFSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const objectId = needle ? needle._objectId : undefined;
diff --git a/src/server/firefox/ffBrowser.ts b/src/server/firefox/ffBrowser.ts
index fefa81605f..c03a6dce08 100644
--- a/src/server/firefox/ffBrowser.ts
+++ b/src/server/firefox/ffBrowser.ts
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-import { Browser, BrowserOptions } from '../../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
-import { helper, RegisteredListener } from '../../helper';
+import { Browser, BrowserOptions } from '../browser';
+import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
+import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
-import * as network from '../../network';
-import { Page, PageBinding } from '../../page';
-import { ConnectionTransport } from '../../transport';
-import * as types from '../../types';
+import * as network from '../network';
+import { Page, PageBinding } from '../page';
+import { ConnectionTransport } from '../transport';
+import * as types from '../types';
import { ConnectionEvents, FFConnection } from './ffConnection';
import { FFPage } from './ffPage';
import { Protocol } from './protocol';
diff --git a/src/server/firefox/ffConnection.ts b/src/server/firefox/ffConnection.ts
index e3d355a1c8..5b14a94da1 100644
--- a/src/server/firefox/ffConnection.ts
+++ b/src/server/firefox/ffConnection.ts
@@ -17,7 +17,7 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
+import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';
diff --git a/src/server/firefox/ffExecutionContext.ts b/src/server/firefox/ffExecutionContext.ts
index 5194d3d5fe..cd3c89a406 100644
--- a/src/server/firefox/ffExecutionContext.ts
+++ b/src/server/firefox/ffExecutionContext.ts
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-import * as js from '../../javascript';
+import * as js from '../javascript';
import { FFSession } from './ffConnection';
import { Protocol } from './protocol';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
+import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export class FFExecutionContext implements js.ExecutionContextDelegate {
_session: FFSession;
diff --git a/src/server/firefox/ffInput.ts b/src/server/firefox/ffInput.ts
index 337b05dbec..968a44a4f9 100644
--- a/src/server/firefox/ffInput.ts
+++ b/src/server/firefox/ffInput.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import * as input from '../../input';
-import * as types from '../../types';
+import * as input from '../input';
+import * as types from '../types';
import { FFSession } from './ffConnection';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
diff --git a/src/server/firefox/ffNetworkManager.ts b/src/server/firefox/ffNetworkManager.ts
index 35d0a7bf52..0dd62d910b 100644
--- a/src/server/firefox/ffNetworkManager.ts
+++ b/src/server/firefox/ffNetworkManager.ts
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-import { helper, RegisteredListener } from '../../helper';
+import { helper, RegisteredListener } from '../helper';
import { FFSession } from './ffConnection';
-import { Page } from '../../page';
-import * as network from '../../network';
-import * as frames from '../../frames';
-import * as types from '../../types';
+import { Page } from '../page';
+import * as network from '../network';
+import * as frames from '../frames';
+import * as types from '../types';
import { Protocol } from './protocol';
export class FFNetworkManager {
diff --git a/src/server/firefox/ffPage.ts b/src/server/firefox/ffPage.ts
index 5eac61b04e..211652dc28 100644
--- a/src/server/firefox/ffPage.ts
+++ b/src/server/firefox/ffPage.ts
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-import * as dialog from '../../dialog';
-import * as dom from '../../dom';
-import * as frames from '../../frames';
-import { helper, RegisteredListener } from '../../helper';
+import * as dialog from '../dialog';
+import * as dom from '../dom';
+import * as frames from '../frames';
+import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
-import { Page, PageBinding, PageDelegate, Worker } from '../../page';
-import { kScreenshotDuringNavigationError } from '../../screenshotter';
-import * as types from '../../types';
+import { Page, PageBinding, PageDelegate, Worker } from '../page';
+import { kScreenshotDuringNavigationError } from '../screenshotter';
+import * as types from '../types';
import { getAccessibilityTree } from './ffAccessibility';
import { FFBrowserContext } from './ffBrowser';
import { FFSession, FFSessionEvents } from './ffConnection';
@@ -30,9 +30,9 @@ import { FFExecutionContext } from './ffExecutionContext';
import { RawKeyboardImpl, RawMouseImpl } from './ffInput';
import { FFNetworkManager } from './ffNetworkManager';
import { Protocol } from './protocol';
-import { selectors } from '../../selectors';
+import { selectors } from '../selectors';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { Screencast, BrowserContext } from '../../browserContext';
+import { Screencast, BrowserContext } from '../browserContext';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
diff --git a/src/server/firefox/firefox.ts b/src/server/firefox/firefox.ts
index 999b34b2bf..ded19f4c3d 100644
--- a/src/server/firefox/firefox.ts
+++ b/src/server/firefox/firefox.ts
@@ -22,10 +22,10 @@ import { FFBrowser } from './ffBrowser';
import { kBrowserCloseMessageId } from './ffConnection';
import { BrowserTypeBase } from '../browserType';
import { Env } from '../processLauncher';
-import { ConnectionTransport } from '../../transport';
-import { BrowserOptions } from '../../browser';
+import { ConnectionTransport } from '../transport';
+import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
-import * as types from '../../types';
+import * as types from '../types';
export class Firefox extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {
diff --git a/src/frames.ts b/src/server/frames.ts
similarity index 99%
rename from src/frames.ts
rename to src/server/frames.ts
index f4f94d8edd..ff19ce3c01 100644
--- a/src/frames.ts
+++ b/src/server/frames.ts
@@ -26,8 +26,8 @@ import * as types from './types';
import { BrowserContext } from './browserContext';
import { Progress, ProgressController } from './progress';
import { EventEmitter } from 'events';
-import { assert, makeWaitForNextTask } from './utils/utils';
-import { debugLogger } from './utils/debugLogger';
+import { assert, makeWaitForNextTask } from '../utils/utils';
+import { debugLogger } from '../utils/debugLogger';
type ContextData = {
contextPromise: Promise<dom.FrameExecutionContext>;
diff --git a/src/helper.ts b/src/server/helper.ts
similarity index 100%
rename from src/helper.ts
rename to src/server/helper.ts
diff --git a/src/server/injected/injectedScript.ts b/src/server/injected/injectedScript.ts
index 6e770a86d5..f930a975a2 100644
--- a/src/server/injected/injectedScript.ts
+++ b/src/server/injected/injectedScript.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type * as types from '../../types';
+import type * as types from '../types';
import { createAttributeEngine } from './attributeSelectorEngine';
import { createCSSEngine } from './cssSelectorEngine';
import { SelectorEngine, SelectorRoot } from './selectorEngine';
import { createTextSelector } from './textSelectorEngine';
import { XPathEngine } from './xpathSelectorEngine';
-import { ParsedSelector } from '../../common/selectorParser';
-import { FatalDOMError } from '../../common/domErrors';
+import { ParsedSelector } from '../common/selectorParser';
+import { FatalDOMError } from '../common/domErrors';
type Predicate<T> = (progress: types.InjectedScriptProgress, continuePolling: symbol) => T | symbol;
diff --git a/src/server/injected/utilityScript.ts b/src/server/injected/utilityScript.ts
index bf2e5b6430..d04951ea27 100644
--- a/src/server/injected/utilityScript.ts
+++ b/src/server/injected/utilityScript.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { serializeAsCallArgument, parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
+import { serializeAsCallArgument, parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export default class UtilityScript {
evaluate(returnByValue: boolean, expression: string) {
diff --git a/src/input.ts b/src/server/input.ts
similarity index 99%
rename from src/input.ts
rename to src/server/input.ts
index 39bf81e2a1..72ca27eb62 100644
--- a/src/input.ts
+++ b/src/server/input.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { assert } from './utils/utils';
+import { assert } from '../utils/utils';
import * as keyboardLayout from './usKeyboardLayout';
import * as types from './types';
import type { Page } from './page';
diff --git a/src/javascript.ts b/src/server/javascript.ts
similarity index 98%
rename from src/javascript.ts
rename to src/server/javascript.ts
index 85a94f7995..91032b9d83 100644
--- a/src/javascript.ts
+++ b/src/server/javascript.ts
@@ -15,10 +15,10 @@
*/
import * as dom from './dom';
-import * as utilityScriptSource from './generated/utilityScriptSource';
-import * as sourceMap from './utils/sourceMap';
+import * as utilityScriptSource from '../generated/utilityScriptSource';
+import * as sourceMap from '../utils/sourceMap';
import { serializeAsCallArgument } from './common/utilityScriptSerializers';
-import type UtilityScript from './server/injected/utilityScript';
+import type UtilityScript from './injected/utilityScript';
type ObjectId = string;
export type RemoteObject = {
diff --git a/src/macEditingCommands.ts b/src/server/macEditingCommands.ts
similarity index 100%
rename from src/macEditingCommands.ts
rename to src/server/macEditingCommands.ts
diff --git a/src/network.ts b/src/server/network.ts
similarity index 99%
rename from src/network.ts
rename to src/server/network.ts
index 974135a424..cac8663b22 100644
--- a/src/network.ts
+++ b/src/server/network.ts
@@ -16,7 +16,7 @@
import * as frames from './frames';
import * as types from './types';
-import { assert } from './utils/utils';
+import { assert } from '../utils/utils';
export function filterCookies(cookies: types.NetworkCookie[], urls: string[]): types.NetworkCookie[] {
const parsedURLs = urls.map(s => new URL(s));
diff --git a/src/page.ts b/src/server/page.ts
similarity index 99%
rename from src/page.ts
rename to src/server/page.ts
index 4085371ba7..813e7b8765 100644
--- a/src/page.ts
+++ b/src/server/page.ts
@@ -21,7 +21,7 @@ import * as input from './input';
import * as js from './javascript';
import * as network from './network';
import { Screenshotter } from './screenshotter';
-import { TimeoutSettings } from './utils/timeoutSettings';
+import { TimeoutSettings } from '../utils/timeoutSettings';
import * as types from './types';
import { BrowserContext } from './browserContext';
import { ConsoleMessage } from './console';
@@ -29,8 +29,8 @@ import * as accessibility from './accessibility';
import { EventEmitter } from 'events';
import { FileChooser } from './fileChooser';
import { Progress, runAbortableTask } from './progress';
-import { assert, isError } from './utils/utils';
-import { debugLogger } from './utils/debugLogger';
+import { assert, isError } from '../utils/utils';
+import { debugLogger } from '../utils/debugLogger';
export interface PageDelegate {
readonly rawMouse: input.RawMouse;
diff --git a/src/server/pipeTransport.ts b/src/server/pipeTransport.ts
index fd8d08fa80..309f3916b2 100644
--- a/src/server/pipeTransport.ts
+++ b/src/server/pipeTransport.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { helper, RegisteredListener } from '../helper';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import { helper, RegisteredListener } from './helper';
+import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
import { makeWaitForNextTask } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';
diff --git a/src/server/playwright.ts b/src/server/playwright.ts
index 86245327bc..295d9981c6 100644
--- a/src/server/playwright.ts
+++ b/src/server/playwright.ts
@@ -17,7 +17,7 @@
import { Chromium } from './chromium/chromium';
import { WebKit } from './webkit/webkit';
import { Firefox } from './firefox/firefox';
-import { selectors } from '../selectors';
+import { selectors } from './selectors';
import * as browserPaths from '../utils/browserPaths';
export class Playwright {
diff --git a/src/server/processLauncher.ts b/src/server/processLauncher.ts
index bfe6893723..6befa46e02 100644
--- a/src/server/processLauncher.ts
+++ b/src/server/processLauncher.ts
@@ -19,9 +19,9 @@ import * as childProcess from 'child_process';
import * as readline from 'readline';
import * as removeFolder from 'rimraf';
import * as stream from 'stream';
-import { helper } from '../helper';
-import { Progress } from '../progress';
-import * as types from '../types';
+import { helper } from './helper';
+import { Progress } from './progress';
+import * as types from './types';
import { isUnderTest } from '../utils/utils';
export type Env = {[key: string]: string | number | boolean | undefined};
diff --git a/src/progress.ts b/src/server/progress.ts
similarity index 95%
rename from src/progress.ts
rename to src/server/progress.ts
index ce05769724..1623ec0984 100644
--- a/src/progress.ts
+++ b/src/server/progress.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { TimeoutError } from './utils/errors';
-import { assert } from './utils/utils';
-import { rewriteErrorMessage } from './utils/stackTrace';
-import { debugLogger, LogName } from './utils/debugLogger';
+import { TimeoutError } from '../utils/errors';
+import { assert } from '../utils/utils';
+import { rewriteErrorMessage } from '../utils/stackTrace';
+import { debugLogger, LogName } from '../utils/debugLogger';
export interface Progress {
readonly aborted: Promise<void>;
diff --git a/src/screenshotter.ts b/src/server/screenshotter.ts
similarity index 99%
rename from src/screenshotter.ts
rename to src/server/screenshotter.ts
index 758883d1e4..04a549548c 100644
--- a/src/screenshotter.ts
+++ b/src/server/screenshotter.ts
@@ -19,9 +19,9 @@ import * as dom from './dom';
import { helper } from './helper';
import { Page } from './page';
import * as types from './types';
-import { rewriteErrorMessage } from './utils/stackTrace';
+import { rewriteErrorMessage } from '../utils/stackTrace';
import { Progress } from './progress';
-import { assert } from './utils/utils';
+import { assert } from '../utils/utils';
export class Screenshotter {
private _queue = new TaskQueue();
diff --git a/src/selectors.ts b/src/server/selectors.ts
similarity index 100%
rename from src/selectors.ts
rename to src/server/selectors.ts
diff --git a/src/transport.ts b/src/server/transport.ts
similarity index 98%
rename from src/transport.ts
rename to src/server/transport.ts
index 1be82072ef..691ae432ee 100644
--- a/src/transport.ts
+++ b/src/server/transport.ts
@@ -17,7 +17,7 @@
import * as WebSocket from 'ws';
import { Progress } from './progress';
-import { makeWaitForNextTask } from './utils/utils';
+import { makeWaitForNextTask } from '../utils/utils';
export type ProtocolRequest = {
id: number;
diff --git a/src/types.ts b/src/server/types.ts
similarity index 100%
rename from src/types.ts
rename to src/server/types.ts
diff --git a/src/usKeyboardLayout.ts b/src/server/usKeyboardLayout.ts
similarity index 100%
rename from src/usKeyboardLayout.ts
rename to src/server/usKeyboardLayout.ts
diff --git a/src/server/webkit/webkit.ts b/src/server/webkit/webkit.ts
index b45ce85ad9..50f3d520b0 100644
--- a/src/server/webkit/webkit.ts
+++ b/src/server/webkit/webkit.ts
@@ -20,10 +20,10 @@ import { Env } from '../processLauncher';
import * as path from 'path';
import { kBrowserCloseMessageId } from './wkConnection';
import { BrowserTypeBase } from '../browserType';
-import { ConnectionTransport } from '../../transport';
-import { BrowserOptions } from '../../browser';
+import { ConnectionTransport } from '../transport';
+import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
-import * as types from '../../types';
+import * as types from '../types';
export class WebKit extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {
diff --git a/src/server/webkit/wkAccessibility.ts b/src/server/webkit/wkAccessibility.ts
index e111815af9..320fb16832 100644
--- a/src/server/webkit/wkAccessibility.ts
+++ b/src/server/webkit/wkAccessibility.ts
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import * as accessibility from '../../accessibility';
+import * as accessibility from '../accessibility';
import { WKSession } from './wkConnection';
import { Protocol } from './protocol';
-import * as dom from '../../dom';
-import * as types from '../../types';
+import * as dom from '../dom';
+import * as types from '../types';
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
const objectId = needle ? needle._objectId : undefined;
diff --git a/src/server/webkit/wkBrowser.ts b/src/server/webkit/wkBrowser.ts
index 23ff967c26..365394e41f 100644
--- a/src/server/webkit/wkBrowser.ts
+++ b/src/server/webkit/wkBrowser.ts
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-import { Browser, BrowserOptions } from '../../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
-import { helper, RegisteredListener } from '../../helper';
+import { Browser, BrowserOptions } from '../browser';
+import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
+import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
-import * as network from '../../network';
-import { Page, PageBinding } from '../../page';
+import * as network from '../network';
+import { Page, PageBinding } from '../page';
import * as path from 'path';
-import { ConnectionTransport } from '../../transport';
-import * as types from '../../types';
+import { ConnectionTransport } from '../transport';
+import * as types from '../types';
import { Protocol } from './protocol';
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
import { WKPage } from './wkPage';
diff --git a/src/server/webkit/wkConnection.ts b/src/server/webkit/wkConnection.ts
index d193c6fe3a..2db1206d48 100644
--- a/src/server/webkit/wkConnection.ts
+++ b/src/server/webkit/wkConnection.ts
@@ -17,7 +17,7 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
+import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';
diff --git a/src/server/webkit/wkExecutionContext.ts b/src/server/webkit/wkExecutionContext.ts
index ce8e1e567a..0d636998d0 100644
--- a/src/server/webkit/wkExecutionContext.ts
+++ b/src/server/webkit/wkExecutionContext.ts
@@ -17,8 +17,8 @@
import { WKSession, isSwappedOutError } from './wkConnection';
import { Protocol } from './protocol';
-import * as js from '../../javascript';
-import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
+import * as js from '../javascript';
+import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import * as sourceMap from '../../utils/sourceMap';
export class WKExecutionContext implements js.ExecutionContextDelegate {
diff --git a/src/server/webkit/wkInput.ts b/src/server/webkit/wkInput.ts
index 82b30275ba..d7d40788f6 100644
--- a/src/server/webkit/wkInput.ts
+++ b/src/server/webkit/wkInput.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import * as input from '../../input';
-import * as types from '../../types';
-import { macEditingCommands } from '../../macEditingCommands';
+import * as input from '../input';
+import * as types from '../types';
+import { macEditingCommands } from '../macEditingCommands';
import { WKSession } from './wkConnection';
import { isString } from '../../utils/utils';
diff --git a/src/server/webkit/wkInterceptableRequest.ts b/src/server/webkit/wkInterceptableRequest.ts
index 2205a03918..b73abb885c 100644
--- a/src/server/webkit/wkInterceptableRequest.ts
+++ b/src/server/webkit/wkInterceptableRequest.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import * as frames from '../../frames';
-import * as network from '../../network';
-import * as types from '../../types';
+import * as frames from '../frames';
+import * as network from '../network';
+import * as types from '../types';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { assert, headersObjectToArray, headersArrayToObject } from '../../utils/utils';
diff --git a/src/server/webkit/wkPage.ts b/src/server/webkit/wkPage.ts
index 6cb922d1f2..9ef1900879 100644
--- a/src/server/webkit/wkPage.ts
+++ b/src/server/webkit/wkPage.ts
@@ -15,28 +15,28 @@
* limitations under the License.
*/
-import { Screencast, BrowserContext } from '../../browserContext';
-import * as frames from '../../frames';
-import { helper, RegisteredListener } from '../../helper';
-import * as dom from '../../dom';
-import * as network from '../../network';
+import { Screencast, BrowserContext } from '../browserContext';
+import * as frames from '../frames';
+import { helper, RegisteredListener } from '../helper';
+import * as dom from '../dom';
+import * as network from '../network';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { WKInterceptableRequest } from './wkInterceptableRequest';
import { WKWorkers } from './wkWorkers';
-import { Page, PageDelegate, PageBinding } from '../../page';
+import { Page, PageDelegate, PageBinding } from '../page';
import { Protocol } from './protocol';
-import * as dialog from '../../dialog';
+import * as dialog from '../dialog';
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
-import * as types from '../../types';
-import * as accessibility from '../../accessibility';
+import * as types from '../types';
+import * as accessibility from '../accessibility';
import { getAccessibilityTree } from './wkAccessibility';
import { WKProvisionalPage } from './wkProvisionalPage';
import { WKBrowserContext } from './wkBrowser';
-import { selectors } from '../../selectors';
+import { selectors } from '../selectors';
import * as jpeg from 'jpeg-js';
import * as png from 'pngjs';
-import { JSHandle } from '../../javascript';
+import { JSHandle } from '../javascript';
import { assert, debugAssert, headersArrayToObject } from '../../utils/utils';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
diff --git a/src/server/webkit/wkProvisionalPage.ts b/src/server/webkit/wkProvisionalPage.ts
index 62e13b04f7..e0747e9c27 100644
--- a/src/server/webkit/wkProvisionalPage.ts
+++ b/src/server/webkit/wkProvisionalPage.ts
@@ -16,7 +16,7 @@
import { WKSession } from './wkConnection';
import { WKPage } from './wkPage';
-import { RegisteredListener, helper } from '../../helper';
+import { RegisteredListener, helper } from '../helper';
import { Protocol } from './protocol';
import { assert } from '../../utils/utils';
diff --git a/src/server/webkit/wkWorkers.ts b/src/server/webkit/wkWorkers.ts
index eaee964b40..f1041abcee 100644
--- a/src/server/webkit/wkWorkers.ts
+++ b/src/server/webkit/wkWorkers.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import { helper, RegisteredListener } from '../../helper';
-import { Page, Worker } from '../../page';
+import { helper, RegisteredListener } from '../helper';
+import { Page, Worker } from '../page';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
-import * as types from '../../types';
+import * as types from '../types';
export class WKWorkers {
private _sessionListeners: RegisteredListener[] = [];
diff --git a/test/launcher.spec.ts b/test/launcher.spec.ts
index e35c4eda53..275959bd3a 100644
--- a/test/launcher.spec.ts
+++ b/test/launcher.spec.ts
@@ -25,7 +25,7 @@ it('should require top-level Errors', async({}) => {
});
it('should require top-level DeviceDescriptors', async({playwright}) => {
- const Devices = require(path.join(utils.projectRoot(), '/lib/deviceDescriptors.js')).DeviceDescriptors;
+ const Devices = require(path.join(utils.projectRoot(), '/lib/server/deviceDescriptors.js')).DeviceDescriptors;
expect(Devices['iPhone 6']).toBeTruthy();
expect(Devices['iPhone 6']).toEqual(playwright.devices['iPhone 6']);
});
diff --git a/utils/check_deps.js b/utils/check_deps.js
index 708f473ff3..abd943d8f2 100644
--- a/utils/check_deps.js
+++ b/utils/check_deps.js
@@ -57,9 +57,7 @@ async function checkDeps() {
if (fromDirectory === toDirectory)
return true;
- if (['src/', 'src/rpc/server/', 'src/rpc/'].includes(fromDirectory))
- return true; // Temporary.
- if (toDirectory === 'src/')
+ if (['src/rpc/server/', 'src/rpc/'].includes(fromDirectory))
return true; // Temporary.
while (!DEPS[from]) {
@@ -87,20 +85,28 @@ async function checkDeps() {
const DEPS = {};
// No deps for code shared between node and page.
-DEPS['src/common/'] = [];
+DEPS['src/server/common/'] = [];
DEPS['src/protocol/'] = ['src/utils/'];
DEPS['src/install/'] = ['src/utils/'];
+// Client depends on chromium protocol for types.
DEPS['src/client/'] = ['src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts'];
-DEPS['src/server/'] = ['src/utils/', 'src/common/', 'src/server/injected/'];
+DEPS['src/server/'] = [
+ 'src/utils/',
+ 'src/server/common/',
+ 'src/server/injected/',
+ 'src/generated/',
+ // TODO: remove the server->debug dependency.
+ 'src/server/debug/**',
+];
// Strict deps for injected code.
-// TODO: reverse the injected->types dependency.
-DEPS['src/server/injected/'] = ['src/common/', 'src/types.ts'];
+// TODO: remove the injected->types dependency.
+DEPS['src/server/injected/'] = ['src/server/common/', 'src/server/types.ts'];
-DEPS['src/server/debug/'] = [...DEPS['src/server/'], 'src/server/debug/**'];
+DEPS['src/server/debug/'] = [...DEPS['src/server/'], 'src/server/', 'src/server/debug/**'];
DEPS['src/server/chromium/'] = [...DEPS['src/server/'], 'src/server/'];
DEPS['src/server/electron/'] = [...DEPS['src/server/'], 'src/server/', 'src/server/chromium/'];