Skip to content

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

chore: organize imports in playwright-core (#34680)

Pavel Feldman4a7f6a6ef04c
diff --git a/eslint.config.mjs b/eslint.config.mjs
index a604e14f13..97b29eb05f 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -20,6 +20,7 @@ import notice from 'eslint-plugin-notice';
import path from 'path';
import { fileURLToPath } from 'url';
import stylistic from '@stylistic/eslint-plugin';
+import importRules from 'eslint-plugin-import';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -28,6 +29,7 @@ const plugins = {
'@stylistic': stylistic,
'@typescript-eslint': typescriptEslint,
notice,
+ import: importRules,
};
const ignores = [
@@ -57,7 +59,7 @@ const ignores = [
export const baseRules = {
'@typescript-eslint/no-unused-vars': [2, { args: 'none', caughtErrors: 'none' }],
- '@typescript-eslint/consistent-type-imports': [2, { disallowTypeAnnotations: false }],
+
/**
* Enforced rules
*/
@@ -184,6 +186,19 @@ const noRestrictedGlobalsRules = {
],
};
+const importOrderRules = {
+ 'import/order': [2, {
+ 'alphabetize': {
+ 'order': 'asc',
+ 'caseInsensitive': false
+ },
+ 'named': true,
+ 'groups': ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'type'],
+ 'newlines-between': 'always',
+ }],
+ 'import/consistent-type-specifier-style': [2, 'prefer-top-level']
+};
+
const languageOptions = {
parser: tsParser,
ecmaVersion: 9,
@@ -217,6 +232,11 @@ export default [{
'message': 'Please use gracefullyProcessExitDoNotHang function to exit the process.',
}],
}
+}, {
+ files: ['packages/playwright-core/**/*.ts'],
+ rules: {
+ ...importOrderRules
+ },
}, {
files: ['packages/playwright/**/*.ts'],
rules: {
diff --git a/package-lock.json b/package-lock.json
index be17fabc1b..6b59e3ab0b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -52,6 +52,7 @@
"electron": "^30.1.2",
"esbuild": "^0.18.11",
"eslint": "^9.19.0",
+ "eslint-plugin-import": "^2.31.0",
"eslint-plugin-notice": "^1.0.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
@@ -1817,6 +1818,13 @@
"win32"
]
},
+ "node_modules/@rtsao/scc": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
+ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@sindresorhus/is": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
@@ -2019,6 +2027,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/json5": {
+ "version": "0.0.29",
+ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/keyv": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",
@@ -2717,6 +2732,27 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/array.prototype.findlastindex": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz",
+ "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.2",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.0.0",
+ "es-shim-unscopables": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/array.prototype.flat": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz",
@@ -3536,6 +3572,19 @@
"wrappy": "1"
}
},
+ "node_modules/doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
@@ -3920,6 +3969,145 @@
}
}
},
+ "node_modules/eslint-import-resolver-node": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
+ "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^3.2.7",
+ "is-core-module": "^2.13.0",
+ "resolve": "^1.22.4"
+ }
+ },
+ "node_modules/eslint-import-resolver-node/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-import-resolver-node/node_modules/resolve": {
+ "version": "1.22.10",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
+ "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-core-module": "^2.16.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/eslint-module-utils": {
+ "version": "2.12.0",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz",
+ "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^3.2.7"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependenciesMeta": {
+ "eslint": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-module-utils/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-plugin-import": {
+ "version": "2.31.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz",
+ "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rtsao/scc": "^1.1.0",
+ "array-includes": "^3.1.8",
+ "array.prototype.findlastindex": "^1.2.5",
+ "array.prototype.flat": "^1.3.2",
+ "array.prototype.flatmap": "^1.3.2",
+ "debug": "^3.2.7",
+ "doctrine": "^2.1.0",
+ "eslint-import-resolver-node": "^0.3.9",
+ "eslint-module-utils": "^2.12.0",
+ "hasown": "^2.0.2",
+ "is-core-module": "^2.15.1",
+ "is-glob": "^4.0.3",
+ "minimatch": "^3.1.2",
+ "object.fromentries": "^2.0.8",
+ "object.groupby": "^1.0.3",
+ "object.values": "^1.2.0",
+ "semver": "^6.3.1",
+ "string.prototype.trimend": "^1.0.8",
+ "tsconfig-paths": "^3.15.0"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependencies": {
+ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9"
+ }
+ },
+ "node_modules/eslint-plugin-import/node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/eslint-plugin-import/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-plugin-import/node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/eslint-plugin-notice": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-notice/-/eslint-plugin-notice-1.0.0.tgz",
@@ -3991,18 +4179,6 @@
"concat-map": "0.0.1"
}
},
- "node_modules/eslint-plugin-react/node_modules/doctrine": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
- "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
- "dev": true,
- "dependencies": {
- "esutils": "^2.0.2"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/eslint-plugin-react/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -5105,12 +5281,16 @@
}
},
"node_modules/is-core-module": {
- "version": "2.13.1",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
- "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
+ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "hasown": "^2.0.0"
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -6104,6 +6284,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/object.groupby": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz",
+ "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/object.values": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz",
@@ -7287,6 +7482,16 @@
"node": ">=8"
}
},
+ "node_modules/strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -7424,6 +7629,32 @@
"typescript": ">=4.8.4"
}
},
+ "node_modules/tsconfig-paths": {
+ "version": "3.15.0",
+ "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
+ "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/json5": "^0.0.29",
+ "json5": "^1.0.2",
+ "minimist": "^1.2.6",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "node_modules/tsconfig-paths/node_modules/json5": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
+ "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "minimist": "^1.2.0"
+ },
+ "bin": {
+ "json5": "lib/cli.js"
+ }
+ },
"node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
diff --git a/package.json b/package.json
index 49483a5dbf..30578abf1b 100644
--- a/package.json
+++ b/package.json
@@ -91,6 +91,7 @@
"electron": "^30.1.2",
"esbuild": "^0.18.11",
"eslint": "^9.19.0",
+ "eslint-plugin-import": "^2.31.0",
"eslint-plugin-notice": "^1.0.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
diff --git a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
index 5c8434f907..5e94036ae3 100644
--- a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
+++ b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+/* eslint-disable import/order */
+
import colorsLibrary from 'colors/safe';
export const colors = colorsLibrary;
diff --git a/packages/playwright-core/src/androidServerImpl.ts b/packages/playwright-core/src/androidServerImpl.ts
index f0108e67c7..aee8bf7b31 100644
--- a/packages/playwright-core/src/androidServerImpl.ts
+++ b/packages/playwright-core/src/androidServerImpl.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { LaunchAndroidServerOptions } from './client/types';
+import { PlaywrightServer } from './remote/playwrightServer';
+import { createPlaywright } from './server/playwright';
+import { createGuid } from './utils';
import { ws } from './utilsBundle';
-import type { WebSocketEventEmitter } from './utilsBundle';
+
import type { BrowserServer } from './client/browserType';
-import { createGuid } from './utils';
-import { createPlaywright } from './server/playwright';
-import { PlaywrightServer } from './remote/playwrightServer';
+import type { LaunchAndroidServerOptions } from './client/types';
+import type { WebSocketEventEmitter } from './utilsBundle';
export class AndroidServerLauncherImpl {
async launchServer(options: LaunchAndroidServerOptions = {}): Promise<BrowserServer> {
diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts
index d59c95bfb1..f76f852bed 100644
--- a/packages/playwright-core/src/browserServerImpl.ts
+++ b/packages/playwright-core/src/browserServerImpl.ts
@@ -14,19 +14,20 @@
* limitations under the License.
*/
-import type { LaunchServerOptions, Logger } from './client/types';
-import { ws } from './utilsBundle';
-import type { WebSocketEventEmitter } from './utilsBundle';
-import type { BrowserServerLauncher, BrowserServer } from './client/browserType';
import { envObjectToArray } from './client/clientHelper';
-import { createGuid } from './utils';
-import type { ProtocolLogger } from './server/types';
-import { serverSideCallMetadata } from './server/instrumentation';
-import { createPlaywright } from './server/playwright';
+import { SocksProxy } from './common/socksProxy';
import { PlaywrightServer } from './remote/playwrightServer';
import { helper } from './server/helper';
+import { serverSideCallMetadata } from './server/instrumentation';
+import { createPlaywright } from './server/playwright';
+import { createGuid } from './utils';
import { rewriteErrorMessage } from './utils/stackTrace';
-import { SocksProxy } from './common/socksProxy';
+import { ws } from './utilsBundle';
+
+import type { BrowserServer, BrowserServerLauncher } from './client/browserType';
+import type { LaunchServerOptions, Logger } from './client/types';
+import type { ProtocolLogger } from './server/types';
+import type { WebSocketEventEmitter } from './utilsBundle';
export class BrowserServerLauncherImpl implements BrowserServerLauncher {
private _browserName: 'chromium' | 'firefox' | 'webkit' | 'bidiFirefox' | 'bidiChromium';
diff --git a/packages/playwright-core/src/cli/driver.ts b/packages/playwright-core/src/cli/driver.ts
index e48dc2a4d2..0e4cbb5816 100644
--- a/packages/playwright-core/src/cli/driver.ts
+++ b/packages/playwright-core/src/cli/driver.ts
@@ -16,15 +16,17 @@
/* eslint-disable no-console */
-import fs from 'fs';
+import * as fs from 'fs';
+
import * as playwright from '../..';
-import type { BrowserType } from '../client/browserType';
-import type { LaunchServerOptions } from '../client/types';
-import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server';
import { PipeTransport } from '../protocol/transport';
import { PlaywrightServer } from '../remote/playwrightServer';
+import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
import { gracefullyProcessExitDoNotHang } from '../utils/processLauncher';
+import type { BrowserType } from '../client/browserType';
+import type { LaunchServerOptions } from '../client/types';
+
export function printApiJson() {
// Note: this file is generated by build-playwright-driver.sh
console.log(JSON.stringify(require('../../api.json')));
diff --git a/packages/playwright-core/src/cli/program.ts b/packages/playwright-core/src/cli/program.ts
index ce568b8dd3..2c0a955207 100644
--- a/packages/playwright-core/src/cli/program.ts
+++ b/packages/playwright-core/src/cli/program.ts
@@ -16,25 +16,28 @@
/* eslint-disable no-console */
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import type { Command } from '../utilsBundle';
-import { program, dotenv } from '../utilsBundle';
-export { program } from '../utilsBundle';
-import { runDriver, runServer, printApiJson, launchBrowserServer } from './driver';
-import { runTraceInBrowser, runTraceViewerApp } from '../server/trace/viewer/traceViewer';
-import type { TraceViewerServerOptions } from '../server/trace/viewer/traceViewer';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
import * as playwright from '../..';
-import type { BrowserContext } from '../client/browserContext';
+import { registry, writeDockerVersion } from '../server';
+import { launchBrowserServer, printApiJson, runDriver, runServer } from './driver';
+import { isTargetClosedError } from '../client/errors';
+import { runTraceInBrowser, runTraceViewerApp } from '../server/trace/viewer/traceViewer';
+import { assert, getPackageManagerExecCommand, gracefullyProcessExitDoNotHang, isLikelyNpxGlobal, wrapInASCIIBox } from '../utils';
+import { dotenv, program } from '../utilsBundle';
+
import type { Browser } from '../client/browser';
-import type { Page } from '../client/page';
+import type { BrowserContext } from '../client/browserContext';
import type { BrowserType } from '../client/browserType';
+import type { Page } from '../client/page';
import type { BrowserContextOptions, LaunchOptions } from '../client/types';
-import { wrapInASCIIBox, isLikelyNpxGlobal, assert, gracefullyProcessExitDoNotHang, getPackageManagerExecCommand } from '../utils';
import type { Executable } from '../server';
-import { registry, writeDockerVersion } from '../server';
-import { isTargetClosedError } from '../client/errors';
+import type { TraceViewerServerOptions } from '../server/trace/viewer/traceViewer';
+import type { Command } from '../utilsBundle';
+
+export { program } from '../utilsBundle';
const packageJSON = require('../../package.json');
diff --git a/packages/playwright-core/src/client/accessibility.ts b/packages/playwright-core/src/client/accessibility.ts
index a3390d8c58..02db39e801 100644
--- a/packages/playwright-core/src/client/accessibility.ts
+++ b/packages/playwright-core/src/client/accessibility.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import type { ElementHandle } from './elementHandle';
import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
type SerializedAXNode = Omit<channels.AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & {
value?: string|number,
diff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.ts
index 07912bfbdd..1f4b89ed8a 100644
--- a/packages/playwright-core/src/client/android.ts
+++ b/packages/playwright-core/src/client/android.ts
@@ -14,22 +14,24 @@
* limitations under the License.
*/
-import fs from 'fs';
-import { isString, isRegExp, monotonicTime } from '../utils';
-import type * as channels from '@protocol/channels';
-import { Events } from './events';
+import { EventEmitter } from 'events';
+import * as fs from 'fs';
+
+import { isRegExp, isString, monotonicTime } from '../utils';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
-import type * as api from '../../types/types';
-import type * as types from './types';
-import type { Page } from './page';
-import { TimeoutSettings } from '../common/timeoutSettings';
-import { Waiter } from './waiter';
-import { EventEmitter } from 'events';
import { Connection } from './connection';
-import { isTargetClosedError, TargetClosedError } from './errors';
+import { TargetClosedError, isTargetClosedError } from './errors';
+import { Events } from './events';
+import { Waiter } from './waiter';
+import { TimeoutSettings } from '../common/timeoutSettings';
import { raceAgainstDeadline } from '../utils/timeoutRunner';
+
+import type { Page } from './page';
+import type * as types from './types';
+import type * as api from '../../types/types';
import type { AndroidServerLauncherImpl } from '../androidServerImpl';
+import type * as channels from '@protocol/channels';
type Direction = 'down' | 'up' | 'left' | 'right';
type SpeedOptions = { speed?: number };
diff --git a/packages/playwright-core/src/client/api.ts b/packages/playwright-core/src/client/api.ts
index 0d3d2448fe..7273ea244a 100644
--- a/packages/playwright-core/src/client/api.ts
+++ b/packages/playwright-core/src/client/api.ts
@@ -15,7 +15,7 @@
*/
export { Accessibility } from './accessibility';
-export { Android, AndroidDevice, AndroidWebView, AndroidInput, AndroidSocket } from './android';
+export { Android, AndroidDevice, AndroidInput, AndroidSocket, AndroidWebView } from './android';
export { Browser } from './browser';
export { BrowserContext } from './browserContext';
export type { BrowserServer } from './browserType';
@@ -26,7 +26,7 @@ export { Coverage } from './coverage';
export { Dialog } from './dialog';
export { Download } from './download';
export { Electron, ElectronApplication } from './electron';
-export { Locator, FrameLocator } from './locator';
+export { FrameLocator, Locator } from './locator';
export { ElementHandle } from './elementHandle';
export { FileChooser } from './fileChooser';
export type { Logger } from './types';
diff --git a/packages/playwright-core/src/client/artifact.ts b/packages/playwright-core/src/client/artifact.ts
index c3a53c0294..1874ba0c1d 100644
--- a/packages/playwright-core/src/client/artifact.ts
+++ b/packages/playwright-core/src/client/artifact.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import * as fs from 'fs';
+
+import { ChannelOwner } from './channelOwner';
import { Stream } from './stream';
import { mkdirIfNeeded } from '../utils/fileUtils';
-import { ChannelOwner } from './channelOwner';
+
+import type * as channels from '@protocol/channels';
import type { Readable } from 'stream';
export class Artifact extends ChannelOwner<channels.ArtifactChannel> {
diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.ts
index 10cac4d0f9..444074ba54 100644
--- a/packages/playwright-core/src/client/browser.ts
+++ b/packages/playwright-core/src/client/browser.ts
@@ -14,20 +14,22 @@
* limitations under the License.
*/
-import fs from 'fs';
-import type * as channels from '@protocol/channels';
+import * as fs from 'fs';
+
+import { Artifact } from './artifact';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
-import type { Page } from './page';
+import { CDPSession } from './cdpSession';
import { ChannelOwner } from './channelOwner';
-import { Events } from './events';
-import type { LaunchOptions, BrowserContextOptions, HeadersArray } from './types';
import { isTargetClosedError } from './errors';
-import type * as api from '../../types/types';
-import { CDPSession } from './cdpSession';
-import type { BrowserType } from './browserType';
-import { Artifact } from './artifact';
+import { Events } from './events';
import { mkdirIfNeeded } from '../utils';
+import type { BrowserType } from './browserType';
+import type { Page } from './page';
+import type { BrowserContextOptions, HeadersArray, LaunchOptions } from './types';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
export class Browser extends ChannelOwner<channels.BrowserChannel> implements api.Browser {
readonly _contexts = new Set<BrowserContext>();
private _isConnected = true;
diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts
index 83655887e6..a8417d896b 100644
--- a/packages/playwright-core/src/client/browserContext.ts
+++ b/packages/playwright-core/src/client/browserContext.ts
@@ -15,35 +15,38 @@
* limitations under the License.
*/
-import { Page, BindingCall } from './page';
-import { Frame } from './frame';
-import * as network from './network';
-import type * as channels from '@protocol/channels';
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
+
+import { Artifact } from './artifact';
+import { Browser } from './browser';
+import { CDPSession } from './cdpSession';
import { ChannelOwner } from './channelOwner';
import { evaluationScript } from './clientHelper';
-import { Browser } from './browser';
-import { Worker } from './worker';
+import { Clock } from './clock';
+import { ConsoleMessage } from './consoleMessage';
+import { Dialog } from './dialog';
+import { TargetClosedError, parseError } from './errors';
import { Events } from './events';
-import { TimeoutSettings } from '../common/timeoutSettings';
-import { Waiter } from './waiter';
-import type { Headers, WaitForEventOptions, BrowserContextOptions, LaunchOptions, StorageState } from './types';
-import { type URLMatch, headersObjectToArray, isRegExp, isString, urlMatchesEqual, mkdirIfNeeded } from '../utils';
-import type * as api from '../../types/types';
-import type * as structs from '../../types/structs';
-import { CDPSession } from './cdpSession';
-import { Tracing } from './tracing';
-import type { BrowserType } from './browserType';
-import { Artifact } from './artifact';
import { APIRequestContext } from './fetch';
-import { rewriteErrorMessage } from '../utils/stackTrace';
+import { Frame } from './frame';
import { HarRouter } from './harRouter';
-import { ConsoleMessage } from './consoleMessage';
-import { Dialog } from './dialog';
+import * as network from './network';
+import { BindingCall, Page } from './page';
+import { Tracing } from './tracing';
+import { Waiter } from './waiter';
import { WebError } from './webError';
-import { TargetClosedError, parseError } from './errors';
-import { Clock } from './clock';
+import { Worker } from './worker';
+import { TimeoutSettings } from '../common/timeoutSettings';
+import { headersObjectToArray, isRegExp, isString, mkdirIfNeeded, urlMatchesEqual } from '../utils';
+import { rewriteErrorMessage } from '../utils/stackTrace';
+
+import type { BrowserType } from './browserType';
+import type { BrowserContextOptions, Headers, LaunchOptions, StorageState, WaitForEventOptions } from './types';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type { URLMatch } from '../utils';
+import type * as channels from '@protocol/channels';
export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel> implements api.BrowserContext {
_pages = new Set<Page>();
diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts
index 1932d6e2d8..36b9fe4d7e 100644
--- a/packages/playwright-core/src/client/browserType.ts
+++ b/packages/playwright-core/src/client/browserType.ts
@@ -14,19 +14,20 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { Browser } from './browser';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
-import type { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, Logger } from './types';
+import { envObjectToArray } from './clientHelper';
import { Connection } from './connection';
import { Events } from './events';
-import type { ChildProcess } from 'child_process';
-import { envObjectToArray } from './clientHelper';
import { assert, headersObjectToArray, monotonicTime } from '../utils';
-import type * as api from '../../types/types';
import { raceAgainstDeadline } from '../utils/timeoutRunner';
+
import type { Playwright } from './playwright';
+import type { ConnectOptions, LaunchOptions, LaunchPersistentContextOptions, LaunchServerOptions, Logger } from './types';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+import type { ChildProcess } from 'child_process';
export interface BrowserServerLauncher {
launchServer(options?: LaunchServerOptions): Promise<api.BrowserServer>;
diff --git a/packages/playwright-core/src/client/cdpSession.ts b/packages/playwright-core/src/client/cdpSession.ts
index 68d1cb57f8..0a58f79d27 100644
--- a/packages/playwright-core/src/client/cdpSession.ts
+++ b/packages/playwright-core/src/client/cdpSession.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
-import type { Protocol } from '../server/chromium/protocol';
+
import type * as api from '../../types/types';
+import type { Protocol } from '../server/chromium/protocol';
+import type * as channels from '@protocol/channels';
export class CDPSession extends ChannelOwner<channels.CDPSessionChannel> implements api.CDPSession {
static from(cdpSession: channels.CDPSessionChannel): CDPSession {
diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.ts
index d48ba439f0..2624be7282 100644
--- a/packages/playwright-core/src/client/channelOwner.ts
+++ b/packages/playwright-core/src/client/channelOwner.ts
@@ -15,15 +15,17 @@
*/
import { EventEmitter } from './eventEmitter';
-import type * as channels from '@protocol/channels';
-import { maybeFindValidator, ValidationError, type ValidatorContext } from '../protocol/validator';
+import { ValidationError, maybeFindValidator } from '../protocol/validator';
+import { isUnderTest } from '../utils';
import { debugLogger } from '../utils/debugLogger';
import { captureLibraryStackTrace, stringifyStackFrames } from '../utils/stackTrace';
-import { isUnderTest } from '../utils';
import { zones } from '../utils/zones';
+
import type { ClientInstrumentation } from './clientInstrumentation';
import type { Connection } from './connection';
import type { Logger } from './types';
+import type { ValidatorContext } from '../protocol/validator';
+import type * as channels from '@protocol/channels';
type Listener = (...args: any[]) => void;
diff --git a/packages/playwright-core/src/client/clientHelper.ts b/packages/playwright-core/src/client/clientHelper.ts
index 540230a4fc..88e5babddd 100644
--- a/packages/playwright-core/src/client/clientHelper.ts
+++ b/packages/playwright-core/src/client/clientHelper.ts
@@ -15,10 +15,12 @@
* limitations under the License.
*/
-import type * as types from './types';
-import fs from 'fs';
+import * as fs from 'fs';
+
import { isString } from '../utils';
+import type * as types from './types';
+
export function envObjectToArray(env: types.Env): { name: string, value: string }[] {
const result: { name: string, value: string }[] = [];
for (const name in env) {
diff --git a/packages/playwright-core/src/client/clientInstrumentation.ts b/packages/playwright-core/src/client/clientInstrumentation.ts
index e2e8c6678e..479a88003d 100644
--- a/packages/playwright-core/src/client/clientInstrumentation.ts
+++ b/packages/playwright-core/src/client/clientInstrumentation.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { StackFrame } from '@protocol/channels';
import type { BrowserContext } from './browserContext';
import type { APIRequestContext } from './fetch';
+import type { StackFrame } from '@protocol/channels';
// Instrumentation can mutate the data, for example change apiName or stepId.
export interface ApiCallData {
diff --git a/packages/playwright-core/src/client/clock.ts b/packages/playwright-core/src/client/clock.ts
index 73eb538c26..fdc7789b59 100644
--- a/packages/playwright-core/src/client/clock.ts
+++ b/packages/playwright-core/src/client/clock.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type * as api from '../../types/types';
import type { BrowserContext } from './browserContext';
+import type * as api from '../../types/types';
export class Clock implements api.Clock {
private _browserContext: BrowserContext;
diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.ts
index 375a84265f..30eba37cf0 100644
--- a/packages/playwright-core/src/client/connection.ts
+++ b/packages/playwright-core/src/client/connection.ts
@@ -14,37 +14,40 @@
* limitations under the License.
*/
+import { EventEmitter } from 'events';
+
+import { Android, AndroidDevice, AndroidSocket } from './android';
+import { Artifact } from './artifact';
import { Browser } from './browser';
import { BrowserContext } from './browserContext';
import { BrowserType } from './browserType';
+import { CDPSession } from './cdpSession';
import { ChannelOwner } from './channelOwner';
+import { createInstrumentation } from './clientInstrumentation';
+import { Dialog } from './dialog';
+import { Electron, ElectronApplication } from './electron';
import { ElementHandle } from './elementHandle';
+import { TargetClosedError, parseError } from './errors';
+import { APIRequestContext } from './fetch';
import { Frame } from './frame';
import { JSHandle } from './jsHandle';
+import { JsonPipe } from './jsonPipe';
+import { LocalUtils } from './localUtils';
import { Request, Response, Route, WebSocket, WebSocketRoute } from './network';
-import { Page, BindingCall } from './page';
-import { Worker } from './worker';
-import { Dialog } from './dialog';
-import { parseError, TargetClosedError } from './errors';
-import { CDPSession } from './cdpSession';
+import { BindingCall, Page } from './page';
import { Playwright } from './playwright';
-import { Electron, ElectronApplication } from './electron';
-import type * as channels from '@protocol/channels';
+import { SelectorsOwner } from './selectors';
import { Stream } from './stream';
+import { Tracing } from './tracing';
+import { Worker } from './worker';
import { WritableStream } from './writableStream';
+import { ValidationError, findValidator } from '../protocol/validator';
+import { formatCallLog, rewriteErrorMessage, zones } from '../utils';
import { debugLogger } from '../utils/debugLogger';
-import { SelectorsOwner } from './selectors';
-import { Android, AndroidSocket, AndroidDevice } from './android';
-import { Artifact } from './artifact';
-import { EventEmitter } from 'events';
-import { JsonPipe } from './jsonPipe';
-import { APIRequestContext } from './fetch';
-import { LocalUtils } from './localUtils';
-import { Tracing } from './tracing';
-import { findValidator, ValidationError, type ValidatorContext } from '../protocol/validator';
-import { createInstrumentation } from './clientInstrumentation';
+
import type { ClientInstrumentation } from './clientInstrumentation';
-import { formatCallLog, rewriteErrorMessage, zones } from '../utils';
+import type { ValidatorContext } from '../protocol/validator';
+import type * as channels from '@protocol/channels';
class Root extends ChannelOwner<channels.RootChannel> {
constructor(connection: Connection) {
diff --git a/packages/playwright-core/src/client/consoleMessage.ts b/packages/playwright-core/src/client/consoleMessage.ts
index fcdc3fd149..db2ed1a246 100644
--- a/packages/playwright-core/src/client/consoleMessage.ts
+++ b/packages/playwright-core/src/client/consoleMessage.ts
@@ -15,11 +15,13 @@
*/
import * as util from 'util';
+
import { JSHandle } from './jsHandle';
-import type * as channels from '@protocol/channels';
-import type * as api from '../../types/types';
import { Page } from './page';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
type ConsoleMessageLocation = channels.BrowserContextConsoleEvent['location'];
export class ConsoleMessage implements api.ConsoleMessage {
diff --git a/packages/playwright-core/src/client/coverage.ts b/packages/playwright-core/src/client/coverage.ts
index c736d1fad0..7e1cb7ef2b 100644
--- a/packages/playwright-core/src/client/coverage.ts
+++ b/packages/playwright-core/src/client/coverage.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
export class Coverage implements api.Coverage {
private _channel: channels.PageChannel;
diff --git a/packages/playwright-core/src/client/dialog.ts b/packages/playwright-core/src/client/dialog.ts
index c012838b7c..52722cecfd 100644
--- a/packages/playwright-core/src/client/dialog.ts
+++ b/packages/playwright-core/src/client/dialog.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
-import type * as api from '../../types/types';
import { Page } from './page';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
+
export class Dialog extends ChannelOwner<channels.DialogChannel> implements api.Dialog {
static from(dialog: channels.DialogChannel): Dialog {
return (dialog as any)._object;
diff --git a/packages/playwright-core/src/client/download.ts b/packages/playwright-core/src/client/download.ts
index e5cdd01aa6..550f485aa0 100644
--- a/packages/playwright-core/src/client/download.ts
+++ b/packages/playwright-core/src/client/download.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { Readable } from 'stream';
-import type * as api from '../../types/types';
import type { Artifact } from './artifact';
import type { Page } from './page';
+import type * as api from '../../types/types';
+import type { Readable } from 'stream';
export class Download implements api.Download {
private _page: Page;
diff --git a/packages/playwright-core/src/client/electron.ts b/packages/playwright-core/src/client/electron.ts
index fe5b6e189e..15551ebce9 100644
--- a/packages/playwright-core/src/client/electron.ts
+++ b/packages/playwright-core/src/client/electron.ts
@@ -14,22 +14,23 @@
* limitations under the License.
*/
-import type { BrowserWindow } from 'electron';
-import type * as childProcess from 'child_process';
-import type * as structs from '../../types/structs';
-import type * as api from '../../types/types';
-import type * as channels from '@protocol/channels';
-import { TimeoutSettings } from '../common/timeoutSettings';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
import { envObjectToArray } from './clientHelper';
+import { ConsoleMessage } from './consoleMessage';
+import { TargetClosedError, isTargetClosedError } from './errors';
import { Events } from './events';
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
-import type { Page } from './page';
-import { ConsoleMessage } from './consoleMessage';
-import type { Env, WaitForEventOptions, Headers, BrowserContextOptions } from './types';
import { Waiter } from './waiter';
-import { TargetClosedError, isTargetClosedError } from './errors';
+import { TimeoutSettings } from '../common/timeoutSettings';
+
+import type { Page } from './page';
+import type { BrowserContextOptions, Env, Headers, WaitForEventOptions } from './types';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+import type * as childProcess from 'child_process';
+import type { BrowserWindow } from 'electron';
type ElectronOptions = Omit<channels.ElectronLaunchOptions, 'env'|'extraHTTPHeaders'|'recordHar'|'colorScheme'|'acceptDownloads'> & {
env?: Env,
diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts
index c6249e8078..2883a69dfc 100644
--- a/packages/playwright-core/src/client/elementHandle.ts
+++ b/packages/playwright-core/src/client/elementHandle.ts
@@ -14,23 +14,25 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
+import * as fs from 'fs';
+import * as path from 'path';
+import { pipeline } from 'stream';
+import { promisify } from 'util';
+
import { Frame } from './frame';
-import type { Locator } from './locator';
-import { JSHandle, serializeArgument, parseResult } from './jsHandle';
-import type { ChannelOwner } from './channelOwner';
-import type { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types';
-import fs from 'fs';
-import { mime } from '../utilsBundle';
-import path from 'path';
+import { JSHandle, parseResult, serializeArgument } from './jsHandle';
import { assert, isString } from '../utils';
import { fileUploadSizeLimit, mkdirIfNeeded } from '../utils/fileUtils';
-import type * as api from '../../types/types';
-import type * as structs from '../../types/structs';
-import type { BrowserContext } from './browserContext';
+import { mime } from '../utilsBundle';
import { WritableStream } from './writableStream';
-import { pipeline } from 'stream';
-import { promisify } from 'util';
+
+import type { BrowserContext } from './browserContext';
+import type { ChannelOwner } from './channelOwner';
+import type { Locator } from './locator';
+import type { FilePayload, Rect, SelectOption, SelectOptionOptions } from './types';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
const pipelineAsync = promisify(pipeline);
diff --git a/packages/playwright-core/src/client/errors.ts b/packages/playwright-core/src/client/errors.ts
index 51555202e5..4757a6d0f7 100644
--- a/packages/playwright-core/src/client/errors.ts
+++ b/packages/playwright-core/src/client/errors.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { SerializedError } from '@protocol/channels';
-import { isError } from '../utils';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
+import { isError } from '../utils';
+
+import type { SerializedError } from '@protocol/channels';
export class TimeoutError extends Error {
constructor(message: string) {
diff --git a/packages/playwright-core/src/client/eventEmitter.ts b/packages/playwright-core/src/client/eventEmitter.ts
index 89d723eb8d..b295f87eba 100644
--- a/packages/playwright-core/src/client/eventEmitter.ts
+++ b/packages/playwright-core/src/client/eventEmitter.ts
@@ -22,12 +22,15 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+import { EventEmitter as OriginalEventEmitter } from 'events';
+
+import { isUnderTest } from '../utils';
+
+import type { EventEmitter as EventEmitterType } from 'events';
+
type EventType = string | symbol;
type Listener = (...args: any[]) => any;
type EventMap = Record<EventType, Listener | Listener[]>;
-import { EventEmitter as OriginalEventEmitter } from 'events';
-import type { EventEmitter as EventEmitterType } from 'events';
-import { isUnderTest } from '../utils';
export class EventEmitter implements EventEmitterType {
diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts
index a424004474..fea6c1a17e 100644
--- a/packages/playwright-core/src/client/fetch.ts
+++ b/packages/playwright-core/src/client/fetch.ts
@@ -14,22 +14,24 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
import * as util from 'util';
-import type { Serializable } from '../../types/structs';
-import type * as api from '../../types/types';
-import type { HeadersArray, NameValue } from '../common/types';
-import type * as channels from '@protocol/channels';
+
import { assert, headersObjectToArray, isString } from '../utils';
-import { mkdirIfNeeded } from '../utils/fileUtils';
+import { toClientCertificatesProtocol } from './browserContext';
import { ChannelOwner } from './channelOwner';
+import { TargetClosedError, isTargetClosedError } from './errors';
import { RawHeaders } from './network';
-import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState } from './types';
-import type { Playwright } from './playwright';
import { Tracing } from './tracing';
-import { TargetClosedError, isTargetClosedError } from './errors';
-import { toClientCertificatesProtocol } from './browserContext';
+import { mkdirIfNeeded } from '../utils/fileUtils';
+
+import type { Playwright } from './playwright';
+import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState } from './types';
+import type { Serializable } from '../../types/structs';
+import type * as api from '../../types/types';
+import type { HeadersArray, NameValue } from '../common/types';
+import type * as channels from '@protocol/channels';
export type FetchOptions = {
params?: { [key: string]: string | number | boolean; } | URLSearchParams | string,
diff --git a/packages/playwright-core/src/client/fileChooser.ts b/packages/playwright-core/src/client/fileChooser.ts
index 5e7b1113ff..ee669ee519 100644
--- a/packages/playwright-core/src/client/fileChooser.ts
+++ b/packages/playwright-core/src/client/fileChooser.ts
@@ -17,8 +17,8 @@
import type { ElementHandle } from './elementHandle';
import type { Page } from './page';
import type { FilePayload } from './types';
-import type * as channels from '@protocol/channels';
import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
export class FileChooser implements api.FileChooser {
private _page: Page;
diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.ts
index c337077630..a3b99cfb20 100644
--- a/packages/playwright-core/src/client/frame.ts
+++ b/packages/playwright-core/src/client/frame.ts
@@ -15,27 +15,30 @@
* limitations under the License.
*/
-import { assert } from '../utils';
-import type * as channels from '@protocol/channels';
+import { EventEmitter } from 'events';
+import * as fs from 'fs';
+
import { ChannelOwner } from './channelOwner';
import { FrameLocator, Locator, testIdAttributeName } from './locator';
-import type { LocatorOptions } from './locator';
-import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
-import type { ByRoleOptions } from '../utils/isomorphic/locatorUtils';
-import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';
-import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle';
-import fs from 'fs';
-import * as network from './network';
-import type { Page } from './page';
-import { EventEmitter } from 'events';
-import { Waiter } from './waiter';
+import { assert } from '../utils';
+import { urlMatches } from '../utils';
+import { addSourceUrlToScript } from './clientHelper';
+import { ElementHandle, convertInputFiles, convertSelectOptionValues } from './elementHandle';
import { Events } from './events';
-import type { LifecycleEvent, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions, StrictOptions } from './types';
+import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
+import * as network from './network';
import { kLifecycleEvents } from './types';
-import { type URLMatch, urlMatches } from '../utils';
-import type * as api from '../../types/types';
+import { Waiter } from './waiter';
+import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
+
+import type { LocatorOptions } from './locator';
+import type { Page } from './page';
+import type { FilePayload, LifecycleEvent, SelectOption, SelectOptionOptions, StrictOptions, WaitForFunctionOptions } from './types';
import type * as structs from '../../types/structs';
-import { addSourceUrlToScript } from './clientHelper';
+import type * as api from '../../types/types';
+import type { URLMatch } from '../utils';
+import type { ByRoleOptions } from '../utils/isomorphic/locatorUtils';
+import type * as channels from '@protocol/channels';
export type WaitForNavigationOptions = {
timeout?: number,
diff --git a/packages/playwright-core/src/client/harRouter.ts b/packages/playwright-core/src/client/harRouter.ts
index 5e617d7ce9..3fb2ce0e7b 100644
--- a/packages/playwright-core/src/client/harRouter.ts
+++ b/packages/playwright-core/src/client/harRouter.ts
@@ -15,6 +15,7 @@
*/
import { debugLogger } from '../utils/debugLogger';
+
import type { BrowserContext } from './browserContext';
import type { LocalUtils } from './localUtils';
import type { Route } from './network';
diff --git a/packages/playwright-core/src/client/input.ts b/packages/playwright-core/src/client/input.ts
index e06b0e3e4a..3d40deccdf 100644
--- a/packages/playwright-core/src/client/input.ts
+++ b/packages/playwright-core/src/client/input.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type * as api from '../../types/types';
import type { Page } from './page';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
export class Keyboard implements api.Keyboard {
private _page: Page;
diff --git a/packages/playwright-core/src/client/jsHandle.ts b/packages/playwright-core/src/client/jsHandle.ts
index 8577400f3d..62a54950d5 100644
--- a/packages/playwright-core/src/client/jsHandle.ts
+++ b/packages/playwright-core/src/client/jsHandle.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
+import { isTargetClosedError } from './errors';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
-import type * as api from '../../types/types';
+
import type * as structs from '../../types/structs';
-import { isTargetClosedError } from './errors';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
export class JSHandle<T = any> extends ChannelOwner<channels.JSHandleChannel> implements api.JSHandle {
private _preview: string;
diff --git a/packages/playwright-core/src/client/jsonPipe.ts b/packages/playwright-core/src/client/jsonPipe.ts
index 0c6b53502f..9e6635638e 100644
--- a/packages/playwright-core/src/client/jsonPipe.ts
+++ b/packages/playwright-core/src/client/jsonPipe.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
+import type * as channels from '@protocol/channels';
+
export class JsonPipe extends ChannelOwner<channels.JsonPipeChannel> {
static from(jsonPipe: channels.JsonPipeChannel): JsonPipe {
return (jsonPipe as any)._object;
diff --git a/packages/playwright-core/src/client/localUtils.ts b/packages/playwright-core/src/client/localUtils.ts
index 530547b227..eb8990abe9 100644
--- a/packages/playwright-core/src/client/localUtils.ts
+++ b/packages/playwright-core/src/client/localUtils.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
+
import type { Size } from './types';
+import type * as channels from '@protocol/channels';
type DeviceDescriptor = {
userAgent: string,
diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.ts
index 7784e1d685..af84294d2e 100644
--- a/packages/playwright-core/src/client/locator.ts
+++ b/packages/playwright-core/src/client/locator.ts
@@ -14,18 +14,21 @@
* limitations under the License.
*/
-import type * as structs from '../../types/structs';
-import type * as api from '../../types/types';
-import type * as channels from '@protocol/channels';
import * as util from 'util';
+
import { asLocator, isString, monotonicTime } from '../utils';
import { ElementHandle } from './elementHandle';
-import type { Frame } from './frame';
-import type { FilePayload, FrameExpectParams, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
import { parseResult, serializeArgument } from './jsHandle';
+import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
import { escapeForTextSelector } from '../utils/isomorphic/stringUtils';
+
+import type { Frame } from './frame';
+import type { FilePayload, FrameExpectParams, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
import type { ByRoleOptions } from '../utils/isomorphic/locatorUtils';
-import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
+import type * as channels from '@protocol/channels';
+
export type LocatorOptions = {
hasText?: string | RegExp;
diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts
index a6b40307b3..8667447e8b 100644
--- a/packages/playwright-core/src/client/network.ts
+++ b/packages/playwright-core/src/client/network.ts
@@ -14,26 +14,28 @@
* limitations under the License.
*/
+import * as fs from 'fs';
import { URLSearchParams } from 'url';
-import type * as channels from '@protocol/channels';
+
import { ChannelOwner } from './channelOwner';
+import { isTargetClosedError } from './errors';
+import { Events } from './events';
+import { APIResponse } from './fetch';
import { Frame } from './frame';
import { Worker } from './worker';
-import type { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
-import fs from 'fs';
+import { MultiMap, assert, headersObjectToArray, isRegExp, isString, rewriteErrorMessage, urlMatches, zones } from '../utils';
+import { Waiter } from './waiter';
+import { LongStandingScope, ManualPromise } from '../utils/manualPromise';
import { mime } from '../utilsBundle';
-import { assert, isString, headersObjectToArray, isRegExp, rewriteErrorMessage, MultiMap, urlMatches, zones } from '../utils';
+
+import type { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
import type { URLMatch, Zone } from '../utils';
-import { ManualPromise, LongStandingScope } from '../utils/manualPromise';
-import { Events } from './events';
+import type { BrowserContext } from './browserContext';
import type { Page } from './page';
-import { Waiter } from './waiter';
+import type { Serializable } from '../../types/structs';
import type * as api from '../../types/types';
import type { HeadersArray } from '../common/types';
-import { APIResponse } from './fetch';
-import type { Serializable } from '../../types/structs';
-import type { BrowserContext } from './browserContext';
-import { isTargetClosedError } from './errors';
+import type * as channels from '@protocol/channels';
export type NetworkCookie = {
name: string,
diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts
index d0db2cbae9..c68435321a 100644
--- a/packages/playwright-core/src/client/page.ts
+++ b/packages/playwright-core/src/client/page.ts
@@ -15,38 +15,42 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
-import type * as structs from '../../types/structs';
-import type * as api from '../../types/types';
-import { serializeError, isTargetClosedError, TargetClosedError } from './errors';
+import * as fs from 'fs';
+import * as path from 'path';
+
+import { TargetClosedError, isTargetClosedError, serializeError } from './errors';
import { TimeoutSettings } from '../common/timeoutSettings';
-import type * as channels from '@protocol/channels';
-import { assert, headersObjectToArray, isObject, isRegExp, isString, LongStandingScope, urlMatches, urlMatchesEqual, mkdirIfNeeded, trimStringWithEllipsis, type URLMatch } from '../utils';
+import { LongStandingScope, assert, headersObjectToArray, isObject, isRegExp, isString, mkdirIfNeeded, trimStringWithEllipsis, urlMatches, urlMatchesEqual } from '../utils';
import { Accessibility } from './accessibility';
import { Artifact } from './artifact';
-import type { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner';
import { evaluationScript } from './clientHelper';
import { Coverage } from './coverage';
import { Download } from './download';
-import { determineScreenshotType, ElementHandle } from './elementHandle';
+import { ElementHandle, determineScreenshotType } from './elementHandle';
import { Events } from './events';
-import type { APIRequestContext } from './fetch';
import { FileChooser } from './fileChooser';
-import type { WaitForNavigationOptions } from './frame';
import { Frame, verifyLoadState } from './frame';
+import { HarRouter } from './harRouter';
import { Keyboard, Mouse, Touchscreen } from './input';
-import { assertMaxArguments, JSHandle, parseResult, serializeArgument } from './jsHandle';
-import type { FrameLocator, Locator, LocatorOptions } from './locator';
-import type { ByRoleOptions } from '../utils/isomorphic/locatorUtils';
-import { type RouteHandlerCallback, type Request, Response, Route, RouteHandler, validateHeaders, WebSocket, type WebSocketRouteHandlerCallback, WebSocketRoute, WebSocketRouteHandler } from './network';
-import type { FilePayload, Headers, LifecycleEvent, SelectOption, SelectOptionOptions, Size, WaitForEventOptions, WaitForFunctionOptions } from './types';
+import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
+import { Response, Route, RouteHandler, WebSocket, WebSocketRoute, WebSocketRouteHandler, validateHeaders } from './network';
import { Video } from './video';
import { Waiter } from './waiter';
import { Worker } from './worker';
-import { HarRouter } from './harRouter';
+
+import type { BrowserContext } from './browserContext';
import type { Clock } from './clock';
+import type { APIRequestContext } from './fetch';
+import type { WaitForNavigationOptions } from './frame';
+import type { FrameLocator, Locator, LocatorOptions } from './locator';
+import type { Request, RouteHandlerCallback, WebSocketRouteHandlerCallback } from './network';
+import type { FilePayload, Headers, LifecycleEvent, SelectOption, SelectOptionOptions, Size, WaitForEventOptions, WaitForFunctionOptions } from './types';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type { URLMatch } from '../utils';
+import type { ByRoleOptions } from '../utils/isomorphic/locatorUtils';
+import type * as channels from '@protocol/channels';
type PDFOptions = Omit<channels.PagePdfParams, 'width' | 'height' | 'margin'> & {
width?: string | number,
diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts
index 078e31259d..3a0e359a0e 100644
--- a/packages/playwright-core/src/client/playwright.ts
+++ b/packages/playwright-core/src/client/playwright.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import { TimeoutError } from './errors';
import { Android } from './android';
import { BrowserType } from './browserType';
import { ChannelOwner } from './channelOwner';
import { Electron } from './electron';
+import { TimeoutError } from './errors';
import { APIRequest } from './fetch';
import { Selectors, SelectorsOwner } from './selectors';
+
+import type * as channels from '@protocol/channels';
import type { BrowserContextOptions, LaunchOptions } from 'playwright-core';
export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
diff --git a/packages/playwright-core/src/client/selectors.ts b/packages/playwright-core/src/client/selectors.ts
index 2739be0e8d..4f8ee784a8 100644
--- a/packages/playwright-core/src/client/selectors.ts
+++ b/packages/playwright-core/src/client/selectors.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import { evaluationScript } from './clientHelper';
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
+import { evaluationScript } from './clientHelper';
+import { setTestIdAttribute, testIdAttributeName } from './locator';
+
import type { SelectorEngine } from './types';
import type * as api from '../../types/types';
-import { setTestIdAttribute, testIdAttributeName } from './locator';
+import type * as channels from '@protocol/channels';
+
export class Selectors implements api.Selectors {
private _channels = new Set<SelectorsOwner>();
diff --git a/packages/playwright-core/src/client/stream.ts b/packages/playwright-core/src/client/stream.ts
index bb202ac4ad..4f43b9afad 100644
--- a/packages/playwright-core/src/client/stream.ts
+++ b/packages/playwright-core/src/client/stream.ts
@@ -15,9 +15,11 @@
*/
import { Readable } from 'stream';
-import type * as channels from '@protocol/channels';
+
import { ChannelOwner } from './channelOwner';
+import type * as channels from '@protocol/channels';
+
export class Stream extends ChannelOwner<channels.StreamChannel> {
static from(Stream: channels.StreamChannel): Stream {
return (Stream as any)._object;
diff --git a/packages/playwright-core/src/client/tracing.ts b/packages/playwright-core/src/client/tracing.ts
index 2481741e3e..a75f026625 100644
--- a/packages/playwright-core/src/client/tracing.ts
+++ b/packages/playwright-core/src/client/tracing.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type * as api from '../../types/types';
-import type * as channels from '@protocol/channels';
import { Artifact } from './artifact';
import { ChannelOwner } from './channelOwner';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
export class Tracing extends ChannelOwner<channels.TracingChannel> implements api.Tracing {
private _includeSources = false;
_tracesDir: string | undefined;
diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts
index e21b34a8a8..5d232e9607 100644
--- a/packages/playwright-core/src/client/types.ts
+++ b/packages/playwright-core/src/client/types.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import type { Size } from '../common/types';
-export type { Size, Point, Rect, Quad, TimeoutOptions, HeadersArray } from '../common/types';
+import type * as channels from '@protocol/channels';
+export type { HeadersArray, Point, Quad, Rect, Size, TimeoutOptions } from '../common/types';
type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error';
export interface Logger {
diff --git a/packages/playwright-core/src/client/video.ts b/packages/playwright-core/src/client/video.ts
index 08c39d4247..f15d75bade 100644
--- a/packages/playwright-core/src/client/video.ts
+++ b/packages/playwright-core/src/client/video.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { Page } from './page';
-import type * as api from '../../types/types';
+import { ManualPromise } from '../utils';
+
import type { Artifact } from './artifact';
import type { Connection } from './connection';
-import { ManualPromise } from '../utils';
+import type { Page } from './page';
+import type * as api from '../../types/types';
export class Video implements api.Video {
private _artifact: Promise<Artifact | null> | null = null;
diff --git a/packages/playwright-core/src/client/waiter.ts b/packages/playwright-core/src/client/waiter.ts
index 408a01f3d0..6453fb875d 100644
--- a/packages/playwright-core/src/client/waiter.ts
+++ b/packages/playwright-core/src/client/waiter.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { EventEmitter } from 'events';
-import { rewriteErrorMessage } from '../utils/stackTrace';
import { TimeoutError } from './errors';
import { createGuid, zones } from '../utils';
+import { rewriteErrorMessage } from '../utils/stackTrace';
+
import type { Zone } from '../utils';
-import type * as channels from '@protocol/channels';
import type { ChannelOwner } from './channelOwner';
+import type * as channels from '@protocol/channels';
+import type { EventEmitter } from 'events';
export class Waiter {
private _dispose: (() => void)[];
diff --git a/packages/playwright-core/src/client/webError.ts b/packages/playwright-core/src/client/webError.ts
index 13a942abee..3993113796 100644
--- a/packages/playwright-core/src/client/webError.ts
+++ b/packages/playwright-core/src/client/webError.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type * as api from '../../types/types';
import type { Page } from './page';
+import type * as api from '../../types/types';
export class WebError implements api.WebError {
private _page: Page | null;
diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.ts
index 31d5d3057f..36d5bddff3 100644
--- a/packages/playwright-core/src/client/worker.ts
+++ b/packages/playwright-core/src/client/worker.ts
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-import { Events } from './events';
-import type * as channels from '@protocol/channels';
import { ChannelOwner } from './channelOwner';
-import { assertMaxArguments, JSHandle, parseResult, serializeArgument } from './jsHandle';
-import type { Page } from './page';
-import type { BrowserContext } from './browserContext';
-import type * as api from '../../types/types';
-import type * as structs from '../../types/structs';
+import { Events } from './events';
+import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
import { LongStandingScope } from '../utils';
import { TargetClosedError } from './errors';
+import type { BrowserContext } from './browserContext';
+import type { Page } from './page';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as channels from '@protocol/channels';
+
+
export class Worker extends ChannelOwner<channels.WorkerChannel> implements api.Worker {
_page: Page | undefined; // Set for web workers.
_context: BrowserContext | undefined; // Set for service workers.
diff --git a/packages/playwright-core/src/client/writableStream.ts b/packages/playwright-core/src/client/writableStream.ts
index 8ed799292c..66cf17201d 100644
--- a/packages/playwright-core/src/client/writableStream.ts
+++ b/packages/playwright-core/src/client/writableStream.ts
@@ -15,9 +15,11 @@
*/
import { Writable } from 'stream';
-import type * as channels from '@protocol/channels';
+
import { ChannelOwner } from './channelOwner';
+import type * as channels from '@protocol/channels';
+
export class WritableStream extends ChannelOwner<channels.WritableStreamChannel> {
static from(Stream: channels.WritableStreamChannel): WritableStream {
return (Stream as any)._object;
diff --git a/packages/playwright-core/src/common/socksProxy.ts b/packages/playwright-core/src/common/socksProxy.ts
index 6566262d64..632e698dc2 100644
--- a/packages/playwright-core/src/common/socksProxy.ts
+++ b/packages/playwright-core/src/common/socksProxy.ts
@@ -15,11 +15,13 @@
*/
import EventEmitter from 'events';
-import type { AddressInfo } from 'net';
-import net from 'net';
+import * as net from 'net';
+
+import { assert, createGuid, } from '../utils';
import { debugLogger } from '../utils/debugLogger';
import { createSocket } from '../utils/happy-eyeballs';
-import { assert, createGuid, } from '../utils';
+
+import type { AddressInfo } from 'net';
// https://tools.ietf.org/html/rfc1928
diff --git a/packages/playwright-core/src/image_tools/compare.ts b/packages/playwright-core/src/image_tools/compare.ts
index ee4b6b691d..8dddb5df35 100644
--- a/packages/playwright-core/src/image_tools/compare.ts
+++ b/packages/playwright-core/src/image_tools/compare.ts
@@ -16,7 +16,7 @@
import { blendWithWhite, colorDeltaE94, rgb2gray } from './colorUtils';
import { ImageChannel } from './imageChannel';
-import { ssim, FastStats } from './stats';
+import { FastStats, ssim } from './stats';
const SSIM_WINDOW_RADIUS = 15;
const VARIANCE_WINDOW_RADIUS = 1;
diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.ts
index a757294da8..d6cd8110c2 100644
--- a/packages/playwright-core/src/inProcessFactory.ts
+++ b/packages/playwright-core/src/inProcessFactory.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { Playwright as PlaywrightAPI } from './client/playwright';
-import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from './server';
-import { Connection } from './client/connection';
-import { BrowserServerLauncherImpl } from './browserServerImpl';
import { AndroidServerLauncherImpl } from './androidServerImpl';
+import { BrowserServerLauncherImpl } from './browserServerImpl';
+import { Connection } from './client/connection';
+import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from './server';
+
+import type { Playwright as PlaywrightAPI } from './client/playwright';
import type { Language } from './utils';
export function createInProcessPlaywright(): PlaywrightAPI {
diff --git a/packages/playwright-core/src/outofprocess.ts b/packages/playwright-core/src/outofprocess.ts
index 81deaead67..3d8c43788e 100644
--- a/packages/playwright-core/src/outofprocess.ts
+++ b/packages/playwright-core/src/outofprocess.ts
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-import { Connection } from './client/connection';
-import { PipeTransport } from './protocol/transport';
-import type { Playwright } from './client/playwright';
import * as childProcess from 'child_process';
import * as path from 'path';
+
+import { Connection } from './client/connection';
+import { PipeTransport } from './protocol/transport';
import { ManualPromise } from './utils/manualPromise';
+import type { Playwright } from './client/playwright';
+
+
export async function start(env: any = {}): Promise<{ playwright: Playwright, stop: () => Promise<void> }> {
const client = new PlaywrightClient(env);
const playwright = await client._playwright;
diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.ts
index d1e7c3d63c..7072464089 100644
--- a/packages/playwright-core/src/protocol/validator.ts
+++ b/packages/playwright-core/src/protocol/validator.ts
@@ -16,6 +16,7 @@
// This file is generated by generate_channels.js, do not edit manually.
+/* eslint-disable import/order */
import { scheme, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';
export type { Validator, ValidatorContext } from './validatorPrimitives';
export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator } from './validatorPrimitives';
diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.ts
index 5f39be5671..9817f8d295 100644
--- a/packages/playwright-core/src/remote/playwrightConnection.ts
+++ b/packages/playwright-core/src/remote/playwrightConnection.ts
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-import type { WebSocket } from '../utilsBundle';
-import type { DispatcherScope, Playwright } from '../server';
-import type * as channels from '@protocol/channels';
-import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server';
-import { Browser } from '../server/browser';
-import { serverSideCallMetadata } from '../server/instrumentation';
import { SocksProxy } from '../common/socksProxy';
-import { assert, isUnderTest } from '../utils';
-import type { LaunchOptions } from '../server/types';
+import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
import { AndroidDevice } from '../server/android/android';
+import { Browser } from '../server/browser';
import { DebugControllerDispatcher } from '../server/dispatchers/debugControllerDispatcher';
+import { serverSideCallMetadata } from '../server/instrumentation';
+import { assert, isUnderTest } from '../utils';
import { startProfiling, stopProfiling } from '../utils';
import { monotonicTime } from '../utils';
import { debugLogger } from '../utils/debugLogger';
+import type { DispatcherScope, Playwright } from '../server';
+import type { LaunchOptions } from '../server/types';
+import type { WebSocket } from '../utilsBundle';
+import type * as channels from '@protocol/channels';
+
export type ClientType = 'controller' | 'launch-browser' | 'reuse-browser' | 'pre-launched-browser-or-android';
type Options = {
diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.ts
index 5cd99285ed..232ead0806 100644
--- a/packages/playwright-core/src/remote/playwrightServer.ts
+++ b/packages/playwright-core/src/remote/playwrightServer.ts
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-import type { Browser } from '../server/browser';
-import type { Playwright } from '../server/playwright';
-import { createPlaywright } from '../server/playwright';
import { PlaywrightConnection } from './playwrightConnection';
-import type { ClientType } from './playwrightConnection';
-import type { LaunchOptions } from '../server/types';
-import { Semaphore } from '../utils/semaphore';
-import type { AndroidDevice } from '../server/android/android';
-import type { SocksProxy } from '../common/socksProxy';
-import { debugLogger } from '../utils/debugLogger';
+import { createPlaywright } from '../server/playwright';
import { userAgentVersionMatchesErrorMessage } from '../utils';
+import { debugLogger } from '../utils/debugLogger';
+import { Semaphore } from '../utils/semaphore';
import { WSServer } from '../utils/wsServer';
+import type { ClientType } from './playwrightConnection';
+import type { SocksProxy } from '../common/socksProxy';
+import type { AndroidDevice } from '../server/android/android';
+import type { Browser } from '../server/browser';
+import type { Playwright } from '../server/playwright';
+import type { LaunchOptions } from '../server/types';
+
+
type ServerOptions = {
path: string;
maxConnections: number;
diff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.ts
index b6303935b7..d411581eab 100644
--- a/packages/playwright-core/src/server/android/android.ts
+++ b/packages/playwright-core/src/server/android/android.ts
@@ -14,31 +14,33 @@
* limitations under the License.
*/
-import { debug } from '../../utilsBundle';
import { EventEmitter } from 'events';
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import type * as stream from 'stream';
-import { wsReceiver, wsSender } from '../../utilsBundle';
-import { createGuid, makeWaitForNextTask, isUnderTest, getPackageManagerExecCommand } from '../../utils';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+import { TimeoutSettings } from '../../common/timeoutSettings';
+import { PipeTransport } from '../../protocol/transport';
+import { createGuid, getPackageManagerExecCommand, isUnderTest, makeWaitForNextTask } from '../../utils';
+import { RecentLogsCollector } from '../../utils/debugLogger';
import { removeFolders } from '../../utils/fileUtils';
-import type { BrowserOptions, BrowserProcess } from '../browser';
-import type { BrowserContext } from '../browserContext';
+import { gracefullyCloseSet } from '../../utils/processLauncher';
+import { debug } from '../../utilsBundle';
+import { wsReceiver, wsSender } from '../../utilsBundle';
import { validateBrowserContextOptions } from '../browserContext';
-import { ProgressController } from '../progress';
+import { chromiumSwitches } from '../chromium/chromiumSwitches';
import { CRBrowser } from '../chromium/crBrowser';
import { helper } from '../helper';
-import type * as types from '../types';
-import { PipeTransport } from '../../protocol/transport';
-import { RecentLogsCollector } from '../../utils/debugLogger';
-import { gracefullyCloseSet } from '../../utils/processLauncher';
-import { TimeoutSettings } from '../../common/timeoutSettings';
-import type * as channels from '@protocol/channels';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
-import { chromiumSwitches } from '../chromium/chromiumSwitches';
+import { ProgressController } from '../progress';
import { registry } from '../registry';
+import type { BrowserOptions, BrowserProcess } from '../browser';
+import type { BrowserContext } from '../browserContext';
+import type * as types from '../types';
+import type * as channels from '@protocol/channels';
+import type * as stream from 'stream';
+
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
export interface Backend {
diff --git a/packages/playwright-core/src/server/android/backendAdb.ts b/packages/playwright-core/src/server/android/backendAdb.ts
index cd718b9d95..a5f28f1d35 100644
--- a/packages/playwright-core/src/server/android/backendAdb.ts
+++ b/packages/playwright-core/src/server/android/backendAdb.ts
@@ -14,12 +14,15 @@
* limitations under the License.
*/
-import { debug } from '../../utilsBundle';
-import type * as channels from '@protocol/channels';
-import * as net from 'net';
import { EventEmitter } from 'events';
-import type { Backend, DeviceBackend, SocketBackend } from './android';
+import * as net from 'net';
+
import { assert, createGuid } from '../../utils';
+import { debug } from '../../utilsBundle';
+
+import type { Backend, DeviceBackend, SocketBackend } from './android';
+import type * as channels from '@protocol/channels';
+
export class AdbBackend implements Backend {
async devices(options: channels.AndroidDevicesOptions = {}): Promise<DeviceBackend[]> {
diff --git a/packages/playwright-core/src/server/artifact.ts b/packages/playwright-core/src/server/artifact.ts
index 8824365b80..26b97d4d56 100644
--- a/packages/playwright-core/src/server/artifact.ts
+++ b/packages/playwright-core/src/server/artifact.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import fs from 'fs';
+import * as fs from 'fs';
+
import { assert } from '../utils';
-import { ManualPromise } from '../utils/manualPromise';
-import { SdkObject } from './instrumentation';
import { TargetClosedError } from './errors';
+import { SdkObject } from './instrumentation';
+import { ManualPromise } from '../utils/manualPromise';
type SaveCallback = (localPath: string, error?: Error) => Promise<void>;
type CancelCallback = () => Promise<void>;
diff --git a/packages/playwright-core/src/server/bidi/bidiBrowser.ts b/packages/playwright-core/src/server/bidi/bidiBrowser.ts
index 96c48ea2a8..45c12bc347 100644
--- a/packages/playwright-core/src/server/bidi/bidiBrowser.ts
+++ b/packages/playwright-core/src/server/bidi/bidiBrowser.ts
@@ -14,23 +14,25 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
-import type { BrowserOptions } from '../browser';
import { Browser } from '../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext } from '../browserContext';
-import type { SdkObject } from '../instrumentation';
+import { BrowserContext, assertBrowserContextIsNotOwned } from '../browserContext';
import * as network from '../network';
-import type { InitScript, Page } from '../page';
-import type { ConnectionTransport } from '../transport';
-import type * as types from '../types';
-import type { BidiSession } from './bidiConnection';
import { BidiConnection } from './bidiConnection';
import { bidiBytesValueToString } from './bidiNetworkManager';
import { BidiPage } from './bidiPage';
import * as bidi from './third_party/bidiProtocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type { BrowserOptions } from '../browser';
+import type { SdkObject } from '../instrumentation';
+import type { InitScript, Page } from '../page';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
+import type { BidiSession } from './bidiConnection';
+import type * as channels from '@protocol/channels';
+
+
export class BidiBrowser extends Browser {
private readonly _connection: BidiConnection;
readonly _browserSession: BidiSession;
diff --git a/packages/playwright-core/src/server/bidi/bidiChromium.ts b/packages/playwright-core/src/server/bidi/bidiChromium.ts
index 9572ac71ed..a46f1a017a 100644
--- a/packages/playwright-core/src/server/bidi/bidiChromium.ts
+++ b/packages/playwright-core/src/server/bidi/bidiChromium.ts
@@ -14,18 +14,21 @@
* limitations under the License.
*/
-import os from 'os';
+import * as os from 'os';
+
import { assert, wrapInASCIIBox } from '../../utils';
-import type { Env } from '../../utils/processLauncher';
-import type { BrowserOptions } from '../browser';
import { BrowserReadyState, BrowserType, kNoXServerRunningError } from '../browserType';
+import { BidiBrowser } from './bidiBrowser';
+import { kBrowserCloseMessageId } from './bidiConnection';
import { chromiumSwitches } from '../chromium/chromiumSwitches';
+
+import type { Env } from '../../utils/processLauncher';
+import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
-import { BidiBrowser } from './bidiBrowser';
-import { kBrowserCloseMessageId } from './bidiConnection';
+
export class BidiChromium extends BrowserType {
constructor(parent: SdkObject) {
diff --git a/packages/playwright-core/src/server/bidi/bidiConnection.ts b/packages/playwright-core/src/server/bidi/bidiConnection.ts
index 48472bf748..87b3f59c9b 100644
--- a/packages/playwright-core/src/server/bidi/bidiConnection.ts
+++ b/packages/playwright-core/src/server/bidi/bidiConnection.ts
@@ -15,14 +15,16 @@
*/
import { EventEmitter } from 'events';
-import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
-import type { RecentLogsCollector } from '../../utils/debugLogger';
+
import { debugLogger } from '../../utils/debugLogger';
-import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { ProtocolError } from '../protocolError';
-import type * as bidi from './third_party/bidiProtocol';
+
+import type { RecentLogsCollector } from '../../utils/debugLogger';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { ProtocolLogger } from '../types';
import type * as bidiCommands from './third_party/bidiCommands';
+import type * as bidi from './third_party/bidiProtocol';
// BidiPlaywright uses this special id to issue Browser.close command which we
// should ignore.
diff --git a/packages/playwright-core/src/server/bidi/bidiExecutionContext.ts b/packages/playwright-core/src/server/bidi/bidiExecutionContext.ts
index de1b50bd1a..ec0cb681a0 100644
--- a/packages/playwright-core/src/server/bidi/bidiExecutionContext.ts
+++ b/packages/playwright-core/src/server/bidi/bidiExecutionContext.ts
@@ -16,11 +16,12 @@
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
import * as js from '../javascript';
-import type { BidiSession } from './bidiConnection';
import { BidiDeserializer } from './third_party/bidiDeserializer';
import * as bidi from './third_party/bidiProtocol';
import { BidiSerializer } from './third_party/bidiSerializer';
+import type { BidiSession } from './bidiConnection';
+
export class BidiExecutionContext implements js.ExecutionContextDelegate {
private readonly _session: BidiSession;
readonly _target: bidi.Script.Target;
diff --git a/packages/playwright-core/src/server/bidi/bidiFirefox.ts b/packages/playwright-core/src/server/bidi/bidiFirefox.ts
index 204cabdef7..94d943898f 100644
--- a/packages/playwright-core/src/server/bidi/bidiFirefox.ts
+++ b/packages/playwright-core/src/server/bidi/bidiFirefox.ts
@@ -14,19 +14,22 @@
* limitations under the License.
*/
-import os from 'os';
-import path from 'path';
+import * as os from 'os';
+import * as path from 'path';
+
import { assert, wrapInASCIIBox } from '../../utils';
+import { BrowserReadyState, BrowserType, kNoXServerRunningError } from '../browserType';
+import { BidiBrowser } from './bidiBrowser';
+import { kBrowserCloseMessageId } from './bidiConnection';
+import { createProfile } from './third_party/firefoxPrefs';
+
import type { Env } from '../../utils/processLauncher';
import type { BrowserOptions } from '../browser';
-import { BrowserReadyState, BrowserType, kNoXServerRunningError } from '../browserType';
import type { SdkObject } from '../instrumentation';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
-import { BidiBrowser } from './bidiBrowser';
-import { kBrowserCloseMessageId } from './bidiConnection';
-import { createProfile } from './third_party/firefoxPrefs';
+
export class BidiFirefox extends BrowserType {
constructor(parent: SdkObject) {
diff --git a/packages/playwright-core/src/server/bidi/bidiInput.ts b/packages/playwright-core/src/server/bidi/bidiInput.ts
index 01a359dd12..a7f8810da5 100644
--- a/packages/playwright-core/src/server/bidi/bidiInput.ts
+++ b/packages/playwright-core/src/server/bidi/bidiInput.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
+import { resolveSmartModifierString } from '../input';
+import { getBidiKeyValue } from './third_party/bidiKeyboard';
+import * as bidi from './third_party/bidiProtocol';
+
import type * as input from '../input';
import type * as types from '../types';
import type { BidiSession } from './bidiConnection';
-import * as bidi from './third_party/bidiProtocol';
-import { getBidiKeyValue } from './third_party/bidiKeyboard';
-import { resolveSmartModifierString } from '../input';
export class RawKeyboardImpl implements input.RawKeyboard {
private _session: BidiSession;
diff --git a/packages/playwright-core/src/server/bidi/bidiNetworkManager.ts b/packages/playwright-core/src/server/bidi/bidiNetworkManager.ts
index c46ce90307..185eee86a0 100644
--- a/packages/playwright-core/src/server/bidi/bidiNetworkManager.ts
+++ b/packages/playwright-core/src/server/bidi/bidiNetworkManager.ts
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
-import type { Page } from '../page';
+import { parseRawCookie } from '../cookieStore';
import * as network from '../network';
+import * as bidi from './third_party/bidiProtocol';
+
+import type { RegisteredListener } from '../../utils/eventsHelper';
import type * as frames from '../frames';
+import type { Page } from '../page';
import type * as types from '../types';
-import * as bidi from './third_party/bidiProtocol';
import type { BidiSession } from './bidiConnection';
-import { parseRawCookie } from '../cookieStore';
export class BidiNetworkManager {
diff --git a/packages/playwright-core/src/server/bidi/bidiOverCdp.ts b/packages/playwright-core/src/server/bidi/bidiOverCdp.ts
index 1d01317c1e..adf7c9afbf 100644
--- a/packages/playwright-core/src/server/bidi/bidiOverCdp.ts
+++ b/packages/playwright-core/src/server/bidi/bidiOverCdp.ts
@@ -16,11 +16,13 @@
import * as bidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/BidiMapper';
import * as bidiCdpConnection from 'chromium-bidi/lib/cjs/cdp/CdpConnection';
-import type * as bidiTransport from 'chromium-bidi/lib/cjs/utils/transport';
-import type { ChromiumBidi } from 'chromium-bidi/lib/cjs/protocol/protocol';
-import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+
import { debugLogger } from '../../utils/debugLogger';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { ChromiumBidi } from 'chromium-bidi/lib/cjs/protocol/protocol';
+import type * as bidiTransport from 'chromium-bidi/lib/cjs/utils/transport';
+
const bidiServerLogger = (prefix: string, ...args: unknown[]): void => {
debugLogger.log(prefix as any, args);
};
diff --git a/packages/playwright-core/src/server/bidi/bidiPage.ts b/packages/playwright-core/src/server/bidi/bidiPage.ts
index cf0662738b..dd2d276c18 100644
--- a/packages/playwright-core/src/server/bidi/bidiPage.ts
+++ b/packages/playwright-core/src/server/bidi/bidiPage.ts
@@ -14,26 +14,27 @@
* limitations under the License.
*/
-import type { RegisteredListener } from '../../utils/eventsHelper';
-import { eventsHelper } from '../../utils/eventsHelper';
import { assert } from '../../utils';
-import type * as accessibility from '../accessibility';
-import * as dom from '../dom';
+import { eventsHelper } from '../../utils/eventsHelper';
+import { BrowserContext } from '../browserContext';
import * as dialog from '../dialog';
-import type * as frames from '../frames';
+import * as dom from '../dom';
import { Page } from '../page';
-import type * as channels from '@protocol/channels';
+import { BidiExecutionContext } from './bidiExecutionContext';
+import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './bidiInput';
+import { BidiNetworkManager } from './bidiNetworkManager';
+import { BidiPDF } from './bidiPdf';
+import * as bidi from './third_party/bidiProtocol';
+
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type * as accessibility from '../accessibility';
+import type * as frames from '../frames';
import type { InitScript, PageDelegate } from '../page';
import type { Progress } from '../progress';
import type * as types from '../types';
import type { BidiBrowserContext } from './bidiBrowser';
import type { BidiSession } from './bidiConnection';
-import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './bidiInput';
-import * as bidi from './third_party/bidiProtocol';
-import { BidiExecutionContext } from './bidiExecutionContext';
-import { BidiNetworkManager } from './bidiNetworkManager';
-import { BrowserContext } from '../browserContext';
-import { BidiPDF } from './bidiPdf';
+import type * as channels from '@protocol/channels';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
const kPlaywrightBindingChannel = 'playwrightChannel';
diff --git a/packages/playwright-core/src/server/bidi/bidiPdf.ts b/packages/playwright-core/src/server/bidi/bidiPdf.ts
index 89fefb5260..b9a8c5cb92 100644
--- a/packages/playwright-core/src/server/bidi/bidiPdf.ts
+++ b/packages/playwright-core/src/server/bidi/bidiPdf.ts
@@ -16,8 +16,9 @@
*/
import { assert } from '../../utils';
-import type * as channels from '@protocol/channels';
+
import type { BidiSession } from './bidiConnection';
+import type * as channels from '@protocol/channels';
const PagePaperFormats: { [key: string]: { width: number, height: number }} = {
letter: { width: 8.5, height: 11 },
diff --git a/packages/playwright-core/src/server/bidi/third_party/firefoxPrefs.ts b/packages/playwright-core/src/server/bidi/third_party/firefoxPrefs.ts
index 3e0c347b52..4b246f6c3b 100644
--- a/packages/playwright-core/src/server/bidi/third_party/firefoxPrefs.ts
+++ b/packages/playwright-core/src/server/bidi/third_party/firefoxPrefs.ts
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
/* eslint-disable curly, indent */
diff --git a/packages/playwright-core/src/server/browser.ts b/packages/playwright-core/src/server/browser.ts
index 252443bc44..d99a3f8f8a 100644
--- a/packages/playwright-core/src/server/browser.ts
+++ b/packages/playwright-core/src/server/browser.ts
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-import type * as types from './types';
-import type * as channels from '@protocol/channels';
+import { Artifact } from './artifact';
import { BrowserContext, validateBrowserContextOptions } from './browserContext';
-import { Page } from './page';
import { Download } from './download';
-import type { ProxySettings } from './types';
-import type { ChildProcess } from 'child_process';
-import type { RecentLogsCollector } from '../utils/debugLogger';
-import type { CallMetadata } from './instrumentation';
import { SdkObject } from './instrumentation';
-import { Artifact } from './artifact';
+import { Page } from './page';
import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
+import type { CallMetadata } from './instrumentation';
+import type * as types from './types';
+import type { ProxySettings } from './types';
+import type { RecentLogsCollector } from '../utils/debugLogger';
+import type * as channels from '@protocol/channels';
+import type { ChildProcess } from 'child_process';
+
+
export interface BrowserProcess {
onclose?: ((exitCode: number | null, signal: string | null) => void);
process?: ChildProcess;
diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts
index c4469f52b0..69f879ded6 100644
--- a/packages/playwright-core/src/server/browserContext.ts
+++ b/packages/playwright-core/src/server/browserContext.ts
@@ -15,36 +15,38 @@
* limitations under the License.
*/
+import * as fs from 'fs';
+import * as path from 'path';
+
import { TimeoutSettings } from '../common/timeoutSettings';
import { createGuid, debugMode } from '../utils';
-import { mkdirIfNeeded } from '../utils/fileUtils';
-import type { Browser, BrowserOptions } from './browser';
-import type { Download } from './download';
-import type * as frames from './frames';
+import { Clock } from './clock';
+import { Debugger } from './debugger';
+import { BrowserContextAPIRequestContext } from './fetch';
+import { HarRecorder } from './har/harRecorder';
import { helper } from './helper';
+import { SdkObject, serverSideCallMetadata } from './instrumentation';
+import * as utilityScriptSerializers from './isomorphic/utilityScriptSerializers';
import * as network from './network';
import { InitScript } from './page';
import { Page, PageBinding } from './page';
-import type { Progress, ProgressController } from './progress';
-import type { Selectors } from './selectors';
-import type * as types from './types';
-import type * as channels from '@protocol/channels';
-import path from 'path';
-import fs from 'fs';
-import type { CallMetadata } from './instrumentation';
-import { serverSideCallMetadata, SdkObject } from './instrumentation';
-import { Debugger } from './debugger';
-import { Tracing } from './trace/recorder/tracing';
-import { HarRecorder } from './har/harRecorder';
import { Recorder } from './recorder';
+import * as storageScript from './storageScript';
+import { mkdirIfNeeded } from '../utils/fileUtils';
+import { RecorderApp } from './recorder/recorderApp';
import * as consoleApiSource from '../generated/consoleApiSource';
-import { BrowserContextAPIRequestContext } from './fetch';
+import { Tracing } from './trace/recorder/tracing';
+
import type { Artifact } from './artifact';
-import { Clock } from './clock';
+import type { Browser, BrowserOptions } from './browser';
+import type { Download } from './download';
+import type * as frames from './frames';
+import type { CallMetadata } from './instrumentation';
+import type { Progress, ProgressController } from './progress';
+import type { Selectors } from './selectors';
import type { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
-import { RecorderApp } from './recorder/recorderApp';
-import * as storageScript from './storageScript';
-import * as utilityScriptSerializers from './isomorphic/utilityScriptSerializers';
+import type * as types from './types';
+import type * as channels from '@protocol/channels';
export abstract class BrowserContext extends SdkObject {
static Events = {
diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.ts
index 128b80a352..62ec63011e 100644
--- a/packages/playwright-core/src/server/browserType.ts
+++ b/packages/playwright-core/src/server/browserType.ts
@@ -14,32 +14,35 @@
* limitations under the License.
*/
-import fs from 'fs';
+import * as fs from 'fs';
import * as os from 'os';
-import path from 'path';
-import type { BrowserContext } from './browserContext';
+import * as path from 'path';
+
import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
-import type { BrowserName } from './registry';
+import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings';
+import { ManualPromise, debugMode } from '../utils';
+import { helper } from './helper';
+import { SdkObject } from './instrumentation';
+import { PipeTransport } from './pipeTransport';
+import { ProgressController } from './progress';
+import { isProtocolError } from './protocolError';
import { registry } from './registry';
-import type { ConnectionTransport } from './transport';
+import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
import { WebSocketTransport } from './transport';
-import type { BrowserOptions, Browser, BrowserProcess } from './browser';
-import type { Env } from '../utils/processLauncher';
-import { launchProcess, envArrayToObject } from '../utils/processLauncher';
-import { PipeTransport } from './pipeTransport';
+import { RecentLogsCollector } from '../utils/debugLogger';
+import { existsAsync } from '../utils/fileUtils';
+import { envArrayToObject, launchProcess } from '../utils/processLauncher';
+
+import type { Browser, BrowserOptions, BrowserProcess } from './browser';
+import type { BrowserContext } from './browserContext';
+import type { CallMetadata } from './instrumentation';
import type { Progress } from './progress';
-import { ProgressController } from './progress';
+import type { ProtocolError } from './protocolError';
+import type { BrowserName } from './registry';
+import type { ConnectionTransport } from './transport';
import type * as types from './types';
+import type { Env } from '../utils/processLauncher';
import type * as channels from '@protocol/channels';
-import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings';
-import { debugMode, ManualPromise } from '../utils';
-import { existsAsync } from '../utils/fileUtils';
-import { helper } from './helper';
-import { RecentLogsCollector } from '../utils/debugLogger';
-import type { CallMetadata } from './instrumentation';
-import { SdkObject } from './instrumentation';
-import { type ProtocolError, isProtocolError } from './protocolError';
-import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';
export const kNoXServerRunningError = 'Looks like you launched a headed browser without having a XServer running.\n' +
'Set either \'headless: true\' or use \'xvfb-run <your-playwright-app>\' before running Playwright.\n\n<3 Playwright Team';
diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts
index 8fce8f51ca..badbe700bb 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -15,40 +15,42 @@
* limitations under the License.
*/
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import type stream from 'stream';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+import { chromiumSwitches } from './chromiumSwitches';
import { CRBrowser } from './crBrowser';
-import type { Env } from '../../utils/processLauncher';
-import { gracefullyCloseSet } from '../../utils/processLauncher';
import { kBrowserCloseMessageId } from './crConnection';
+import { TimeoutSettings } from '../../common/timeoutSettings';
+import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
+import { wrapInASCIIBox } from '../../utils/ascii';
+import { RecentLogsCollector } from '../../utils/debugLogger';
+import { removeFolders } from '../../utils/fileUtils';
+import { ManualPromise } from '../../utils/manualPromise';
+import { fetchData } from '../../utils/network';
+import { gracefullyCloseSet } from '../../utils/processLauncher';
+import { getUserAgent } from '../../utils/userAgent';
+import { validateBrowserContextOptions } from '../browserContext';
import { BrowserType, kNoXServerRunningError } from '../browserType';
import { BrowserReadyState } from '../browserType';
-import type { ConnectionTransport, ProtocolRequest } from '../transport';
+import { helper } from '../helper';
+import { registry } from '../registry';
import { WebSocketTransport } from '../transport';
import { CRDevTools } from './crDevTools';
-import type { BrowserOptions, BrowserProcess } from '../browser';
import { Browser } from '../browser';
-import type * as types from '../types';
-import type { HTTPRequestParams } from '../../utils/network';
-import { fetchData } from '../../utils/network';
-import { getUserAgent } from '../../utils/userAgent';
-import { wrapInASCIIBox } from '../../utils/ascii';
-import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
-import { removeFolders } from '../../utils/fileUtils';
-import { RecentLogsCollector } from '../../utils/debugLogger';
-import type { Progress } from '../progress';
import { ProgressController } from '../progress';
-import { TimeoutSettings } from '../../common/timeoutSettings';
-import { helper } from '../helper';
+
+import type { HTTPRequestParams } from '../../utils/network';
+import type { Env } from '../../utils/processLauncher';
+import type { BrowserOptions, BrowserProcess } from '../browser';
import type { CallMetadata, SdkObject } from '../instrumentation';
-import type http from 'http';
-import { registry } from '../registry';
-import { ManualPromise } from '../../utils/manualPromise';
-import { validateBrowserContextOptions } from '../browserContext';
-import { chromiumSwitches } from './chromiumSwitches';
+import type { Progress } from '../progress';
import type { ProtocolError } from '../protocolError';
+import type { ConnectionTransport, ProtocolRequest } from '../transport';
+import type * as types from '../types';
+import type http from 'http';
+import type stream from 'stream';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
diff --git a/packages/playwright-core/src/server/chromium/crAccessibility.ts b/packages/playwright-core/src/server/chromium/crAccessibility.ts
index 4114663a0e..539f3057c7 100644
--- a/packages/playwright-core/src/server/chromium/crAccessibility.ts
+++ b/packages/playwright-core/src/server/chromium/crAccessibility.ts
@@ -17,8 +17,8 @@
import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
-import type * as dom from '../dom';
import type * as accessibility from '../accessibility';
+import type * as dom from '../dom';
import type * as channels from '@protocol/channels';
export async function getAccessibilityTree(client: CRSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
diff --git a/packages/playwright-core/src/server/chromium/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.ts
index 9f03803dcb..51ad0ae887 100644
--- a/packages/playwright-core/src/server/chromium/crBrowser.ts
+++ b/packages/playwright-core/src/server/chromium/crBrowser.ts
@@ -15,28 +15,30 @@
* limitations under the License.
*/
-import type { BrowserOptions } from '../browser';
-import path from 'path';
-import { Browser } from '../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
+import * as path from 'path';
+
import { assert, createGuid } from '../../utils';
+import { Artifact } from '../artifact';
+import { Browser } from '../browser';
+import { BrowserContext, assertBrowserContextIsNotOwned, verifyGeolocation } from '../browserContext';
+import { Frame } from '../frames';
import * as network from '../network';
-import type { InitScript, Worker } from '../page';
import { Page } from '../page';
-import { Frame } from '../frames';
+import { CRConnection, ConnectionEvents } from './crConnection';
+import { CRPage } from './crPage';
+import { saveProtocolStream } from './crProtocolHelper';
+import { CRServiceWorker } from './crServiceWorker';
+
import type { Dialog } from '../dialog';
+import type { InitScript, Worker } from '../page';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
-import type * as channels from '@protocol/channels';
-import type { CRSession, CDPSession } from './crConnection';
-import { ConnectionEvents, CRConnection } from './crConnection';
-import { CRPage } from './crPage';
-import { saveProtocolStream } from './crProtocolHelper';
-import type { Protocol } from './protocol';
+import type { CDPSession, CRSession } from './crConnection';
import type { CRDevTools } from './crDevTools';
-import { CRServiceWorker } from './crServiceWorker';
+import type { Protocol } from './protocol';
+import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
-import { Artifact } from '../artifact';
+import type * as channels from '@protocol/channels';
export class CRBrowser extends Browser {
readonly _connection: CRConnection;
diff --git a/packages/playwright-core/src/server/chromium/crConnection.ts b/packages/playwright-core/src/server/chromium/crConnection.ts
index c257d0d7ec..424d64a500 100644
--- a/packages/playwright-core/src/server/chromium/crConnection.ts
+++ b/packages/playwright-core/src/server/chromium/crConnection.ts
@@ -15,16 +15,20 @@
* limitations under the License.
*/
-import { type RegisteredListener, assert, eventsHelper } from '../../utils';
-import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
-import type { Protocol } from './protocol';
import { EventEmitter } from 'events';
-import type { RecentLogsCollector } from '../../utils/debugLogger';
+
+import { assert, eventsHelper } from '../../utils';
import { debugLogger } from '../../utils/debugLogger';
-import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { ProtocolError } from '../protocolError';
+import type { RegisteredListener } from '../../utils';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { Protocol } from './protocol';
+import type { RecentLogsCollector } from '../../utils/debugLogger';
+import type { ProtocolLogger } from '../types';
+
+
export const ConnectionEvents = {
Disconnected: Symbol('ConnectionEvents.Disconnected')
};
diff --git a/packages/playwright-core/src/server/chromium/crCoverage.ts b/packages/playwright-core/src/server/chromium/crCoverage.ts
index ccb9b40ae0..81dd2c0f4c 100644
--- a/packages/playwright-core/src/server/chromium/crCoverage.ts
+++ b/packages/playwright-core/src/server/chromium/crCoverage.ts
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-import type { CRSession } from './crConnection';
-import type { RegisteredListener } from '../../utils/eventsHelper';
+import { assert } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
+
+import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
import type * as channels from '@protocol/channels';
-import { assert } from '../../utils';
+
export class CRCoverage {
private _jsCoverage: JSCoverage;
diff --git a/packages/playwright-core/src/server/chromium/crDevTools.ts b/packages/playwright-core/src/server/chromium/crDevTools.ts
index 40cd134bcc..f6e6774416 100644
--- a/packages/playwright-core/src/server/chromium/crDevTools.ts
+++ b/packages/playwright-core/src/server/chromium/crDevTools.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import fs from 'fs';
+import * as fs from 'fs';
+
import type { CRSession } from './crConnection';
const kBindingName = '__pw_devtools__';
diff --git a/packages/playwright-core/src/server/chromium/crDragDrop.ts b/packages/playwright-core/src/server/chromium/crDragDrop.ts
index ea4af1ce7e..f94a306701 100644
--- a/packages/playwright-core/src/server/chromium/crDragDrop.ts
+++ b/packages/playwright-core/src/server/chromium/crDragDrop.ts
@@ -13,11 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import { toModifiersMask } from './crProtocolHelper';
+import { assert } from '../../utils';
+
import type { CRPage } from './crPage';
import type * as types from '../types';
-import { assert } from '../../utils';
import type { Protocol } from './protocol';
-import { toModifiersMask } from './crProtocolHelper';
+
declare global {
interface Window {
diff --git a/packages/playwright-core/src/server/chromium/crExecutionContext.ts b/packages/playwright-core/src/server/chromium/crExecutionContext.ts
index 661d216fb4..bd1b64099b 100644
--- a/packages/playwright-core/src/server/chromium/crExecutionContext.ts
+++ b/packages/playwright-core/src/server/chromium/crExecutionContext.ts
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-import type { CRSession } from './crConnection';
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
-import type { Protocol } from './protocol';
-import * as js from '../javascript';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
+import * as js from '../javascript';
import { isSessionClosedError } from '../protocolError';
+import type { CRSession } from './crConnection';
+import type { Protocol } from './protocol';
+
export class CRExecutionContext implements js.ExecutionContextDelegate {
_client: CRSession;
_contextId: number;
diff --git a/packages/playwright-core/src/server/chromium/crInput.ts b/packages/playwright-core/src/server/chromium/crInput.ts
index e08f3b0233..60c7130425 100644
--- a/packages/playwright-core/src/server/chromium/crInput.ts
+++ b/packages/playwright-core/src/server/chromium/crInput.ts
@@ -15,14 +15,16 @@
* limitations under the License.
*/
+import { isString } from '../../utils';
import * as input from '../input';
+import { macEditingCommands } from '../macEditingCommands';
+import { toButtonsMask, toModifiersMask } from './crProtocolHelper';
+
import type * as types from '../types';
import type { CRSession } from './crConnection';
-import { macEditingCommands } from '../macEditingCommands';
-import { isString } from '../../utils';
import type { DragManager } from './crDragDrop';
import type { CRPage } from './crPage';
-import { toButtonsMask, toModifiersMask } from './crProtocolHelper';
+
export class RawKeyboardImpl implements input.RawKeyboard {
constructor(
diff --git a/packages/playwright-core/src/server/chromium/crNetworkManager.ts b/packages/playwright-core/src/server/chromium/crNetworkManager.ts
index a8ff5a08dc..b9a5447189 100644
--- a/packages/playwright-core/src/server/chromium/crNetworkManager.ts
+++ b/packages/playwright-core/src/server/chromium/crNetworkManager.ts
@@ -15,20 +15,22 @@
* limitations under the License.
*/
-import type { CRSession } from './crConnection';
-import type { Page } from '../page';
-import { helper } from '../helper';
-import type { RegisteredListener } from '../../utils/eventsHelper';
+import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
-import type { Protocol } from './protocol';
+import { helper } from '../helper';
import * as network from '../network';
+import { isProtocolError, isSessionClosedError } from '../protocolError';
+
+import type { CRSession } from './crConnection';
+import type { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
import type * as contexts from '../browserContext';
import type * as frames from '../frames';
+import type { Page } from '../page';
import type * as types from '../types';
import type { CRPage } from './crPage';
-import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
import type { CRServiceWorker } from './crServiceWorker';
-import { isProtocolError, isSessionClosedError } from '../protocolError';
+
type SessionInfo = {
session: CRSession;
diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts
index 9fb43b2d51..65122407a0 100644
--- a/packages/playwright-core/src/server/chromium/crPage.ts
+++ b/packages/playwright-core/src/server/chromium/crPage.ts
@@ -15,25 +15,21 @@
* limitations under the License.
*/
-import path from 'path';
-import type { RegisteredListener } from '../../utils/eventsHelper';
+import * as path from 'path';
+
+import { assert, createGuid } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
-import { registry } from '../registry';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { assert, createGuid } from '../../utils';
import * as dialog from '../dialog';
import * as dom from '../dom';
import * as frames from '../frames';
import { helper } from '../helper';
import * as network from '../network';
-import { type InitScript, PageBinding, type PageDelegate } from '../page';
+import { PageBinding } from '../page';
import { Page, Worker } from '../page';
-import type { Progress } from '../progress';
-import type * as types from '../types';
-import type * as channels from '@protocol/channels';
+import { registry } from '../registry';
import { getAccessibilityTree } from './crAccessibility';
import { CRBrowserContext } from './crBrowser';
-import type { CRSession } from './crConnection';
import { CRCoverage } from './crCoverage';
import { DragManager } from './crDragDrop';
import { CRExecutionContext } from './crExecutionContext';
@@ -42,12 +38,19 @@ import { CRNetworkManager } from './crNetworkManager';
import { CRPDF } from './crPdf';
import { exceptionToError, releaseObject, toConsoleMessageLocation } from './crProtocolHelper';
import { platformToFontFamilies } from './defaultFontFamilies';
-import type { Protocol } from './protocol';
import { VideoRecorder } from './videoRecorder';
import { BrowserContext } from '../browserContext';
import { TargetClosedError } from '../errors';
import { isSessionClosedError } from '../protocolError';
+import type { CRSession } from './crConnection';
+import type { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type { InitScript, PageDelegate } from '../page';
+import type { Progress } from '../progress';
+import type * as types from '../types';
+import type * as channels from '@protocol/channels';
+
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
export type WindowBounds = { top?: number, left?: number, width?: number, height?: number };
diff --git a/packages/playwright-core/src/server/chromium/crPdf.ts b/packages/playwright-core/src/server/chromium/crPdf.ts
index 8dae2d1fa1..70d11208b9 100644
--- a/packages/playwright-core/src/server/chromium/crPdf.ts
+++ b/packages/playwright-core/src/server/chromium/crPdf.ts
@@ -15,10 +15,11 @@
* limitations under the License.
*/
+import { readProtocolStream } from './crProtocolHelper';
import { assert } from '../../utils';
-import type * as channels from '@protocol/channels';
+
import type { CRSession } from './crConnection';
-import { readProtocolStream } from './crProtocolHelper';
+import type * as channels from '@protocol/channels';
const PagePaperFormats: { [key: string]: { width: number, height: number }} = {
letter: { width: 8.5, height: 11 },
diff --git a/packages/playwright-core/src/server/chromium/crProtocolHelper.ts b/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
index 9458bed124..4852626b93 100644
--- a/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
+++ b/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
@@ -15,12 +15,15 @@
* limitations under the License.
*/
+import * as fs from 'fs';
+
+import { mkdirIfNeeded } from '../../utils/fileUtils';
+import { splitErrorMessage } from '../../utils/stackTrace';
+
import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
-import fs from 'fs';
import type * as types from '../types';
-import { mkdirIfNeeded } from '../../utils/fileUtils';
-import { splitErrorMessage } from '../../utils/stackTrace';
+
export function getExceptionMessage(exceptionDetails: Protocol.Runtime.ExceptionDetails): string {
if (exceptionDetails.exception)
diff --git a/packages/playwright-core/src/server/chromium/crServiceWorker.ts b/packages/playwright-core/src/server/chromium/crServiceWorker.ts
index 730504866b..deb858cfa2 100644
--- a/packages/playwright-core/src/server/chromium/crServiceWorker.ts
+++ b/packages/playwright-core/src/server/chromium/crServiceWorker.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
import { Worker } from '../page';
-import type { CRBrowserContext } from './crBrowser';
-import type { CRSession } from './crConnection';
import { CRExecutionContext } from './crExecutionContext';
import { CRNetworkManager } from './crNetworkManager';
-import * as network from '../network';
import { BrowserContext } from '../browserContext';
+import * as network from '../network';
+
+import type { CRBrowserContext } from './crBrowser';
+import type { CRSession } from './crConnection';
export class CRServiceWorker extends Worker {
readonly _browserContext: CRBrowserContext;
diff --git a/packages/playwright-core/src/server/chromium/videoRecorder.ts b/packages/playwright-core/src/server/chromium/videoRecorder.ts
index 68bfbea037..e8f96e4129 100644
--- a/packages/playwright-core/src/server/chromium/videoRecorder.ts
+++ b/packages/playwright-core/src/server/chromium/videoRecorder.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-import type { ChildProcess } from 'child_process';
import { assert, monotonicTime } from '../../utils';
-import { Page } from '../page';
import { launchProcess } from '../../utils/processLauncher';
-import type { Progress } from '../progress';
-import { ProgressController } from '../progress';
import { serverSideCallMetadata } from '../instrumentation';
+import { Page } from '../page';
+import { ProgressController } from '../progress';
+
+import type { Progress } from '../progress';
import type * as types from '../types';
+import type { ChildProcess } from 'child_process';
const fps = 25;
diff --git a/packages/playwright-core/src/server/clock.ts b/packages/playwright-core/src/server/clock.ts
index e77399c4fe..59cc05c208 100644
--- a/packages/playwright-core/src/server/clock.ts
+++ b/packages/playwright-core/src/server/clock.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { BrowserContext } from './browserContext';
import * as clockSource from '../generated/clockSource';
+import type { BrowserContext } from './browserContext';
+
export class Clock {
private _browserContext: BrowserContext;
private _scriptInstalled = false;
diff --git a/packages/playwright-core/src/server/codegen/csharp.ts b/packages/playwright-core/src/server/codegen/csharp.ts
index 548a06343a..9fd67fa96c 100644
--- a/packages/playwright-core/src/server/codegen/csharp.ts
+++ b/packages/playwright-core/src/server/codegen/csharp.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { BrowserContextOptions } from '../../../types/types';
-import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
-import type * as actions from '@recorder/actions';
import { sanitizeDeviceOptions, toClickOptionsForSourceCode, toKeyboardModifiers, toSignalMap } from './language';
-import { escapeWithQuotes, asLocator } from '../../utils';
+import { asLocator, escapeWithQuotes } from '../../utils';
import { deviceDescriptors } from '../deviceDescriptors';
+import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type { BrowserContextOptions } from '../../../types/types';
+import type * as actions from '@recorder/actions';
+
type CSharpLanguageMode = 'library' | 'mstest' | 'nunit';
export class CSharpLanguageGenerator implements LanguageGenerator {
diff --git a/packages/playwright-core/src/server/codegen/java.ts b/packages/playwright-core/src/server/codegen/java.ts
index ac04783c23..42456eb4a9 100644
--- a/packages/playwright-core/src/server/codegen/java.ts
+++ b/packages/playwright-core/src/server/codegen/java.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-import type { BrowserContextOptions } from '../../../types/types';
-import type * as types from '../types';
-import type * as actions from '@recorder/actions';
-import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
import { toClickOptionsForSourceCode, toKeyboardModifiers, toSignalMap } from './language';
import { deviceDescriptors } from '../deviceDescriptors';
import { JavaScriptFormatter } from './javascript';
-import { escapeWithQuotes, asLocator } from '../../utils';
+import { asLocator, escapeWithQuotes } from '../../utils';
+
+import type { BrowserContextOptions } from '../../../types/types';
+import type * as types from '../types';
+import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type * as actions from '@recorder/actions';
type JavaLanguageMode = 'library' | 'junit';
diff --git a/packages/playwright-core/src/server/codegen/javascript.ts b/packages/playwright-core/src/server/codegen/javascript.ts
index 80cb10926b..568f0a5113 100644
--- a/packages/playwright-core/src/server/codegen/javascript.ts
+++ b/packages/playwright-core/src/server/codegen/javascript.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import type { BrowserContextOptions } from '../../../types/types';
+import { sanitizeDeviceOptions, toClickOptionsForSourceCode, toKeyboardModifiers, toSignalMap } from './language';
+import { asLocator, escapeWithQuotes } from '../../utils';
+import { deviceDescriptors } from '../deviceDescriptors';
+
import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type { BrowserContextOptions } from '../../../types/types';
import type * as actions from '@recorder/actions';
-import { sanitizeDeviceOptions, toSignalMap, toKeyboardModifiers, toClickOptionsForSourceCode } from './language';
-import { deviceDescriptors } from '../deviceDescriptors';
-import { escapeWithQuotes, asLocator } from '../../utils';
export class JavaScriptLanguageGenerator implements LanguageGenerator {
id: string;
diff --git a/packages/playwright-core/src/server/codegen/jsonl.ts b/packages/playwright-core/src/server/codegen/jsonl.ts
index e6769cd8d7..9457c45f4c 100644
--- a/packages/playwright-core/src/server/codegen/jsonl.ts
+++ b/packages/playwright-core/src/server/codegen/jsonl.ts
@@ -15,8 +15,9 @@
*/
import { asLocator } from '../../utils';
-import type * as actions from '@recorder/actions';
+
import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type * as actions from '@recorder/actions';
export class JsonlLanguageGenerator implements LanguageGenerator {
id = 'jsonl';
diff --git a/packages/playwright-core/src/server/codegen/language.ts b/packages/playwright-core/src/server/codegen/language.ts
index b38959b89b..9eba5e6725 100644
--- a/packages/playwright-core/src/server/codegen/language.ts
+++ b/packages/playwright-core/src/server/codegen/language.ts
@@ -15,9 +15,9 @@
*/
import type { BrowserContextOptions } from '../../..';
-import type * as actions from '@recorder/actions';
import type * as types from '../types';
import type { LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type * as actions from '@recorder/actions';
export function generateCode(actions: actions.ActionInContext[], languageGenerator: LanguageGenerator, options: LanguageGeneratorOptions) {
const header = languageGenerator.generateHeader(options);
diff --git a/packages/playwright-core/src/server/codegen/languages.ts b/packages/playwright-core/src/server/codegen/languages.ts
index d379be6be7..0a17208835 100644
--- a/packages/playwright-core/src/server/codegen/languages.ts
+++ b/packages/playwright-core/src/server/codegen/languages.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
+import { CSharpLanguageGenerator } from './csharp';
import { JavaLanguageGenerator } from './java';
import { JavaScriptLanguageGenerator } from './javascript';
import { JsonlLanguageGenerator } from './jsonl';
-import { CSharpLanguageGenerator } from './csharp';
import { PythonLanguageGenerator } from './python';
export function languageSet() {
diff --git a/packages/playwright-core/src/server/codegen/python.ts b/packages/playwright-core/src/server/codegen/python.ts
index 714265a25c..d7b056f083 100644
--- a/packages/playwright-core/src/server/codegen/python.ts
+++ b/packages/playwright-core/src/server/codegen/python.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import type { BrowserContextOptions } from '../../../types/types';
+import { sanitizeDeviceOptions, toClickOptionsForSourceCode, toKeyboardModifiers, toSignalMap } from './language';
+import { asLocator, escapeWithQuotes, toSnakeCase } from '../../utils';
+import { deviceDescriptors } from '../deviceDescriptors';
+
import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './types';
+import type { BrowserContextOptions } from '../../../types/types';
import type * as actions from '@recorder/actions';
-import { sanitizeDeviceOptions, toSignalMap, toKeyboardModifiers, toClickOptionsForSourceCode } from './language';
-import { escapeWithQuotes, toSnakeCase, asLocator } from '../../utils';
-import { deviceDescriptors } from '../deviceDescriptors';
export class PythonLanguageGenerator implements LanguageGenerator {
id: string;
diff --git a/packages/playwright-core/src/server/codegen/types.ts b/packages/playwright-core/src/server/codegen/types.ts
index 81cd59948b..da3583e2f6 100644
--- a/packages/playwright-core/src/server/codegen/types.ts
+++ b/packages/playwright-core/src/server/codegen/types.ts
@@ -15,8 +15,8 @@
*/
import type { BrowserContextOptions, LaunchOptions } from '../../../types/types';
-import type * as actions from '@recorder/actions';
import type { Language } from '../../utils';
+import type * as actions from '@recorder/actions';
export type { Language } from '../../utils';
export type LanguageGeneratorOptions = {
diff --git a/packages/playwright-core/src/server/console.ts b/packages/playwright-core/src/server/console.ts
index e1faa7fb8f..383b49fc82 100644
--- a/packages/playwright-core/src/server/console.ts
+++ b/packages/playwright-core/src/server/console.ts
@@ -15,8 +15,8 @@
*/
import type * as js from './javascript';
-import type { ConsoleMessageLocation } from './types';
import type { Page } from './page';
+import type { ConsoleMessageLocation } from './types';
export class ConsoleMessage {
private _type: string;
diff --git a/packages/playwright-core/src/server/cookieStore.ts b/packages/playwright-core/src/server/cookieStore.ts
index d1842660c7..34ebc72874 100644
--- a/packages/playwright-core/src/server/cookieStore.ts
+++ b/packages/playwright-core/src/server/cookieStore.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { kMaxCookieExpiresDateInSeconds } from './network';
+import type * as channels from '@protocol/channels';
+
class Cookie {
private _raw: channels.NetworkCookie;
constructor(data: channels.NetworkCookie) {
diff --git a/packages/playwright-core/src/server/debugController.ts b/packages/playwright-core/src/server/debugController.ts
index 468b550f48..601a8338b9 100644
--- a/packages/playwright-core/src/server/debugController.ts
+++ b/packages/playwright-core/src/server/debugController.ts
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-import type { ElementInfo, Mode, Source } from '@recorder/recorderTypes';
+import { SdkObject, createInstrumentation, serverSideCallMetadata } from './instrumentation';
+import { Recorder } from './recorder';
+import { asLocator } from '../utils';
+import { parseAriaSnapshotUnsafe } from '../utils/isomorphic/ariaSnapshot';
+import { yaml } from '../utilsBundle';
+import { EmptyRecorderApp } from './recorder/recorderApp';
+import { unsafeLocatorOrSelectorAsSelector } from '../utils/isomorphic/locatorParser';
import { gracefullyProcessExitDoNotHang } from '../utils/processLauncher';
+
+import type { Language } from '../utils';
import type { Browser } from './browser';
import type { BrowserContext } from './browserContext';
-import { createInstrumentation, SdkObject, serverSideCallMetadata } from './instrumentation';
import type { InstrumentationListener } from './instrumentation';
import type { Playwright } from './playwright';
-import { Recorder } from './recorder';
-import { EmptyRecorderApp } from './recorder/recorderApp';
-import { asLocator, type Language } from '../utils';
-import { yaml } from '../utilsBundle';
-import { unsafeLocatorOrSelectorAsSelector } from '../utils/isomorphic/locatorParser';
-import { parseAriaSnapshotUnsafe } from '../utils/isomorphic/ariaSnapshot';
+import type { ElementInfo, Mode, Source } from '@recorder/recorderTypes';
const internalMetadata = serverSideCallMetadata();
diff --git a/packages/playwright-core/src/server/debugger.ts b/packages/playwright-core/src/server/debugger.ts
index 53a96ba8f2..530a62843d 100644
--- a/packages/playwright-core/src/server/debugger.ts
+++ b/packages/playwright-core/src/server/debugger.ts
@@ -15,11 +15,13 @@
*/
import { EventEmitter } from 'events';
+
import { debugMode, isUnderTest, monotonicTime } from '../utils';
import { BrowserContext } from './browserContext';
-import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation';
import { commandsWithTracingSnapshots, pausesBeforeInputActions, slowMoActions } from '../protocol/debug';
+import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation';
+
const symbol = Symbol('Debugger');
export class Debugger extends EventEmitter implements InstrumentationListener {
diff --git a/packages/playwright-core/src/server/deviceDescriptors.ts b/packages/playwright-core/src/server/deviceDescriptors.ts
index b46789c0e5..c4ad1f73fa 100644
--- a/packages/playwright-core/src/server/deviceDescriptors.ts
+++ b/packages/playwright-core/src/server/deviceDescriptors.ts
@@ -15,8 +15,9 @@
* limitations under the License.
*/
+import deviceDescriptorsSource from './deviceDescriptorsSource.json';
+
import type { Devices } from './types';
-import deviceDescriptorsSource from './deviceDescriptorsSource.json';
export const deviceDescriptors = deviceDescriptorsSource as Devices;
diff --git a/packages/playwright-core/src/server/dialog.ts b/packages/playwright-core/src/server/dialog.ts
index f0793d43fb..38ec035384 100644
--- a/packages/playwright-core/src/server/dialog.ts
+++ b/packages/playwright-core/src/server/dialog.ts
@@ -16,9 +16,10 @@
*/
import { assert } from '../utils';
-import type { Page } from './page';
import { SdkObject } from './instrumentation';
+import type { Page } from './page';
+
type OnHandle = (accept: boolean, promptText?: string) => Promise<void>;
export type DialogType = 'alert' | 'beforeunload' | 'confirm' | 'prompt';
diff --git a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts
index 77f38c5558..c20670dd69 100644
--- a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { RootDispatcher } from './dispatcher';
+import { BrowserContextDispatcher } from './browserContextDispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
-import type { Android, SocketBackend } from '../android/android';
import { AndroidDevice } from '../android/android';
-import type * as channels from '@protocol/channels';
-import { BrowserContextDispatcher } from './browserContextDispatcher';
+
+import type { RootDispatcher } from './dispatcher';
+import type { Android, SocketBackend } from '../android/android';
import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export class AndroidDispatcher extends Dispatcher<Android, channels.AndroidChannel, RootDispatcher> implements channels.AndroidChannel {
_type_Android = true;
diff --git a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts
index 1996f11776..d43a846607 100644
--- a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts
@@ -14,14 +14,16 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
+import * as fs from 'fs';
+
import { Dispatcher, existingDispatcher } from './dispatcher';
-import type { DispatcherScope } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';
-import fs from 'fs';
import { mkdirIfNeeded } from '../../utils/fileUtils';
+
+import type { DispatcherScope } from './dispatcher';
import type { Artifact } from '../artifact';
import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactChannel, DispatcherScope> implements channels.ArtifactChannel {
_type_Artifact = true;
diff --git a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
index 9ee416ce85..3488964e8e 100644
--- a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
@@ -14,33 +14,35 @@
* limitations under the License.
*/
+import * as fs from 'fs';
+import * as path from 'path';
+
import { BrowserContext } from '../browserContext';
+import { ArtifactDispatcher } from './artifactDispatcher';
+import { CDPSessionDispatcher } from './cdpSessionDispatcher';
+import { DialogDispatcher } from './dialogDispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
-import type { DispatcherScope } from './dispatcher';
-import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
-import type { FrameDispatcher } from './frameDispatcher';
-import type * as channels from '@protocol/channels';
-import { RouteDispatcher, RequestDispatcher, ResponseDispatcher, APIRequestContextDispatcher } from './networkDispatchers';
+import { ElementHandleDispatcher } from './elementHandlerDispatcher';
+import { APIRequestContextDispatcher, RequestDispatcher, ResponseDispatcher, RouteDispatcher } from './networkDispatchers';
+import { BindingCallDispatcher, PageDispatcher, WorkerDispatcher } from './pageDispatcher';
import { CRBrowserContext } from '../chromium/crBrowser';
-import { CDPSessionDispatcher } from './cdpSessionDispatcher';
+import { serializeError } from '../errors';
import { Recorder } from '../recorder';
-import type { CallMetadata } from '../instrumentation';
-import { ArtifactDispatcher } from './artifactDispatcher';
-import type { Artifact } from '../artifact';
-import type { Request, Response } from '../network';
import { TracingDispatcher } from './tracingDispatcher';
-import * as fs from 'fs';
-import * as path from 'path';
-import { createGuid, urlMatches } from '../../utils';
+import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
import { WritableStreamDispatcher } from './writableStreamDispatcher';
-import { DialogDispatcher } from './dialogDispatcher';
-import type { Page } from '../page';
-import type { Dialog } from '../dialog';
-import type { ConsoleMessage } from '../console';
-import { serializeError } from '../errors';
-import { ElementHandleDispatcher } from './elementHandlerDispatcher';
+import { createGuid, urlMatches } from '../../utils';
import { RecorderApp } from '../recorder/recorderApp';
-import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
+
+import type { Artifact } from '../artifact';
+import type { ConsoleMessage } from '../console';
+import type { Dialog } from '../dialog';
+import type { CallMetadata } from '../instrumentation';
+import type { Request, Response } from '../network';
+import type { Page } from '../page';
+import type { DispatcherScope } from './dispatcher';
+import type { FrameDispatcher } from './frameDispatcher';
+import type * as channels from '@protocol/channels';
export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channels.BrowserContextChannel, DispatcherScope> implements channels.BrowserContextChannel {
_type_EventTarget = true;
diff --git a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts
index 99ce5f961f..60682b366b 100644
--- a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts
@@ -15,20 +15,21 @@
*/
import { Browser } from '../browser';
-import type * as channels from '@protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { existingDispatcher } from './dispatcher';
-import type { RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
-import type { CRBrowser } from '../chromium/crBrowser';
-import type { PageDispatcher } from './pageDispatcher';
-import type { CallMetadata } from '../instrumentation';
import { BrowserContext } from '../browserContext';
import { Selectors } from '../selectors';
-import type { BrowserTypeDispatcher } from './browserTypeDispatcher';
import { ArtifactDispatcher } from './artifactDispatcher';
+import type { BrowserTypeDispatcher } from './browserTypeDispatcher';
+import type { RootDispatcher } from './dispatcher';
+import type { PageDispatcher } from './pageDispatcher';
+import type { CRBrowser } from '../chromium/crBrowser';
+import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
+
export class BrowserDispatcher extends Dispatcher<Browser, channels.BrowserChannel, BrowserTypeDispatcher> implements channels.BrowserChannel {
_type_Browser = true;
diff --git a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts
index bf7ccd518f..bf21e726bc 100644
--- a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { BrowserType } from '../browserType';
+import { BrowserContextDispatcher } from './browserContextDispatcher';
import { BrowserDispatcher } from './browserDispatcher';
-import type * as channels from '@protocol/channels';
-import type { RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
-import { BrowserContextDispatcher } from './browserContextDispatcher';
+
+import type { BrowserType } from '../browserType';
+import type { RootDispatcher } from './dispatcher';
import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export class BrowserTypeDispatcher extends Dispatcher<BrowserType, channels.BrowserTypeChannel, RootDispatcher> implements channels.BrowserTypeChannel {
_type_BrowserType = true;
diff --git a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts
index 33fa19f5e7..8263870039 100644
--- a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import { CDPSession } from '../chromium/crConnection';
-import type * as channels from '@protocol/channels';
import { Dispatcher } from './dispatcher';
-import type { BrowserDispatcher } from './browserDispatcher';
+import { CDPSession } from '../chromium/crConnection';
+
import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type { BrowserDispatcher } from './browserDispatcher';
import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export class CDPSessionDispatcher extends Dispatcher<CDPSession, channels.CDPSessionChannel, BrowserDispatcher | BrowserContextDispatcher> implements channels.CDPSessionChannel {
_type_CDPSession = true;
diff --git a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts
index fc722d1bd3..a3acb24bd1 100644
--- a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { eventsHelper } from '../../utils';
-import type { RegisteredListener } from '../../utils/eventsHelper';
import { DebugController } from '../debugController';
-import type { DispatcherConnection, RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
+import type { DispatcherConnection, RootDispatcher } from './dispatcher';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type * as channels from '@protocol/channels';
+
+
export class DebugControllerDispatcher extends Dispatcher<DebugController, channels.DebugControllerChannel, RootDispatcher> implements channels.DebugControllerChannel {
_type_DebugController;
private _listeners: RegisteredListener[];
diff --git a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts
index 50ff01f108..b86872b133 100644
--- a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { Dialog } from '../dialog';
-import type * as channels from '@protocol/channels';
import { Dispatcher } from './dispatcher';
import { PageDispatcher } from './pageDispatcher';
+
+import type { Dialog } from '../dialog';
import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type * as channels from '@protocol/channels';
export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogChannel, BrowserContextDispatcher | PageDispatcher> implements channels.DialogChannel {
_type_Dialog = true;
diff --git a/packages/playwright-core/src/server/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.ts
index ce63891f4f..34f2614e08 100644
--- a/packages/playwright-core/src/server/dispatchers/dispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts
@@ -15,16 +15,19 @@
*/
import { EventEmitter } from 'events';
-import type * as channels from '@protocol/channels';
-import { findValidator, ValidationError, createMetadataValidator, type ValidatorContext } from '../../protocol/validator';
+
+import { eventsHelper } from '../..//utils/eventsHelper';
+import { ValidationError, createMetadataValidator, findValidator } from '../../protocol/validator';
import { LongStandingScope, assert, compressCallLog, isUnderTest, monotonicTime, rewriteErrorMessage } from '../../utils';
import { TargetClosedError, isTargetClosedError, serializeError } from '../errors';
-import type { CallMetadata } from '../instrumentation';
import { SdkObject } from '../instrumentation';
+import { isProtocolError } from '../protocolError';
+
+import type { CallMetadata } from '../instrumentation';
import type { PlaywrightDispatcher } from './playwrightDispatcher';
-import { eventsHelper } from '../..//utils/eventsHelper';
import type { RegisteredListener } from '../..//utils/eventsHelper';
-import { isProtocolError } from '../protocolError';
+import type { ValidatorContext } from '../../protocol/validator';
+import type * as channels from '@protocol/channels';
export const dispatcherSymbol = Symbol('dispatcher');
const metadataValidator = createMetadataValidator();
diff --git a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts
index a4e28da26f..57b0b3bb14 100644
--- a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts
@@ -14,16 +14,18 @@
* limitations under the License.
*/
-import type { RootDispatcher } from './dispatcher';
+import { BrowserContextDispatcher } from './browserContextDispatcher';
import { Dispatcher } from './dispatcher';
-import type { Electron } from '../electron/electron';
+import { ElementHandleDispatcher } from './elementHandlerDispatcher';
+import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { ElectronApplication } from '../electron/electron';
-import type * as channels from '@protocol/channels';
-import { BrowserContextDispatcher } from './browserContextDispatcher';
+
+import type { RootDispatcher } from './dispatcher';
import type { PageDispatcher } from './pageDispatcher';
import type { ConsoleMessage } from '../console';
-import { parseArgument, serializeResult } from './jsHandleDispatcher';
-import { ElementHandleDispatcher } from './elementHandlerDispatcher';
+import type { Electron } from '../electron/electron';
+import type * as channels from '@protocol/channels';
+
export class ElectronDispatcher extends Dispatcher<Electron, channels.ElectronChannel, RootDispatcher> implements channels.ElectronChannel {
_type_Electron = true;
diff --git a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts
index 8a6e4fcbaa..9a398fb351 100644
--- a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts
@@ -14,17 +14,19 @@
* limitations under the License.
*/
+import { BrowserContextDispatcher } from './browserContextDispatcher';
+import { existingDispatcher } from './dispatcher';
+import { FrameDispatcher } from './frameDispatcher';
+import { JSHandleDispatcher, parseArgument, serializeResult } from './jsHandleDispatcher';
+import { PageDispatcher, WorkerDispatcher } from './pageDispatcher';
+
import type { ElementHandle } from '../dom';
import type { Frame } from '../frames';
+import type { CallMetadata } from '../instrumentation';
import type * as js from '../javascript';
-import type * as channels from '@protocol/channels';
-import { existingDispatcher } from './dispatcher';
-import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';
import type { JSHandleDispatcherParentScope } from './jsHandleDispatcher';
-import { FrameDispatcher } from './frameDispatcher';
-import type { CallMetadata } from '../instrumentation';
-import { BrowserContextDispatcher } from './browserContextDispatcher';
-import { PageDispatcher, WorkerDispatcher } from './pageDispatcher';
+import type * as channels from '@protocol/channels';
+
export class ElementHandleDispatcher extends JSHandleDispatcher implements channels.ElementHandleChannel {
_type_ElementHandle = true;
diff --git a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts
index 3426389a9c..7e99511d33 100644
--- a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-import type { NavigationEvent } from '../frames';
import { Frame } from '../frames';
-import type * as channels from '@protocol/channels';
import { Dispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { ResponseDispatcher } from './networkDispatchers';
import { RequestDispatcher } from './networkDispatchers';
-import type { CallMetadata } from '../instrumentation';
-import type { BrowserContextDispatcher } from './browserContextDispatcher';
-import type { PageDispatcher } from './pageDispatcher';
import { debugAssert } from '../../utils';
import { parseAriaSnapshotUnsafe } from '../../utils/isomorphic/ariaSnapshot';
import { yaml } from '../../utilsBundle';
+import type { CallMetadata } from '../instrumentation';
+import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type { PageDispatcher } from './pageDispatcher';
+import type { NavigationEvent } from '../frames';
+import type * as channels from '@protocol/channels';
+
export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, BrowserContextDispatcher | PageDispatcher> implements channels.FrameChannel {
_type_Frame = true;
private _frame: Frame;
diff --git a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts
index 33960e72d5..cf492f39b7 100644
--- a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-import type * as js from '../javascript';
-import type * as channels from '@protocol/channels';
import { Dispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseSerializedValue, serializeValue } from '../../protocol/serializers';
-import type { PageDispatcher, WorkerDispatcher } from './pageDispatcher';
+
+import type * as js from '../javascript';
import type { ElectronApplicationDispatcher } from './electronDispatcher';
import type { FrameDispatcher } from './frameDispatcher';
+import type { PageDispatcher, WorkerDispatcher } from './pageDispatcher';
import type { CallMetadata } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export type JSHandleDispatcherParentScope = PageDispatcher | FrameDispatcher | WorkerDispatcher | ElectronApplicationDispatcher;
diff --git a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts
index dead26993f..67f36e94a1 100644
--- a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { Dispatcher } from './dispatcher';
import { createGuid } from '../../utils';
+
import type { LocalUtilsDispatcher } from './localUtilsDispatcher';
+import type * as channels from '@protocol/channels';
export class JsonPipeDispatcher extends Dispatcher<{ guid: string }, channels.JsonPipeChannel, LocalUtilsDispatcher> implements channels.JsonPipeChannel {
_type_JsonPipe = true;
diff --git a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts
index b6f8fe80ac..d65e3a5775 100644
--- a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts
@@ -14,33 +14,35 @@
* limitations under the License.
*/
-import type EventEmitter from 'events';
-import fs from 'fs';
-import path from 'path';
-import os from 'os';
-import type * as channels from '@protocol/channels';
-import { ManualPromise } from '../../utils/manualPromise';
-import { assert, calculateSha1, createGuid, removeFolders } from '../../utils';
-import type { RootDispatcher } from './dispatcher';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
import { Dispatcher } from './dispatcher';
-import { yazl, yauzl } from '../../zipBundle';
+import { SdkObject } from '../../server/instrumentation';
+import { assert, calculateSha1, createGuid, removeFolders } from '../../utils';
+import { serializeClientSideCallMetadata } from '../../utils';
+import { ManualPromise } from '../../utils/manualPromise';
+import { fetchData } from '../../utils/network';
+import { getUserAgent } from '../../utils/userAgent';
import { ZipFile } from '../../utils/zipFile';
-import type * as har from '@trace/har';
-import type { HeadersArray } from '../types';
+import { yauzl, yazl } from '../../zipBundle';
+import { deviceDescriptors as descriptors } from '../deviceDescriptors';
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
-import { WebSocketTransport } from '../transport';
+import { ProgressController } from '../progress';
import { SocksInterceptor } from '../socksInterceptor';
+import { WebSocketTransport } from '../transport';
+
+import type { HTTPRequestParams } from '../../utils/network';
import type { CallMetadata } from '../instrumentation';
-import { getUserAgent } from '../../utils/userAgent';
+import type { Playwright } from '../playwright';
import type { Progress } from '../progress';
-import { ProgressController } from '../progress';
-import { fetchData } from '../../utils/network';
-import type { HTTPRequestParams } from '../../utils/network';
+import type { HeadersArray } from '../types';
+import type { RootDispatcher } from './dispatcher';
+import type * as channels from '@protocol/channels';
+import type * as har from '@trace/har';
+import type EventEmitter from 'events';
import type http from 'http';
-import type { Playwright } from '../playwright';
-import { SdkObject } from '../../server/instrumentation';
-import { serializeClientSideCallMetadata } from '../../utils';
-import { deviceDescriptors as descriptors } from '../deviceDescriptors';
export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.LocalUtilsChannel, RootDispatcher> implements channels.LocalUtilsChannel {
_type_LocalUtils: boolean;
diff --git a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts
index 6c2468176a..c6c783f390 100644
--- a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts
+++ b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts
@@ -14,18 +14,20 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { APIRequestContext } from '../fetch';
-import type { CallMetadata } from '../instrumentation';
-import type { Request, Response, Route } from '../network';
import { WebSocket } from '../network';
-import type { RootDispatcher } from './dispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
+import { FrameDispatcher } from './frameDispatcher';
+import { WorkerDispatcher } from './pageDispatcher';
import { TracingDispatcher } from './tracingDispatcher';
+
+import type { APIRequestContext } from '../fetch';
+import type { CallMetadata } from '../instrumentation';
+import type { Request, Response, Route } from '../network';
import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type { RootDispatcher } from './dispatcher';
import type { PageDispatcher } from './pageDispatcher';
-import { FrameDispatcher } from './frameDispatcher';
-import { WorkerDispatcher } from './pageDispatcher';
+import type * as channels from '@protocol/channels';
+
export class RequestDispatcher extends Dispatcher<Request, channels.RequestChannel, BrowserContextDispatcher | PageDispatcher | FrameDispatcher> implements channels.RequestChannel {
_type_Request: boolean;
diff --git a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts
index db8dfb4404..1b8a0677dd 100644
--- a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts
@@ -14,28 +14,29 @@
* limitations under the License.
*/
-import type { BrowserContext } from '../browserContext';
-import type { Frame } from '../frames';
import { Page, Worker } from '../page';
-import type * as channels from '@protocol/channels';
import { Dispatcher, existingDispatcher } from './dispatcher';
import { parseError } from '../errors';
+import { ArtifactDispatcher } from './artifactDispatcher';
+import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { FrameDispatcher } from './frameDispatcher';
+import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { RequestDispatcher } from './networkDispatchers';
import { ResponseDispatcher } from './networkDispatchers';
import { RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
-import { serializeResult, parseArgument } from './jsHandleDispatcher';
-import { ElementHandleDispatcher } from './elementHandlerDispatcher';
-import type { FileChooser } from '../fileChooser';
-import type { CRCoverage } from '../chromium/crCoverage';
-import type { JSHandle } from '../javascript';
-import type { CallMetadata } from '../instrumentation';
+import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
+import { createGuid, urlMatches } from '../../utils';
+
import type { Artifact } from '../artifact';
-import { ArtifactDispatcher } from './artifactDispatcher';
+import type { BrowserContext } from '../browserContext';
+import type { CRCoverage } from '../chromium/crCoverage';
import type { Download } from '../download';
-import { createGuid, urlMatches } from '../../utils';
+import type { FileChooser } from '../fileChooser';
+import type { CallMetadata } from '../instrumentation';
+import type { JSHandle } from '../javascript';
import type { BrowserContextDispatcher } from './browserContextDispatcher';
-import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
+import type { Frame } from '../frames';
+import type * as channels from '@protocol/channels';
export class PageDispatcher extends Dispatcher<Page, channels.PageChannel, BrowserContextDispatcher> implements channels.PageChannel {
_type_EventTarget = true;
diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
index c411f93198..d8c2081981 100644
--- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
@@ -14,25 +14,27 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { Browser } from '../browser';
-import { GlobalAPIRequestContext } from '../fetch';
-import type { Playwright } from '../playwright';
-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../common/socksProxy';
import { SocksProxy } from '../../common/socksProxy';
+import { GlobalAPIRequestContext } from '../fetch';
import { AndroidDispatcher } from './androidDispatcher';
+import { AndroidDeviceDispatcher } from './androidDispatcher';
+import { ConnectedBrowserDispatcher } from './browserDispatcher';
import { BrowserTypeDispatcher } from './browserTypeDispatcher';
-import type { RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { ElectronDispatcher } from './electronDispatcher';
import { LocalUtilsDispatcher } from './localUtilsDispatcher';
import { APIRequestContextDispatcher } from './networkDispatchers';
import { SelectorsDispatcher } from './selectorsDispatcher';
-import { ConnectedBrowserDispatcher } from './browserDispatcher';
import { createGuid } from '../../utils';
+import { eventsHelper } from '../../utils/eventsHelper';
+
+import type { RootDispatcher } from './dispatcher';
+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../common/socksProxy';
+import type { RegisteredListener } from '../../utils/eventsHelper';
import type { AndroidDevice } from '../android/android';
-import { AndroidDeviceDispatcher } from './androidDispatcher';
-import { eventsHelper, type RegisteredListener } from '../../utils/eventsHelper';
+import type { Browser } from '../browser';
+import type { Playwright } from '../playwright';
+import type * as channels from '@protocol/channels';
export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.PlaywrightChannel, RootDispatcher> implements channels.PlaywrightChannel {
_type_Playwright;
diff --git a/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts
index 4582a8081d..d542f8ba2c 100644
--- a/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import type { RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
-import type * as channels from '@protocol/channels';
+
+import type { RootDispatcher } from './dispatcher';
import type { Selectors } from '../selectors';
+import type * as channels from '@protocol/channels';
export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsChannel, RootDispatcher> implements channels.SelectorsChannel {
_type_Selectors = true;
diff --git a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts
index 4a45468389..8ceb69e669 100644
--- a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import { Dispatcher } from './dispatcher';
-import type * as stream from 'stream';
import { ManualPromise, createGuid } from '../../utils';
+
import type { ArtifactDispatcher } from './artifactDispatcher';
+import type * as channels from '@protocol/channels';
+import type * as stream from 'stream';
export class StreamDispatcher extends Dispatcher<{ guid: string, stream: stream.Readable }, channels.StreamChannel, ArtifactDispatcher> implements channels.StreamChannel {
_type_Stream = true;
diff --git a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts
index 5555de15d1..096e50ca17 100644
--- a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { CallMetadata } from '@protocol/callMetadata';
-import type { Tracing } from '../trace/recorder/tracing';
import { ArtifactDispatcher } from './artifactDispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
+
import type { BrowserContextDispatcher } from './browserContextDispatcher';
import type { APIRequestContextDispatcher } from './networkDispatchers';
+import type { Tracing } from '../trace/recorder/tracing';
+import type { CallMetadata } from '@protocol/callMetadata';
+import type * as channels from '@protocol/channels';
export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannel, BrowserContextDispatcher | APIRequestContextDispatcher> implements channels.TracingChannel {
_type_Tracing = true;
diff --git a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts
index bcbc89fe03..fea8d06eec 100644
--- a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts
@@ -14,18 +14,19 @@
* limitations under the License.
*/
-import type { BrowserContext } from '../browserContext';
-import type { Frame } from '../frames';
import { Page } from '../page';
-import type * as channels from '@protocol/channels';
import { Dispatcher, existingDispatcher } from './dispatcher';
-import { createGuid, urlMatches } from '../../utils';
import { PageDispatcher } from './pageDispatcher';
-import type { BrowserContextDispatcher } from './browserContextDispatcher';
import * as webSocketMockSource from '../../generated/webSocketMockSource';
-import type * as ws from '../injected/webSocketMock';
+import { createGuid, urlMatches } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
+import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type { BrowserContext } from '../browserContext';
+import type { Frame } from '../frames';
+import type * as ws from '../injected/webSocketMock';
+import type * as channels from '@protocol/channels';
+
export class WebSocketRouteDispatcher extends Dispatcher<{ guid: string }, channels.WebSocketRouteChannel, PageDispatcher | BrowserContextDispatcher> implements channels.WebSocketRouteChannel {
_type_WebSocketRoute = true;
private _id: string;
diff --git a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts
index 3e54e644d5..7d8ce2e4e1 100644
--- a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import { Dispatcher } from './dispatcher';
import * as fs from 'fs';
+
+import { Dispatcher } from './dispatcher';
import { createGuid } from '../../utils';
+
import type { BrowserContextDispatcher } from './browserContextDispatcher';
+import type * as channels from '@protocol/channels';
export class WritableStreamDispatcher extends Dispatcher<{ guid: string, streamOrDirectory: fs.WriteStream | string }, channels.WritableStreamChannel, BrowserContextDispatcher> implements channels.WritableStreamChannel {
_type_WritableStream = true;
diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.ts
index 288b8c2c8d..7bb1862645 100644
--- a/packages/playwright-core/src/server/dom.ts
+++ b/packages/playwright-core/src/server/dom.ts
@@ -14,22 +14,25 @@
* limitations under the License.
*/
-import fs from 'fs';
-import type * as channels from '@protocol/channels';
-import * as injectedScriptSource from '../generated/injectedScriptSource';
+import * as fs from 'fs';
+
+import * as js from './javascript';
+import { ProgressController } from './progress';
+import { asLocator, isUnderTest } from '../utils';
+import { prepareFilesForUpload } from './fileUploadUtils';
import { isSessionClosedError } from './protocolError';
-import type { ScreenshotOptions } from './screenshotter';
+import * as injectedScriptSource from '../generated/injectedScriptSource';
+
import type * as frames from './frames';
-import type { InjectedScript, HitTargetInterceptionResult, ElementState } from './injected/injectedScript';
+import type { ElementState, HitTargetInterceptionResult, InjectedScript } from './injected/injectedScript';
import type { CallMetadata } from './instrumentation';
-import * as js from './javascript';
import type { Page } from './page';
import type { Progress } from './progress';
-import { ProgressController } from './progress';
+import type { ScreenshotOptions } from './screenshotter';
import type * as types from './types';
import type { TimeoutOptions } from '../common/types';
-import { asLocator, isUnderTest } from '../utils';
-import { prepareFilesForUpload } from './fileUploadUtils';
+import type * as channels from '@protocol/channels';
+
export type InputFilesItems = {
filePayloads?: types.FilePayload[],
diff --git a/packages/playwright-core/src/server/download.ts b/packages/playwright-core/src/server/download.ts
index 78a9c015dc..85840b7ff2 100644
--- a/packages/playwright-core/src/server/download.ts
+++ b/packages/playwright-core/src/server/download.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import path from 'path';
+import * as path from 'path';
+
import { Page } from './page';
import { assert } from '../utils';
import { Artifact } from './artifact';
diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.ts
index 1606c407d5..565fce7fb1 100644
--- a/packages/playwright-core/src/server/electron/electron.ts
+++ b/packages/playwright-core/src/server/electron/electron.ts
@@ -14,39 +14,41 @@
* limitations under the License.
*/
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import type { CRBrowserContext } from '../chromium/crBrowser';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+import * as readline from 'readline';
+
+import { TimeoutSettings } from '../../common/timeoutSettings';
+import { ManualPromise, wrapInASCIIBox } from '../../utils';
+import { RecentLogsCollector } from '../../utils/debugLogger';
+import { eventsHelper } from '../../utils/eventsHelper';
+import { envArrayToObject, launchProcess } from '../../utils/processLauncher';
+import { validateBrowserContextOptions } from '../browserContext';
import { CRBrowser } from '../chromium/crBrowser';
-import type { CRSession } from '../chromium/crConnection';
import { CRConnection } from '../chromium/crConnection';
-import type { CRPage } from '../chromium/crPage';
import { CRExecutionContext } from '../chromium/crExecutionContext';
-import type { Protocol } from '../chromium/protocol';
+import { toConsoleMessageLocation } from '../chromium/crProtocolHelper';
+import { ConsoleMessage } from '../console';
+import { helper } from '../helper';
+import { SdkObject, serverSideCallMetadata } from '../instrumentation';
import * as js from '../javascript';
-import type { Page } from '../page';
-import { TimeoutSettings } from '../../common/timeoutSettings';
-import { ManualPromise, wrapInASCIIBox } from '../../utils';
+import { ProgressController } from '../progress';
import { WebSocketTransport } from '../transport';
-import { launchProcess, envArrayToObject } from '../../utils/processLauncher';
+
+import type { BrowserOptions, BrowserProcess } from '../browser';
import type { BrowserContext } from '../browserContext';
-import { validateBrowserContextOptions } from '../browserContext';
-import type { BrowserWindow } from 'electron';
+import type { CRBrowserContext } from '../chromium/crBrowser';
+import type { CRSession } from '../chromium/crConnection';
+import type { CRPage } from '../chromium/crPage';
+import type { Protocol } from '../chromium/protocol';
+import type { Page } from '../page';
+import type { Playwright } from '../playwright';
import type { Progress } from '../progress';
-import { ProgressController } from '../progress';
-import { helper } from '../helper';
import type * as types from '../types';
-import { eventsHelper } from '../../utils/eventsHelper';
-import type { BrowserOptions, BrowserProcess } from '../browser';
-import type { Playwright } from '../playwright';
-import type * as childProcess from 'child_process';
-import * as readline from 'readline';
-import { RecentLogsCollector } from '../../utils/debugLogger';
-import { serverSideCallMetadata, SdkObject } from '../instrumentation';
import type * as channels from '@protocol/channels';
-import { toConsoleMessageLocation } from '../chromium/crProtocolHelper';
-import { ConsoleMessage } from '../console';
+import type * as childProcess from 'child_process';
+import type { BrowserWindow } from 'electron';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
diff --git a/packages/playwright-core/src/server/electron/loader.ts b/packages/playwright-core/src/server/electron/loader.ts
index 98bd92d457..91f63095da 100644
--- a/packages/playwright-core/src/server/electron/loader.ts
+++ b/packages/playwright-core/src/server/electron/loader.ts
@@ -15,6 +15,7 @@
*/
const { app } = require('electron');
+
const { chromiumSwitches } = require('../chromium/chromiumSwitches');
// Always pass user arguments first, see https://github.com/microsoft/playwright/issues/16614 and
diff --git a/packages/playwright-core/src/server/errors.ts b/packages/playwright-core/src/server/errors.ts
index c3a63cb033..88fe8b4403 100644
--- a/packages/playwright-core/src/server/errors.ts
+++ b/packages/playwright-core/src/server/errors.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { SerializedError } from '@protocol/channels';
-import { isError } from '../utils';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
+import { isError } from '../utils';
+
+import type { SerializedError } from '@protocol/channels';
class CustomError extends Error {
constructor(message: string) {
diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.ts
index 778fbcee95..9210340c8c 100644
--- a/packages/playwright-core/src/server/fetch.ts
+++ b/packages/playwright-core/src/server/fetch.ts
@@ -14,34 +14,38 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { LookupAddress } from 'dns';
-import http from 'http';
-import https from 'https';
-import type { Readable, TransformCallback } from 'stream';
-import { pipeline, Transform } from 'stream';
-import url from 'url';
-import zlib from 'zlib';
-import type { HTTPCredentials } from '../../types/types';
+import * as http from 'http';
+import * as https from 'https';
+import { Transform, pipeline } from 'stream';
+import { TLSSocket } from 'tls';
+import * as url from 'url';
+import * as zlib from 'zlib';
+
import { TimeoutSettings } from '../common/timeoutSettings';
+import { assert, constructURLBasedOnBaseURL, createGuid, eventsHelper, monotonicTime } from '../utils';
import { getUserAgent } from '../utils/userAgent';
-import { assert, constructURLBasedOnBaseURL, createGuid, eventsHelper, monotonicTime, type RegisteredListener } from '../utils';
import { HttpsProxyAgent, SocksProxyAgent } from '../utilsBundle';
import { BrowserContext, verifyClientCertificates } from './browserContext';
import { CookieStore, domainMatches, parseRawCookie } from './cookieStore';
import { MultipartFormData } from './formData';
+import { SdkObject } from './instrumentation';
+import { ProgressController } from './progress';
+import { getMatchingTLSOptionsForOrigin, rewriteOpenSSLErrorIfNeeded } from './socksClientCertificatesInterceptor';
import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent, timingForSocket } from '../utils/happy-eyeballs';
+import { Tracing } from './trace/recorder/tracing';
+
import type { CallMetadata } from './instrumentation';
-import { SdkObject } from './instrumentation';
import type { Playwright } from './playwright';
import type { Progress } from './progress';
-import { ProgressController } from './progress';
-import { Tracing } from './trace/recorder/tracing';
import type * as types from './types';
import type { HeadersArray, ProxySettings } from './types';
-import { getMatchingTLSOptionsForOrigin, rewriteOpenSSLErrorIfNeeded } from './socksClientCertificatesInterceptor';
+import type { HTTPCredentials } from '../../types/types';
+import type { RegisteredListener } from '../utils';
+import type * as channels from '@protocol/channels';
import type * as har from '@trace/har';
-import { TLSSocket } from 'tls';
+import type { LookupAddress } from 'dns';
+import type { Readable, TransformCallback } from 'stream';
+
type FetchRequestOptions = {
userAgent: string;
diff --git a/packages/playwright-core/src/server/fileUploadUtils.ts b/packages/playwright-core/src/server/fileUploadUtils.ts
index 2696ba0116..9ec4e76ad3 100644
--- a/packages/playwright-core/src/server/fileUploadUtils.ts
+++ b/packages/playwright-core/src/server/fileUploadUtils.ts
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { assert, fileUploadSizeLimit } from '../utils';
import { mime } from '../utilsBundle';
+
import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispatcher';
import type { InputFilesItems } from './dom';
import type { Frame } from './frames';
import type * as types from './types';
+import type * as channels from '@protocol/channels';
async function filesExceedUploadLimit(files: string[]) {
const sizes = await Promise.all(files.map(async file => (await fs.promises.stat(file)).size));
diff --git a/packages/playwright-core/src/server/firefox/ffBrowser.ts b/packages/playwright-core/src/server/firefox/ffBrowser.ts
index 0bafecf12f..2320dcc77a 100644
--- a/packages/playwright-core/src/server/firefox/ffBrowser.ts
+++ b/packages/playwright-core/src/server/firefox/ffBrowser.ts
@@ -15,21 +15,23 @@
* limitations under the License.
*/
-import { TargetClosedError } from '../errors';
import { assert } from '../../utils';
-import type { BrowserOptions } from '../browser';
import { Browser } from '../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
+import { BrowserContext, assertBrowserContextIsNotOwned, verifyGeolocation } from '../browserContext';
+import { TargetClosedError } from '../errors';
import * as network from '../network';
-import type { InitScript, Page } from '../page';
import { PageBinding } from '../page';
+import { ConnectionEvents, FFConnection } from './ffConnection';
+import { FFPage } from './ffPage';
+
+import type { BrowserOptions } from '../browser';
+import type { SdkObject } from '../instrumentation';
+import type { InitScript, Page } from '../page';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
-import type * as channels from '@protocol/channels';
-import { ConnectionEvents, FFConnection, type FFSession } from './ffConnection';
-import { FFPage } from './ffPage';
+import type { FFSession } from './ffConnection';
import type { Protocol } from './protocol';
-import type { SdkObject } from '../instrumentation';
+import type * as channels from '@protocol/channels';
export class FFBrowser extends Browser {
private _connection: FFConnection;
diff --git a/packages/playwright-core/src/server/firefox/ffConnection.ts b/packages/playwright-core/src/server/firefox/ffConnection.ts
index 1a24e1dbf0..6001754219 100644
--- a/packages/playwright-core/src/server/firefox/ffConnection.ts
+++ b/packages/playwright-core/src/server/firefox/ffConnection.ts
@@ -16,13 +16,16 @@
*/
import { EventEmitter } from 'events';
+
+import { debugLogger } from '../../utils/debugLogger';
+import { helper } from '../helper';
+import { ProtocolError } from '../protocolError';
+
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import type { Protocol } from './protocol';
import type { RecentLogsCollector } from '../../utils/debugLogger';
-import { debugLogger } from '../../utils/debugLogger';
import type { ProtocolLogger } from '../types';
-import { helper } from '../helper';
-import { ProtocolError } from '../protocolError';
+
export const ConnectionEvents = {
Disconnected: Symbol('Disconnected'),
diff --git a/packages/playwright-core/src/server/firefox/ffExecutionContext.ts b/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
index c7a3f106f8..7de27727cd 100644
--- a/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
+++ b/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
@@ -15,13 +15,14 @@
* limitations under the License.
*/
-import * as js from '../javascript';
-import type { FFSession } from './ffConnection';
-import type { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
+import * as js from '../javascript';
import { isSessionClosedError } from '../protocolError';
+import type { FFSession } from './ffConnection';
+import type { Protocol } from './protocol';
+
export class FFExecutionContext implements js.ExecutionContextDelegate {
_session: FFSession;
_executionContextId: string;
diff --git a/packages/playwright-core/src/server/firefox/ffNetworkManager.ts b/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
index 73b8e3589f..95df0643d0 100644
--- a/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
+++ b/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
@@ -15,15 +15,16 @@
* limitations under the License.
*/
-import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
-import type { FFSession } from './ffConnection';
-import type { Page } from '../page';
import * as network from '../network';
+
+import type { FFSession } from './ffConnection';
+import type { HeadersArray } from '../../server/types';
+import type { RegisteredListener } from '../../utils/eventsHelper';
import type * as frames from '../frames';
+import type { Page } from '../page';
import type * as types from '../types';
import type { Protocol } from './protocol';
-import type { HeadersArray } from '../../server/types';
export class FFNetworkManager {
private _session: FFSession;
diff --git a/packages/playwright-core/src/server/firefox/ffPage.ts b/packages/playwright-core/src/server/firefox/ffPage.ts
index 71199dc8d5..0e1755a2da 100644
--- a/packages/playwright-core/src/server/firefox/ffPage.ts
+++ b/packages/playwright-core/src/server/firefox/ffPage.ts
@@ -15,28 +15,29 @@
* limitations under the License.
*/
+import { eventsHelper } from '../../utils/eventsHelper';
import * as dialog from '../dialog';
import * as dom from '../dom';
-import type * as frames from '../frames';
-import type { RegisteredListener } from '../../utils/eventsHelper';
-import { eventsHelper } from '../../utils/eventsHelper';
-import type { PageDelegate } from '../page';
import { InitScript } from '../page';
import { Page, Worker } from '../page';
-import type * as types from '../types';
import { getAccessibilityTree } from './ffAccessibility';
-import type { FFBrowserContext } from './ffBrowser';
import { FFSession } from './ffConnection';
import { FFExecutionContext } from './ffExecutionContext';
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './ffInput';
import { FFNetworkManager } from './ffNetworkManager';
-import type { Protocol } from './protocol';
-import type { Progress } from '../progress';
-import { splitErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';
+import { splitErrorMessage } from '../../utils/stackTrace';
import { BrowserContext } from '../browserContext';
import { TargetClosedError } from '../errors';
+import type { Progress } from '../progress';
+import type { FFBrowserContext } from './ffBrowser';
+import type { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type * as frames from '../frames';
+import type { PageDelegate } from '../page';
+import type * as types from '../types';
+
export const UTILITY_WORLD_NAME = '__playwright_utility_world__';
export class FFPage implements PageDelegate {
diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.ts
index 1e0e4cc055..fe55417c8c 100644
--- a/packages/playwright-core/src/server/firefox/firefox.ts
+++ b/packages/playwright-core/src/server/firefox/firefox.ts
@@ -16,18 +16,20 @@
*/
import * as os from 'os';
-import path from 'path';
+import * as path from 'path';
+
import { FFBrowser } from './ffBrowser';
import { kBrowserCloseMessageId } from './ffConnection';
+import { wrapInASCIIBox } from '../../utils';
import { BrowserType, kNoXServerRunningError } from '../browserType';
import { BrowserReadyState } from '../browserType';
+
import type { Env } from '../../utils/processLauncher';
-import type { ConnectionTransport } from '../transport';
import type { BrowserOptions } from '../browser';
-import type * as types from '../types';
-import { wrapInASCIIBox } from '../../utils';
import type { SdkObject } from '../instrumentation';
import type { ProtocolError } from '../protocolError';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
export class Firefox extends BrowserType {
constructor(parent: SdkObject) {
diff --git a/packages/playwright-core/src/server/formData.ts b/packages/playwright-core/src/server/formData.ts
index bc7f1e5bfe..d628480954 100644
--- a/packages/playwright-core/src/server/formData.ts
+++ b/packages/playwright-core/src/server/formData.ts
@@ -15,6 +15,7 @@
*/
import { mime } from '../utilsBundle';
+
import type * as channels from '@protocol/channels';
export class MultipartFormData {
diff --git a/packages/playwright-core/src/server/frameSelectors.ts b/packages/playwright-core/src/server/frameSelectors.ts
index 4be2a9c285..c375b0b52a 100644
--- a/packages/playwright-core/src/server/frameSelectors.ts
+++ b/packages/playwright-core/src/server/frameSelectors.ts
@@ -14,13 +14,16 @@
* limitations under the License.
*/
+import { asLocator } from '../utils';
+import { InvalidSelectorError, splitSelectorByFrame, stringifySelector, visitAllSelectorParts } from '../utils/isomorphic/selectorParser';
+
+import type { ElementHandle, FrameExecutionContext } from './dom';
import type { Frame } from './frames';
-import type * as types from './types';
-import { stringifySelector, type ParsedSelector, splitSelectorByFrame, InvalidSelectorError, visitAllSelectorParts } from '../utils/isomorphic/selectorParser';
-import type { FrameExecutionContext, ElementHandle } from './dom';
-import type { JSHandle } from './javascript';
import type { InjectedScript } from './injected/injectedScript';
-import { asLocator } from '../utils';
+import type { JSHandle } from './javascript';
+import type * as types from './types';
+import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
+
export type SelectorInfo = {
parsed: ParsedSelector,
diff --git a/packages/playwright-core/src/server/frames.ts b/packages/playwright-core/src/server/frames.ts
index b1f4d4c1c6..2183d3f409 100644
--- a/packages/playwright-core/src/server/frames.ts
+++ b/packages/playwright-core/src/server/frames.ts
@@ -15,32 +15,34 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { ConsoleMessage } from './console';
+import { BrowserContext } from './browserContext';
import * as dom from './dom';
+import { TimeoutError } from './errors';
+import { prepareFilesForUpload } from './fileUploadUtils';
+import { FrameSelectors } from './frameSelectors';
import { helper } from './helper';
-import type { RegisteredListener } from '../utils/eventsHelper';
-import { eventsHelper } from '../utils/eventsHelper';
+import { SdkObject, serverSideCallMetadata } from './instrumentation';
import * as js from './javascript';
import * as network from './network';
-import type { Dialog } from './dialog';
import { Page } from './page';
-import * as types from './types';
-import { BrowserContext } from './browserContext';
-import type { Progress } from './progress';
import { ProgressController } from './progress';
-import { LongStandingScope, assert, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime, asLocator, compressCallLog } from '../utils';
-import { ManualPromise } from '../utils/manualPromise';
+import * as types from './types';
+import { LongStandingScope, asLocator, assert, compressCallLog, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime } from '../utils';
+import { isSessionClosedError } from './protocolError';
import { debugLogger } from '../utils/debugLogger';
+import { eventsHelper } from '../utils/eventsHelper';
+import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
+import { ManualPromise } from '../utils/manualPromise';
+
+import type { ConsoleMessage } from './console';
+import type { Dialog } from './dialog';
+import type { ElementStateWithoutStable, FrameExpectParams, InjectedScript } from './injected/injectedScript';
import type { CallMetadata } from './instrumentation';
-import { serverSideCallMetadata, SdkObject } from './instrumentation';
-import type { InjectedScript, ElementStateWithoutStable, FrameExpectParams } from './injected/injectedScript';
-import { isSessionClosedError } from './protocolError';
-import { type ParsedSelector, isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
+import type { Progress } from './progress';
import type { ScreenshotOptions } from './screenshotter';
-import { FrameSelectors } from './frameSelectors';
-import { TimeoutError } from './errors';
-import { prepareFilesForUpload } from './fileUploadUtils';
+import type { RegisteredListener } from '../utils/eventsHelper';
+import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
+import type * as channels from '@protocol/channels';
type ContextData = {
contextPromise: ManualPromise<dom.FrameExecutionContext | { destroyedReason: string }>;
diff --git a/packages/playwright-core/src/server/har/harRecorder.ts b/packages/playwright-core/src/server/har/harRecorder.ts
index e623587e57..7cde24fa3a 100644
--- a/packages/playwright-core/src/server/har/harRecorder.ts
+++ b/packages/playwright-core/src/server/har/harRecorder.ts
@@ -14,20 +14,22 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { Artifact } from '../artifact';
-import type { BrowserContext } from '../browserContext';
-import type * as har from '@trace/har';
import { HarTracer } from './harTracer';
-import type { HarTracerDelegate } from './harTracer';
-import type * as channels from '@protocol/channels';
+import { createGuid } from '../../utils';
+import { ManualPromise } from '../../utils/manualPromise';
import { yazl } from '../../zipBundle';
+
+import type { BrowserContext } from '../browserContext';
+import type { HarTracerDelegate } from './harTracer';
import type { ZipFile } from '../../zipBundle';
-import { ManualPromise } from '../../utils/manualPromise';
-import type EventEmitter from 'events';
-import { createGuid } from '../../utils';
import type { Page } from '../page';
+import type * as channels from '@protocol/channels';
+import type * as har from '@trace/har';
+import type EventEmitter from 'events';
export class HarRecorder implements HarTracerDelegate {
private _artifact: Artifact;
diff --git a/packages/playwright-core/src/server/har/harTracer.ts b/packages/playwright-core/src/server/har/harTracer.ts
index ba0e8b46c2..0e3a66b938 100644
--- a/packages/playwright-core/src/server/har/harTracer.ts
+++ b/packages/playwright-core/src/server/har/harTracer.ts
@@ -14,22 +14,23 @@
* limitations under the License.
*/
+import { assert, calculateSha1, monotonicTime } from '../../utils';
+import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
+import { eventsHelper } from '../../utils/eventsHelper';
+import { ManualPromise } from '../../utils/manualPromise';
+import { mime } from '../../utilsBundle';
import { BrowserContext } from '../browserContext';
-import type { APIRequestEvent, APIRequestFinishedEvent } from '../fetch';
import { APIRequestContext } from '../fetch';
+import { Frame } from '../frames';
import { helper } from '../helper';
import * as network from '../network';
-import type { Worker } from '../page';
-import type { Page } from '../page';
-import type * as har from '@trace/har';
-import { assert, calculateSha1, monotonicTime } from '../../utils';
+
import type { RegisteredListener } from '../../utils/eventsHelper';
-import { eventsHelper } from '../../utils/eventsHelper';
-import { mime } from '../../utilsBundle';
-import { ManualPromise } from '../../utils/manualPromise';
-import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
-import { Frame } from '../frames';
+import type { APIRequestEvent, APIRequestFinishedEvent } from '../fetch';
+import type { Page } from '../page';
+import type { Worker } from '../page';
import type { HeadersArray, LifecycleEvent } from '../types';
+import type * as har from '@trace/har';
const FALLBACK_HTTP_VERSION = 'HTTP/1.1';
diff --git a/packages/playwright-core/src/server/helper.ts b/packages/playwright-core/src/server/helper.ts
index 5b22dfd5e1..ccf9af12b0 100644
--- a/packages/playwright-core/src/server/helper.ts
+++ b/packages/playwright-core/src/server/helper.ts
@@ -15,13 +15,15 @@
* limitations under the License.
*/
-import type { EventEmitter } from 'events';
-import type * as types from './types';
-import type { Progress } from './progress';
import { debugLogger } from '../utils/debugLogger';
-import type { RegisteredListener } from '../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
+import type { Progress } from './progress';
+import type * as types from './types';
+import type { RegisteredListener } from '../utils/eventsHelper';
+import type { EventEmitter } from 'events';
+
+
const MAX_LOG_LENGTH = process.env.MAX_LOG_LENGTH ? +process.env.MAX_LOG_LENGTH : Infinity;
class Helper {
diff --git a/packages/playwright-core/src/server/index.ts b/packages/playwright-core/src/server/index.ts
index 31e177a219..e93399007a 100644
--- a/packages/playwright-core/src/server/index.ts
+++ b/packages/playwright-core/src/server/index.ts
@@ -16,10 +16,10 @@
export type { Executable } from './registry';
export {
- registry,
- registryDirectory,
Registry,
installBrowsersForNpmInstall,
+ registry,
+ registryDirectory,
writeDockerVersion } from './registry';
export { DispatcherConnection, RootDispatcher } from './dispatchers/dispatcher';
@@ -28,6 +28,6 @@ export { createPlaywright } from './playwright';
export type { DispatcherScope } from './dispatchers/dispatcher';
export type { Playwright } from './playwright';
-export { openTraceInBrowser, openTraceViewerApp, runTraceViewerApp, startTraceViewerServer, installRootRedirect } from './trace/viewer/traceViewer';
+export { installRootRedirect, openTraceInBrowser, openTraceViewerApp, runTraceViewerApp, startTraceViewerServer } from './trace/viewer/traceViewer';
export { serverSideCallMetadata } from './instrumentation';
export { SocksProxy } from '../common/socksProxy';
diff --git a/packages/playwright-core/src/server/injected/ariaSnapshot.ts b/packages/playwright-core/src/server/injected/ariaSnapshot.ts
index 4318b9aea9..3813960fe4 100644
--- a/packages/playwright-core/src/server/injected/ariaSnapshot.ts
+++ b/packages/playwright-core/src/server/injected/ariaSnapshot.ts
@@ -14,10 +14,12 @@
* limitations under the License.
*/
-import * as roleUtils from './roleUtils';
-import { getElementComputedStyle } from './domUtils';
import { escapeRegExp, longestCommonSubstring, normalizeWhiteSpace } from '@isomorphic/stringUtils';
+
+import { getElementComputedStyle } from './domUtils';
+import * as roleUtils from './roleUtils';
import { yamlEscapeKeyIfNeeded, yamlEscapeValueIfNeeded } from './yaml';
+
import type { AriaProps, AriaRegex, AriaRole, AriaTemplateNode, AriaTemplateRoleNode, AriaTemplateTextNode } from '@isomorphic/ariaSnapshot';
export type AriaNode = AriaProps & {
diff --git a/packages/playwright-core/src/server/injected/consoleApi.ts b/packages/playwright-core/src/server/injected/consoleApi.ts
index faba90c57d..c79ee6610c 100644
--- a/packages/playwright-core/src/server/injected/consoleApi.ts
+++ b/packages/playwright-core/src/server/injected/consoleApi.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import type { ByRoleOptions } from '../../utils/isomorphic/locatorUtils';
+import { asLocator } from '../../utils/isomorphic/locatorGenerators';
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../../utils/isomorphic/locatorUtils';
import { escapeForTextSelector } from '../../utils/isomorphic/stringUtils';
-import { asLocator } from '../../utils/isomorphic/locatorGenerators';
-import type { Language } from '../../utils/isomorphic/locatorGenerators';
+
import type { InjectedScript } from './injectedScript';
+import type { Language } from '../../utils/isomorphic/locatorGenerators';
+import type { ByRoleOptions } from '../../utils/isomorphic/locatorUtils';
const selectorSymbol = Symbol('selector');
diff --git a/packages/playwright-core/src/server/injected/highlight.ts b/packages/playwright-core/src/server/injected/highlight.ts
index 5720ffc539..332a6a7754 100644
--- a/packages/playwright-core/src/server/injected/highlight.ts
+++ b/packages/playwright-core/src/server/injected/highlight.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
+import highlightCSS from './highlight.css?inline';
+import { asLocator } from '../../utils/isomorphic/locatorGenerators';
import { stringifySelector } from '../../utils/isomorphic/selectorParser';
-import type { ParsedSelector } from '../../utils/isomorphic/selectorParser';
+
import type { InjectedScript } from './injectedScript';
-import { asLocator } from '../../utils/isomorphic/locatorGenerators';
import type { Language } from '../../utils/isomorphic/locatorGenerators';
-import highlightCSS from './highlight.css?inline';
+import type { ParsedSelector } from '../../utils/isomorphic/selectorParser';
+
type HighlightEntry = {
targetElement: Element,
diff --git a/packages/playwright-core/src/server/injected/injectedScript.ts b/packages/playwright-core/src/server/injected/injectedScript.ts
index bb004590f5..547928081d 100644
--- a/packages/playwright-core/src/server/injected/injectedScript.ts
+++ b/packages/playwright-core/src/server/injected/injectedScript.ts
@@ -14,30 +14,36 @@
* limitations under the License.
*/
-import type { SelectorEngine, SelectorRoot } from './selectorEngine';
-import { XPathEngine } from './xpathSelectorEngine';
+import { parseAriaSnapshot } from '@isomorphic/ariaSnapshot';
+
+import { generateAriaTree, getAllByAria, matchesAriaTree, renderAriaTree } from './ariaSnapshot';
+import { enclosingShadowRootOrDocument, isElementVisible, isInsideScope, parentElementOrShadowHost, setBrowserName } from './domUtils';
+import { Highlight } from './highlight';
+import { kLayoutSelectorNames, layoutSelectorScore } from './layoutSelectorUtils';
import { ReactEngine } from './reactSelectorEngine';
-import { VueEngine } from './vueSelectorEngine';
import { createRoleEngine } from './roleSelectorEngine';
-import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
-import type { NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '../../utils/isomorphic/selectorParser';
-import { visitAllSelectorParts, parseSelector, stringifySelector } from '../../utils/isomorphic/selectorParser';
-import { type TextMatcher, elementMatchesText, elementText, type ElementText, getElementLabels } from './selectorUtils';
+import { getAriaDisabled, getAriaRole, getCheckedAllowMixed, getCheckedWithoutMixed, getElementAccessibleDescription, getElementAccessibleErrorMessage, getElementAccessibleName, getReadonly } from './roleUtils';
import { SelectorEvaluatorImpl, sortInDOMOrder } from './selectorEvaluator';
-import { enclosingShadowRootOrDocument, isElementVisible, isInsideScope, parentElementOrShadowHost, setBrowserName } from './domUtils';
-import type { CSSComplexSelectorList } from '../../utils/isomorphic/cssParser';
-import { generateSelector, type GenerateSelectorOptions } from './selectorGenerator';
-import type * as channels from '@protocol/channels';
-import { Highlight } from './highlight';
-import { getAriaDisabled, getAriaRole, getElementAccessibleName, getElementAccessibleDescription, getReadonly, getElementAccessibleErrorMessage, getCheckedAllowMixed, getCheckedWithoutMixed } from './roleUtils';
-import { kLayoutSelectorNames, type LayoutSelectorName, layoutSelectorScore } from './layoutSelectorUtils';
+import { generateSelector } from './selectorGenerator';
+import { elementMatchesText, elementText, getElementLabels } from './selectorUtils';
+import { VueEngine } from './vueSelectorEngine';
+import { XPathEngine } from './xpathSelectorEngine';
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
-import type { Language } from '../../utils/isomorphic/locatorGenerators';
+import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
+import { parseSelector, stringifySelector, visitAllSelectorParts } from '../../utils/isomorphic/selectorParser';
import { cacheNormalizedWhitespaces, normalizeWhiteSpace, trimStringWithEllipsis } from '../../utils/isomorphic/stringUtils';
-import { matchesAriaTree, getAllByAria, generateAriaTree, renderAriaTree } from './ariaSnapshot';
+
import type { AriaNode, AriaSnapshot } from './ariaSnapshot';
+import type { LayoutSelectorName } from './layoutSelectorUtils';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { GenerateSelectorOptions } from './selectorGenerator';
+import type { ElementText, TextMatcher } from './selectorUtils';
+import type { CSSComplexSelectorList } from '../../utils/isomorphic/cssParser';
+import type { Language } from '../../utils/isomorphic/locatorGenerators';
+import type { NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '../../utils/isomorphic/selectorParser';
import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot';
-import { parseAriaSnapshot } from '@isomorphic/ariaSnapshot';
+import type * as channels from '@protocol/channels';
+
export type FrameExpectParams = Omit<channels.FrameExpectParams, 'expectedValue'> & { expectedValue?: any };
diff --git a/packages/playwright-core/src/server/injected/reactSelectorEngine.ts b/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
index 2d0e51f0b2..5beb3cc9ee 100644
--- a/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { SelectorEngine, SelectorRoot } from './selectorEngine';
import { isInsideScope } from './domUtils';
import { matchesComponentAttribute } from './selectorUtils';
import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
+
type ComponentNode = {
key?: any,
name: string,
diff --git a/packages/playwright-core/src/server/injected/recorder/pollingRecorder.ts b/packages/playwright-core/src/server/injected/recorder/pollingRecorder.ts
index 86b2babdd9..fd9a3edf98 100644
--- a/packages/playwright-core/src/server/injected/recorder/pollingRecorder.ts
+++ b/packages/playwright-core/src/server/injected/recorder/pollingRecorder.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { ElementInfo, Mode, OverlayState, UIState } from '@recorder/recorderTypes';
-import type * as actions from '@recorder/actions';
-import type { InjectedScript } from '../injectedScript';
import { Recorder } from './recorder';
+
+import type { InjectedScript } from '../injectedScript';
import type { RecorderDelegate } from './recorder';
+import type * as actions from '@recorder/actions';
+import type { ElementInfo, Mode, OverlayState, UIState } from '@recorder/recorderTypes';
interface Embedder {
__pw_recorderPerformAction(action: actions.PerformOnRecordAction): Promise<void>;
diff --git a/packages/playwright-core/src/server/injected/recorder/recorder.ts b/packages/playwright-core/src/server/injected/recorder/recorder.ts
index 3df43f751e..27e4f35a10 100644
--- a/packages/playwright-core/src/server/injected/recorder/recorder.ts
+++ b/packages/playwright-core/src/server/injected/recorder/recorder.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type * as actions from '@recorder/actions';
-import type { InjectedScript } from '../injectedScript';
+import clipPaths from './clipPaths';
+
import type { Point } from '../../../common/types';
-import type { ElementInfo, Mode, OverlayState, UIState } from '@recorder/recorderTypes';
-import type { ElementText } from '../selectorUtils';
import type { Highlight, HighlightOptions } from '../highlight';
-import clipPaths from './clipPaths';
+import type { InjectedScript } from '../injectedScript';
+import type { ElementText } from '../selectorUtils';
+import type * as actions from '@recorder/actions';
+import type { ElementInfo, Mode, OverlayState, UIState } from '@recorder/recorderTypes';
export interface RecorderDelegate {
performAction?(action: actions.PerformOnRecordAction): Promise<void>;
diff --git a/packages/playwright-core/src/server/injected/roleSelectorEngine.ts b/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
index b647f81b8e..2a9c8f648e 100644
--- a/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import type { SelectorEngine, SelectorRoot } from './selectorEngine';
-import { matchesAttributePart } from './selectorUtils';
import { beginAriaCaches, endAriaCaches, getAriaChecked, getAriaDisabled, getAriaExpanded, getAriaLevel, getAriaPressed, getAriaRole, getAriaSelected, getElementAccessibleName, isElementHiddenForAria, kAriaCheckedRoles, kAriaExpandedRoles, kAriaLevelRoles, kAriaPressedRoles, kAriaSelectedRoles } from './roleUtils';
-import { parseAttributeSelector, type AttributeSelectorPart, type AttributeSelectorOperator } from '../../utils/isomorphic/selectorParser';
+import { matchesAttributePart } from './selectorUtils';
+import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { AttributeSelectorOperator, AttributeSelectorPart } from '../../utils/isomorphic/selectorParser';
+
type RoleEngineOptions = {
role: string;
name?: string | RegExp;
diff --git a/packages/playwright-core/src/server/injected/roleUtils.ts b/packages/playwright-core/src/server/injected/roleUtils.ts
index a7b3cd1d4b..d56075ea58 100644
--- a/packages/playwright-core/src/server/injected/roleUtils.ts
+++ b/packages/playwright-core/src/server/injected/roleUtils.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { AriaRole } from '@isomorphic/ariaSnapshot';
import { closestCrossShadow, elementSafeTagName, enclosingShadowRootOrDocument, getElementComputedStyle, isElementStyleVisibilityVisible, isVisibleTextNode, parentElementOrShadowHost } from './domUtils';
+import type { AriaRole } from '@isomorphic/ariaSnapshot';
+
function hasExplicitAccessibleName(e: Element) {
return e.hasAttribute('aria-label') || e.hasAttribute('aria-labelledby');
}
diff --git a/packages/playwright-core/src/server/injected/selectorEvaluator.ts b/packages/playwright-core/src/server/injected/selectorEvaluator.ts
index d2f481526f..7d55229166 100644
--- a/packages/playwright-core/src/server/injected/selectorEvaluator.ts
+++ b/packages/playwright-core/src/server/injected/selectorEvaluator.ts
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../../utils/isomorphic/cssParser';
-import { customCSSNames } from '../../utils/isomorphic/selectorParser';
import { isElementVisible, parentElementOrShadowHost } from './domUtils';
-import { type LayoutSelectorName, layoutSelectorScore } from './layoutSelectorUtils';
-import { elementMatchesText, elementText, shouldSkipForTextMatching, type ElementText } from './selectorUtils';
+import { layoutSelectorScore } from './layoutSelectorUtils';
+import { elementMatchesText, elementText, shouldSkipForTextMatching } from './selectorUtils';
+import { customCSSNames } from '../../utils/isomorphic/selectorParser';
import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
+import type { LayoutSelectorName } from './layoutSelectorUtils';
+import type { ElementText } from './selectorUtils';
+import type { CSSComplexSelector, CSSComplexSelectorList, CSSFunctionArgument, CSSSimpleSelector } from '../../utils/isomorphic/cssParser';
+
type QueryContext = {
scope: Element | Document;
pierceShadow: boolean;
diff --git a/packages/playwright-core/src/server/injected/selectorGenerator.ts b/packages/playwright-core/src/server/injected/selectorGenerator.ts
index 04f1598762..70541abfc0 100644
--- a/packages/playwright-core/src/server/injected/selectorGenerator.ts
+++ b/packages/playwright-core/src/server/injected/selectorGenerator.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import { cssEscape, escapeForAttributeSelector, escapeForTextSelector, escapeRegExp, quoteCSSAttributeValue } from '../../utils/isomorphic/stringUtils';
import { closestCrossShadow, isElementVisible, isInsideScope, parentElementOrShadowHost } from './domUtils';
-import type { InjectedScript } from './injectedScript';
-import { getAriaRole, getElementAccessibleName, beginAriaCaches, endAriaCaches } from './roleUtils';
+import { beginAriaCaches, endAriaCaches, getAriaRole, getElementAccessibleName } from './roleUtils';
import { elementText, getElementLabels } from './selectorUtils';
+import { cssEscape, escapeForAttributeSelector, escapeForTextSelector, escapeRegExp, quoteCSSAttributeValue } from '../../utils/isomorphic/stringUtils';
+
+import type { InjectedScript } from './injectedScript';
type SelectorToken = {
engine: string;
diff --git a/packages/playwright-core/src/server/injected/selectorUtils.ts b/packages/playwright-core/src/server/injected/selectorUtils.ts
index da0f869fa0..31db84683d 100644
--- a/packages/playwright-core/src/server/injected/selectorUtils.ts
+++ b/packages/playwright-core/src/server/injected/selectorUtils.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { AttributeSelectorPart } from '../../utils/isomorphic/selectorParser';
-import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
import { getAriaLabelledByElements } from './roleUtils';
+import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
+
+import type { AttributeSelectorPart } from '../../utils/isomorphic/selectorParser';
export function matchesComponentAttribute(obj: any, attr: AttributeSelectorPart) {
for (const token of attr.jsonPath) {
diff --git a/packages/playwright-core/src/server/injected/utilityScript.ts b/packages/playwright-core/src/server/injected/utilityScript.ts
index 7b046a529a..2a987802ff 100644
--- a/packages/playwright-core/src/server/injected/utilityScript.ts
+++ b/packages/playwright-core/src/server/injected/utilityScript.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { serializeAsCallArgument, parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
+import { parseEvaluationResultValue, serializeAsCallArgument } from '../isomorphic/utilityScriptSerializers';
export class UtilityScript {
constructor(isUnderTest: boolean) {
diff --git a/packages/playwright-core/src/server/injected/vueSelectorEngine.ts b/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
index 154f36b983..a9f179bf43 100644
--- a/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import type { SelectorEngine, SelectorRoot } from './selectorEngine';
import { isInsideScope } from './domUtils';
import { matchesComponentAttribute } from './selectorUtils';
import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
+
type ComponentNode = {
name: string,
children: ComponentNode[],
diff --git a/packages/playwright-core/src/server/input.ts b/packages/playwright-core/src/server/input.ts
index f8beb789f8..62261edfae 100644
--- a/packages/playwright-core/src/server/input.ts
+++ b/packages/playwright-core/src/server/input.ts
@@ -16,9 +16,10 @@
import { assert } from '../utils';
import * as keyboardLayout from './usKeyboardLayout';
-import type * as types from './types';
-import type { Page } from './page';
+
import type { CallMetadata } from './instrumentation';
+import type { Page } from './page';
+import type * as types from './types';
export const keypadLocation = keyboardLayout.keypadLocation;
diff --git a/packages/playwright-core/src/server/instrumentation.ts b/packages/playwright-core/src/server/instrumentation.ts
index 2a384fb169..b33ec542ec 100644
--- a/packages/playwright-core/src/server/instrumentation.ts
+++ b/packages/playwright-core/src/server/instrumentation.ts
@@ -15,14 +15,20 @@
*/
import { EventEmitter } from 'events';
+
import { createGuid } from '../utils';
-import type { APIRequestContext } from './fetch';
+
import type { Browser } from './browser';
import type { BrowserContext } from './browserContext';
import type { BrowserType } from './browserType';
+import type { Dialog } from './dialog';
+import type { Download } from './download';
+import type { APIRequestContext } from './fetch';
import type { Frame } from './frames';
import type { Page } from './page';
import type { Playwright } from './playwright';
+import type { CallMetadata } from '@protocol/callMetadata';
+export type { CallMetadata } from '@protocol/callMetadata';
export type Attribution = {
playwright: Playwright;
@@ -33,11 +39,6 @@ export type Attribution = {
frame?: Frame;
};
-import type { CallMetadata } from '@protocol/callMetadata';
-import type { Dialog } from './dialog';
-import type { Download } from './download';
-export type { CallMetadata } from '@protocol/callMetadata';
-
export class SdkObject extends EventEmitter {
guid: string;
attribution: Attribution;
diff --git a/packages/playwright-core/src/server/javascript.ts b/packages/playwright-core/src/server/javascript.ts
index dbbe89d5c2..32ba84179e 100644
--- a/packages/playwright-core/src/server/javascript.ts
+++ b/packages/playwright-core/src/server/javascript.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type * as dom from './dom';
+import { SdkObject } from './instrumentation';
import * as utilityScriptSource from '../generated/utilityScriptSource';
+import { isUnderTest } from '../utils';
import { serializeAsCallArgument } from './isomorphic/utilityScriptSerializers';
-import type { UtilityScript } from './injected/utilityScript';
-import { SdkObject } from './instrumentation';
import { LongStandingScope } from '../utils/manualPromise';
-import { isUnderTest } from '../utils';
+
+import type * as dom from './dom';
+import type { UtilityScript } from './injected/utilityScript';
export type ObjectId = string;
export type RemoteObject = {
diff --git a/packages/playwright-core/src/server/launchApp.ts b/packages/playwright-core/src/server/launchApp.ts
index d8c81a3169..009748395a 100644
--- a/packages/playwright-core/src/server/launchApp.ts
+++ b/packages/playwright-core/src/server/launchApp.ts
@@ -14,16 +14,19 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
-import type { Page } from './page';
-import { findChromiumChannel } from './registry';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { isUnderTest } from '../utils';
import { serverSideCallMetadata } from './instrumentation';
-import type * as types from './types';
+import { findChromiumChannel } from './registry';
+import { registryDirectory } from './registry';
+
import type { BrowserType } from './browserType';
import type { CRPage } from './chromium/crPage';
-import { registryDirectory } from './registry';
+import type { Page } from './page';
+import type * as types from './types';
+
export async function launchApp(browserType: BrowserType, options: {
sdkLanguage: string,
diff --git a/packages/playwright-core/src/server/network.ts b/packages/playwright-core/src/server/network.ts
index 006f2f4cbf..81e23abd82 100644
--- a/packages/playwright-core/src/server/network.ts
+++ b/packages/playwright-core/src/server/network.ts
@@ -14,18 +14,20 @@
* limitations under the License.
*/
+import { assert } from '../utils';
+import { BrowserContext } from './browserContext';
+import { APIRequestContext } from './fetch';
+import { SdkObject } from './instrumentation';
+import { ManualPromise } from '../utils/manualPromise';
+
import type * as contexts from './browserContext';
-import type * as pages from './page';
import type * as frames from './frames';
+import type * as pages from './page';
import type * as types from './types';
-import type * as channels from '@protocol/channels';
-import { assert } from '../utils';
-import { ManualPromise } from '../utils/manualPromise';
-import { SdkObject } from './instrumentation';
-import type { HeadersArray, NameValue } from '../common/types';
-import { APIRequestContext } from './fetch';
import type { NormalizedContinueOverrides } from './types';
-import { BrowserContext } from './browserContext';
+import type { HeadersArray, NameValue } from '../common/types';
+import type * as channels from '@protocol/channels';
+
export function filterCookies(cookies: channels.NetworkCookie[], urls: string[]): channels.NetworkCookie[] {
const parsedURLs = urls.map(s => new URL(s));
diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.ts
index b8fdae2808..0f50455155 100644
--- a/packages/playwright-core/src/server/page.ts
+++ b/packages/playwright-core/src/server/page.ts
@@ -15,37 +15,38 @@
* limitations under the License.
*/
-import type * as dom from './dom';
+import * as accessibility from './accessibility';
+import { BrowserContext } from './browserContext';
+import { ConsoleMessage } from './console';
+import { TargetClosedError, TimeoutError } from './errors';
+import { FileChooser } from './fileChooser';
import * as frames from './frames';
+import { helper } from './helper';
import * as input from './input';
+import { SdkObject } from './instrumentation';
+import { parseEvaluationResultValue, source } from './isomorphic/utilityScriptSerializers';
import * as js from './javascript';
-import type * as network from './network';
-import type * as channels from '@protocol/channels';
-import type { ScreenshotOptions } from './screenshotter';
+import { ProgressController } from './progress';
import { Screenshotter, validateScreenshotOptions } from './screenshotter';
import { TimeoutSettings } from '../common/timeoutSettings';
-import type * as types from './types';
-import { BrowserContext } from './browserContext';
-import { ConsoleMessage } from './console';
-import * as accessibility from './accessibility';
-import { FileChooser } from './fileChooser';
-import type { Progress } from './progress';
-import { ProgressController } from './progress';
import { LongStandingScope, assert, compressCallLog, createGuid, trimStringWithEllipsis } from '../utils';
-import { ManualPromise } from '../utils/manualPromise';
-import { debugLogger } from '../utils/debugLogger';
-import type { ImageComparatorOptions } from '../utils/comparators';
+import { asLocator } from '../utils';
import { getComparator } from '../utils/comparators';
-import type { CallMetadata } from './instrumentation';
-import { SdkObject } from './instrumentation';
-import type { Artifact } from './artifact';
-import type { TimeoutOptions } from '../common/types';
+import { debugLogger } from '../utils/debugLogger';
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
-import { parseEvaluationResultValue, source } from './isomorphic/utilityScriptSerializers';
+import { ManualPromise } from '../utils/manualPromise';
+
+import type { Artifact } from './artifact';
+import type * as dom from './dom';
+import type { CallMetadata } from './instrumentation';
import type { SerializedValue } from './isomorphic/utilityScriptSerializers';
-import { TargetClosedError, TimeoutError } from './errors';
-import { asLocator } from '../utils';
-import { helper } from './helper';
+import type * as network from './network';
+import type { Progress } from './progress';
+import type { ScreenshotOptions } from './screenshotter';
+import type * as types from './types';
+import type { TimeoutOptions } from '../common/types';
+import type { ImageComparatorOptions } from '../utils/comparators';
+import type * as channels from '@protocol/channels';
export interface PageDelegate {
readonly rawMouse: input.RawMouse;
diff --git a/packages/playwright-core/src/server/pipeTransport.ts b/packages/playwright-core/src/server/pipeTransport.ts
index b5755d098d..67bf126324 100644
--- a/packages/playwright-core/src/server/pipeTransport.ts
+++ b/packages/playwright-core/src/server/pipeTransport.ts
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
import { makeWaitForNextTask } from '../utils';
import { debugLogger } from '../utils/debugLogger';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
+
export class PipeTransport implements ConnectionTransport {
private _pipeRead: NodeJS.ReadableStream;
private _pipeWrite: NodeJS.WritableStream;
diff --git a/packages/playwright-core/src/server/playwright.ts b/packages/playwright-core/src/server/playwright.ts
index 722400b6fc..a1092361ae 100644
--- a/packages/playwright-core/src/server/playwright.ts
+++ b/packages/playwright-core/src/server/playwright.ts
@@ -14,22 +14,24 @@
* limitations under the License.
*/
+import { debugLogger } from '../utils';
import { Android } from './android/android';
import { AdbBackend } from './android/backendAdb';
-import type { Browser } from './browser';
+import { BidiChromium } from './bidi/bidiChromium';
+import { BidiFirefox } from './bidi/bidiFirefox';
import { Chromium } from './chromium/chromium';
+import { DebugController } from './debugController';
import { Electron } from './electron/electron';
import { Firefox } from './firefox/firefox';
+import { SdkObject, createInstrumentation } from './instrumentation';
import { Selectors } from './selectors';
import { WebKit } from './webkit/webkit';
+
+import type { BrowserType } from './browserType';
+import type { Language } from '../utils';
+import type { Browser } from './browser';
import type { CallMetadata } from './instrumentation';
-import { createInstrumentation, SdkObject } from './instrumentation';
-import { debugLogger, type Language } from '../utils';
import type { Page } from './page';
-import { DebugController } from './debugController';
-import type { BrowserType } from './browserType';
-import { BidiChromium } from './bidi/bidiChromium';
-import { BidiFirefox } from './bidi/bidiFirefox';
type PlaywrightOptions = {
socksProxyPort?: number;
diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.ts
index d92c5ed226..f1c54edfe8 100644
--- a/packages/playwright-core/src/server/progress.ts
+++ b/packages/playwright-core/src/server/progress.ts
@@ -16,10 +16,11 @@
import { TimeoutError } from './errors';
import { assert, monotonicTime } from '../utils';
-import type { LogName } from '../utils/debugLogger';
-import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
import { ManualPromise } from '../utils/manualPromise';
+import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
+import type { LogName } from '../utils/debugLogger';
+
export interface Progress {
log(message: string): void;
timeUntilDeadline(): number;
diff --git a/packages/playwright-core/src/server/recorder.ts b/packages/playwright-core/src/server/recorder.ts
index 9fbe4962d2..79165df8f2 100644
--- a/packages/playwright-core/src/server/recorder.ts
+++ b/packages/playwright-core/src/server/recorder.ts
@@ -14,25 +14,27 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { CallLog, CallLogStatus, ElementInfo, EventData, Mode, OverlayState, Source, UIState } from '@recorder/recorderTypes';
import * as fs from 'fs';
-import type { Point } from '../common/types';
+
import * as consoleApiSource from '../generated/consoleApiSource';
import { isUnderTest } from '../utils';
-import { locatorOrSelectorAsSelector } from '../utils/isomorphic/locatorParser';
import { BrowserContext } from './browserContext';
-import { type Language } from './codegen/types';
import { Debugger } from './debugger';
-import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation';
import { ContextRecorder, generateFrameSelector } from './recorder/contextRecorder';
-import type { IRecorderAppFactory, IRecorderApp, IRecorder } from './recorder/recorderFrontend';
import { buildFullSelector, metadataToCallLog } from './recorder/recorderUtils';
-import type * as actions from '@recorder/actions';
+import { locatorOrSelectorAsSelector } from '../utils/isomorphic/locatorParser';
import { stringifySelector } from '../utils/isomorphic/selectorParser';
+
+import type { Language } from './codegen/types';
import type { Frame } from './frames';
-import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot';
+import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation';
import type { Page } from './page';
+import type { IRecorder, IRecorderApp, IRecorderAppFactory } from './recorder/recorderFrontend';
+import type { Point } from '../common/types';
+import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot';
+import type * as channels from '@protocol/channels';
+import type * as actions from '@recorder/actions';
+import type { CallLog, CallLogStatus, ElementInfo, EventData, Mode, OverlayState, Source, UIState } from '@recorder/recorderTypes';
const recorderSymbol = Symbol('recorderSymbol');
diff --git a/packages/playwright-core/src/server/recorder/chat.ts b/packages/playwright-core/src/server/recorder/chat.ts
index 5b3917c735..c3ad0238f7 100644
--- a/packages/playwright-core/src/server/recorder/chat.ts
+++ b/packages/playwright-core/src/server/recorder/chat.ts
@@ -15,6 +15,7 @@
*/
import { WebSocketTransport } from '../transport';
+
import type { ConnectionTransport, ProtocolResponse } from '../transport';
export type ChatMessage = {
diff --git a/packages/playwright-core/src/server/recorder/contextRecorder.ts b/packages/playwright-core/src/server/recorder/contextRecorder.ts
index 292271acd5..5cc3e9abae 100644
--- a/packages/playwright-core/src/server/recorder/contextRecorder.ts
+++ b/packages/playwright-core/src/server/recorder/contextRecorder.ts
@@ -14,23 +14,26 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
-import type { Source } from '@recorder/recorderTypes';
import { EventEmitter } from 'events';
+
+import { RecorderCollection } from './recorderCollection';
import * as recorderSource from '../../generated/pollingRecorderSource';
-import { eventsHelper, monotonicTime, quoteCSSAttributeValue, type RegisteredListener } from '../../utils';
+import { eventsHelper, monotonicTime, quoteCSSAttributeValue } from '../../utils';
import { raceAgainstDeadline } from '../../utils/timeoutRunner';
import { BrowserContext } from '../browserContext';
-import type { LanguageGeneratorOptions, Language, LanguageGenerator } from '../codegen/types';
import { languageSet } from '../codegen/languages';
-import type { Dialog } from '../dialog';
import { Frame } from '../frames';
import { Page } from '../page';
-import type * as actions from '@recorder/actions';
import { ThrottledFile } from './throttledFile';
-import { RecorderCollection } from './recorderCollection';
import { generateCode } from '../codegen/language';
+import type { RegisteredListener } from '../../utils';
+import type { Language, LanguageGenerator, LanguageGeneratorOptions } from '../codegen/types';
+import type { Dialog } from '../dialog';
+import type * as channels from '@protocol/channels';
+import type * as actions from '@recorder/actions';
+import type { Source } from '@recorder/recorderTypes';
+
type BindingSource = { frame: Frame, page: Page };
export interface ContextRecorderDelegate {
diff --git a/packages/playwright-core/src/server/recorder/recorderApp.ts b/packages/playwright-core/src/server/recorder/recorderApp.ts
index 05ac4cd0dd..79c7d2d4d0 100644
--- a/packages/playwright-core/src/server/recorder/recorderApp.ts
+++ b/packages/playwright-core/src/server/recorder/recorderApp.ts
@@ -14,20 +14,22 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
-import type { Page } from '../page';
-import { ProgressController } from '../progress';
import { EventEmitter } from 'events';
-import { serverSideCallMetadata } from '../instrumentation';
-import type { CallLog, ElementInfo, Mode, Source } from '@recorder/recorderTypes';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { isUnderTest } from '../../utils';
import { mime } from '../../utilsBundle';
+import { serverSideCallMetadata } from '../instrumentation';
import { syncLocalStorageWithSettings } from '../launchApp';
-import type { BrowserContext } from '../browserContext';
import { launchApp } from '../launchApp';
+import { ProgressController } from '../progress';
+
+import type { BrowserContext } from '../browserContext';
+import type { Page } from '../page';
import type { IRecorder, IRecorderApp, IRecorderAppFactory } from './recorderFrontend';
import type * as actions from '@recorder/actions';
+import type { CallLog, ElementInfo, Mode, Source } from '@recorder/recorderTypes';
export class EmptyRecorderApp extends EventEmitter implements IRecorderApp {
wsEndpointForTest: undefined;
diff --git a/packages/playwright-core/src/server/recorder/recorderCollection.ts b/packages/playwright-core/src/server/recorder/recorderCollection.ts
index 9f28efd930..1780502d7d 100644
--- a/packages/playwright-core/src/server/recorder/recorderCollection.ts
+++ b/packages/playwright-core/src/server/recorder/recorderCollection.ts
@@ -15,14 +15,16 @@
*/
import { EventEmitter } from 'events';
+
+import { performAction } from './recorderRunner';
+import { collapseActions } from './recorderUtils';
+import { isUnderTest } from '../../utils/debug';
+import { monotonicTime } from '../../utils/time';
+
+import type { Signal } from '../../../../recorder/src/actions';
import type { Frame } from '../frames';
import type { Page } from '../page';
-import type { Signal } from '../../../../recorder/src/actions';
import type * as actions from '@recorder/actions';
-import { monotonicTime } from '../../utils/time';
-import { collapseActions } from './recorderUtils';
-import { performAction } from './recorderRunner';
-import { isUnderTest } from '../../utils/debug';
export class RecorderCollection extends EventEmitter {
private _actions: actions.ActionInContext[] = [];
diff --git a/packages/playwright-core/src/server/recorder/recorderFrontend.ts b/packages/playwright-core/src/server/recorder/recorderFrontend.ts
index c6fb6e0a1c..1b97541cb7 100644
--- a/packages/playwright-core/src/server/recorder/recorderFrontend.ts
+++ b/packages/playwright-core/src/server/recorder/recorderFrontend.ts
@@ -15,7 +15,7 @@
*/
import type * as actions from '@recorder/actions';
-import type { CallLog, Mode, Source, ElementInfo } from '@recorder/recorderTypes';
+import type { CallLog, ElementInfo, Mode, Source } from '@recorder/recorderTypes';
import type { EventEmitter } from 'events';
export interface IRecorder {
diff --git a/packages/playwright-core/src/server/recorder/recorderRunner.ts b/packages/playwright-core/src/server/recorder/recorderRunner.ts
index bb225ec5ab..5936060609 100644
--- a/packages/playwright-core/src/server/recorder/recorderRunner.ts
+++ b/packages/playwright-core/src/server/recorder/recorderRunner.ts
@@ -17,10 +17,11 @@
import { serializeExpectedTextValues } from '../../utils';
import { toKeyboardModifiers } from '../codegen/language';
import { serverSideCallMetadata } from '../instrumentation';
+import { buildFullSelector, mainFrameForAction } from './recorderUtils';
+
import type { Page } from '../page';
-import type * as actions from '@recorder/actions';
import type * as types from '../types';
-import { buildFullSelector, mainFrameForAction } from './recorderUtils';
+import type * as actions from '@recorder/actions';
export async function performAction(pageAliases: Map<Page, string>, actionInContext: actions.ActionInContext) {
const callMetadata = serverSideCallMetadata();
diff --git a/packages/playwright-core/src/server/recorder/recorderUtils.ts b/packages/playwright-core/src/server/recorder/recorderUtils.ts
index 77ef329d27..39e8c07557 100644
--- a/packages/playwright-core/src/server/recorder/recorderUtils.ts
+++ b/packages/playwright-core/src/server/recorder/recorderUtils.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+import type { Frame } from '../frames';
import type { CallMetadata } from '../instrumentation';
-import type { CallLog, CallLogStatus } from '@recorder/recorderTypes';
import type { Page } from '../page';
-import type { Frame } from '../frames';
import type * as actions from '@recorder/actions';
+import type { CallLog, CallLogStatus } from '@recorder/recorderTypes';
export function buildFullSelector(framePath: string[], selector: string) {
return [...framePath, selector].join(' >> internal:control=enter-frame >> ');
diff --git a/packages/playwright-core/src/server/registry/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.ts
index 3a6e36b42d..f206382b17 100644
--- a/packages/playwright-core/src/server/registry/browserFetcher.ts
+++ b/packages/playwright-core/src/server/registry/browserFetcher.ts
@@ -15,16 +15,19 @@
* limitations under the License.
*/
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import childProcess from 'child_process';
-import { existsAsync } from '../../utils/fileUtils';
+import * as childProcess from 'child_process';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
import { debugLogger } from '../../utils/debugLogger';
+import { existsAsync } from '../../utils/fileUtils';
import { ManualPromise } from '../../utils/manualPromise';
+import { getUserAgent } from '../../utils/userAgent';
import { colors, progress as ProgressBar } from '../../utilsBundle';
+
import { browserDirectoryToMarkerFilePath } from '.';
-import { getUserAgent } from '../../utils/userAgent';
+
import type { DownloadParams } from './oopDownloadBrowserMain';
export async function downloadBrowserWithProgressBar(title: string, browserDirectory: string, executablePath: string | undefined, downloadURLs: string[], downloadFileName: string, downloadConnectionTimeout: number): Promise<boolean> {
diff --git a/packages/playwright-core/src/server/registry/dependencies.ts b/packages/playwright-core/src/server/registry/dependencies.ts
index 4aa568a6f9..4b61f59058 100644
--- a/packages/playwright-core/src/server/registry/dependencies.ts
+++ b/packages/playwright-core/src/server/registry/dependencies.ts
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
+import * as childProcess from 'child_process';
+import * as fs from 'fs';
import * as os from 'os';
-import childProcess from 'child_process';
+import * as path from 'path';
+
+import { deps } from './nativeDeps';
import * as utils from '../../utils';
-import { spawnAsync } from '../../utils/spawnAsync';
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
-import { buildPlaywrightCLICommand, registry } from '.';
-import { deps } from './nativeDeps';
+import { spawnAsync } from '../../utils/spawnAsync';
import { getPlaywrightVersion } from '../../utils/userAgent';
+import { buildPlaywrightCLICommand, registry } from '.';
+
const BIN_DIRECTORY = path.join(__dirname, '..', '..', '..', 'bin');
const languageBindingVersion = process.env.PW_CLI_DISPLAY_VERSION || require('../../../package.json').version;
diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.ts
index c221fc01c2..a1aa6a68d2 100644
--- a/packages/playwright-core/src/server/registry/index.ts
+++ b/packages/playwright-core/src/server/registry/index.ts
@@ -15,23 +15,27 @@
* limitations under the License.
*/
+import * as fs from 'fs';
import * as os from 'os';
-import path from 'path';
+import * as path from 'path';
import * as util from 'util';
-import * as fs from 'fs';
-import { lockfile } from '../../utilsBundle';
+
+import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';
+import { dockerVersion, readDockerVersionSync, transformCommandsForRoot } from './dependencies';
+import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
+import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand, wrapInASCIIBox } from '../../utils';
+import { debugLogger } from '../../utils/debugLogger';
+import { canAccessFile, existsAsync, removeFolders } from '../../utils/fileUtils';
+import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
import { fetchData } from '../../utils/network';
-import { getEmbedderName } from '../../utils/userAgent';
-import { getFromENV, getAsBooleanFromENV, calculateSha1, wrapInASCIIBox, getPackageManagerExecCommand } from '../../utils';
-import { removeFolders, existsAsync, canAccessFile } from '../../utils/fileUtils';
-import { type HostPlatform, hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
import { spawnAsync } from '../../utils/spawnAsync';
+import { getEmbedderName } from '../../utils/userAgent';
+import { lockfile } from '../../utilsBundle';
+
import type { DependencyGroup } from './dependencies';
-import { transformCommandsForRoot, dockerVersion, readDockerVersionSync } from './dependencies';
-import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
-import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';
+import type { HostPlatform } from '../../utils/hostPlatform';
+
export { writeDockerVersion } from './dependencies';
-import { debugLogger } from '../../utils/debugLogger';
const PACKAGE_PATH = path.join(__dirname, '..', '..', '..');
const BIN_PATH = path.join(__dirname, '..', '..', '..', 'bin');
diff --git a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
index 247581277e..765e5b89a8 100644
--- a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
+++ b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
-import { httpRequest } from '../../utils/network';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { ManualPromise } from '../../utils/manualPromise';
+import { httpRequest } from '../../utils/network';
import { extract } from '../../zipBundle';
export type DownloadParams = {
diff --git a/packages/playwright-core/src/server/screenshotter.ts b/packages/playwright-core/src/server/screenshotter.ts
index 485560b539..88870b8900 100644
--- a/packages/playwright-core/src/server/screenshotter.ts
+++ b/packages/playwright-core/src/server/screenshotter.ts
@@ -15,17 +15,19 @@
* limitations under the License.
*/
-import type * as dom from './dom';
-import type { Rect } from '../common/types';
import { helper } from './helper';
-import type { Page } from './page';
-import type { Frame } from './frames';
-import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
-import type * as types from './types';
-import type { Progress } from './progress';
import { assert } from '../utils';
import { MultiMap } from '../utils/multimap';
+import type * as dom from './dom';
+import type { Frame } from './frames';
+import type { Page } from './page';
+import type { Progress } from './progress';
+import type * as types from './types';
+import type { Rect } from '../common/types';
+import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
+
+
declare global {
interface Window {
__pwCleanupScreenshot?: () => void;
diff --git a/packages/playwright-core/src/server/selectors.ts b/packages/playwright-core/src/server/selectors.ts
index edc11b9a86..1d1eece9cc 100644
--- a/packages/playwright-core/src/server/selectors.ts
+++ b/packages/playwright-core/src/server/selectors.ts
@@ -14,8 +14,10 @@
* limitations under the License.
*/
-import { visitAllSelectorParts, InvalidSelectorError, type ParsedSelector, parseSelector, stringifySelector } from '../utils/isomorphic/selectorParser';
import { createGuid } from '../utils';
+import { InvalidSelectorError, parseSelector, stringifySelector, visitAllSelectorParts } from '../utils/isomorphic/selectorParser';
+
+import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
export class Selectors {
private readonly _builtinEngines: Set<string>;
diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
index 6413cd1ddf..05e6b374c9 100644
--- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
+++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
@@ -14,20 +14,22 @@
* limitations under the License.
*/
-import net from 'net';
-import http2 from 'http2';
-import type https from 'https';
-import tls from 'tls';
-import stream from 'stream';
-import { createSocket, createTLSSocket } from '../utils/happy-eyeballs';
-import { escapeHTML, generateSelfSignedCertificate, ManualPromise, rewriteErrorMessage } from '../utils';
-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../common/socksProxy';
-import { SocksProxy } from '../common/socksProxy';
-import type * as types from './types';
-import { debugLogger } from '../utils/debugLogger';
-import { createProxyAgent } from './fetch';
import { EventEmitter } from 'events';
+import * as http2 from 'http2';
+import * as net from 'net';
+import * as stream from 'stream';
+import * as tls from 'tls';
+
+import { SocksProxy } from '../common/socksProxy';
+import { ManualPromise, escapeHTML, generateSelfSignedCertificate, rewriteErrorMessage } from '../utils';
import { verifyClientCertificates } from './browserContext';
+import { createProxyAgent } from './fetch';
+import { debugLogger } from '../utils/debugLogger';
+import { createSocket, createTLSSocket } from '../utils/happy-eyeballs';
+
+import type * as types from './types';
+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../common/socksProxy';
+import type https from 'https';
let dummyServerTlsOptions: tls.TlsOptions | undefined = undefined;
function loadDummyServerCertsIfNeeded() {
diff --git a/packages/playwright-core/src/server/socksInterceptor.ts b/packages/playwright-core/src/server/socksInterceptor.ts
index 6b29636a00..61309ab11d 100644
--- a/packages/playwright-core/src/server/socksInterceptor.ts
+++ b/packages/playwright-core/src/server/socksInterceptor.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import * as socks from '../common/socksProxy';
import EventEmitter from 'events';
-import type * as channels from '@protocol/channels';
+
+import * as socks from '../common/socksProxy';
+import { ValidationError, findValidator } from '../protocol/validator';
+
import type { WebSocketTransport } from './transport';
-import { findValidator, ValidationError } from '../protocol/validator';
import type { ValidatorContext } from '../protocol/validator';
+import type * as channels from '@protocol/channels';
export class SocksInterceptor {
private _handler: socks.SocksProxyHandler;
diff --git a/packages/playwright-core/src/server/storageScript.ts b/packages/playwright-core/src/server/storageScript.ts
index 04e6b3f6d1..fb4ca02082 100644
--- a/packages/playwright-core/src/server/storageScript.ts
+++ b/packages/playwright-core/src/server/storageScript.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type * as channels from '@protocol/channels';
import type { source } from './isomorphic/utilityScriptSerializers';
+import type * as channels from '@protocol/channels';
export type Storage = Omit<channels.OriginStorage, 'origin'>;
diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
index 115cd3dd94..1ad2fdf1ca 100644
--- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
+++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
@@ -14,17 +14,18 @@
* limitations under the License.
*/
+import { frameSnapshotStreamer } from './snapshotterInjected';
+import { calculateSha1, createGuid, monotonicTime } from '../../../utils';
+import { debugLogger } from '../../../utils/debugLogger';
+import { eventsHelper } from '../../../utils/eventsHelper';
+import { mime } from '../../../utilsBundle';
import { BrowserContext } from '../../browserContext';
import { Page } from '../../page';
+
+import type { SnapshotData } from './snapshotterInjected';
import type { RegisteredListener } from '../../../utils/eventsHelper';
-import { eventsHelper } from '../../../utils/eventsHelper';
-import { debugLogger } from '../../../utils/debugLogger';
import type { Frame } from '../../frames';
-import type { SnapshotData } from './snapshotterInjected';
-import { frameSnapshotStreamer } from './snapshotterInjected';
-import { calculateSha1, createGuid, monotonicTime } from '../../../utils';
import type { FrameSnapshot } from '@trace/snapshot';
-import { mime } from '../../../utilsBundle';
export type SnapshotterBlob = {
buffer: Buffer,
diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.ts
index 6f6724e368..a245de16f6 100644
--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts
+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts
@@ -14,31 +14,34 @@
* limitations under the License.
*/
-import fs from 'fs';
-import os from 'os';
-import path from 'path';
-import type { NameValue } from '../../../common/types';
-import type { TracingTracingStopChunkParams, StackFrame } from '@protocol/channels';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+import { Snapshotter } from './snapshotter';
import { commandsWithTracingSnapshots } from '../../../protocol/debug';
-import { assert, createGuid, monotonicTime, SerializedFS, removeFolders, eventsHelper, type RegisteredListener } from '../../../utils';
+import { SerializedFS, assert, createGuid, eventsHelper, monotonicTime, removeFolders } from '../../../utils';
import { Artifact } from '../../artifact';
import { BrowserContext } from '../../browserContext';
-import type { APIRequestContext } from '../../fetch';
-import type { CallMetadata, InstrumentationListener } from '../../instrumentation';
+import { Dispatcher } from '../../dispatchers/dispatcher';
+import { serializeError } from '../../errors';
+import { HarTracer } from '../../har/harTracer';
import { SdkObject } from '../../instrumentation';
import { Page } from '../../page';
-import type * as har from '@trace/har';
-import type { HarTracerDelegate } from '../../har/harTracer';
-import { HarTracer } from '../../har/harTracer';
-import type { FrameSnapshot } from '@trace/snapshot';
-import type * as trace from '@trace/trace';
+
import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter';
-import { Snapshotter } from './snapshotter';
+import type { NameValue } from '../../../common/types';
+import type { RegisteredListener } from '../../../utils';
import type { ConsoleMessage } from '../../console';
-import { Dispatcher } from '../../dispatchers/dispatcher';
-import { serializeError } from '../../errors';
import type { Dialog } from '../../dialog';
import type { Download } from '../../download';
+import type { APIRequestContext } from '../../fetch';
+import type { HarTracerDelegate } from '../../har/harTracer';
+import type { CallMetadata, InstrumentationListener } from '../../instrumentation';
+import type { StackFrame, TracingTracingStopChunkParams } from '@protocol/channels';
+import type * as har from '@trace/har';
+import type { FrameSnapshot } from '@trace/snapshot';
+import type * as trace from '@trace/trace';
const version: trace.VERSION = 7;
diff --git a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
index d5da0e4229..36d4cf655e 100644
--- a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
+++ b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-import type { BrowserContext } from '../../browserContext';
-import type { Page } from '../../page';
-import type { FrameSnapshot } from '@trace/snapshot';
-import type { SnapshotRenderer } from '../../../../../trace-viewer/src/sw/snapshotRenderer';
import { SnapshotStorage } from '../../../../../trace-viewer/src/sw/snapshotStorage';
-import type { SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter';
+import { ManualPromise } from '../../../utils';
+import { HarTracer } from '../../har/harTracer';
import { Snapshotter } from '../recorder/snapshotter';
+
+import type { SnapshotRenderer } from '../../../../../trace-viewer/src/sw/snapshotRenderer';
+import type { BrowserContext } from '../../browserContext';
import type { HarTracerDelegate } from '../../har/harTracer';
-import { HarTracer } from '../../har/harTracer';
+import type { Page } from '../../page';
+import type { SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter';
import type * as har from '@trace/har';
-import { ManualPromise } from '../../../utils';
+import type { FrameSnapshot } from '@trace/snapshot';
+
export class InMemorySnapshotter implements SnapshotterDelegate, HarTracerDelegate {
private _blobs = new Map<string, Buffer>();
diff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts
index 55cbca1cad..ad9de86715 100644
--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts
+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-import path from 'path';
-import fs from 'fs';
-import { HttpServer } from '../../../utils/httpServer';
-import type { Transport } from '../../../utils/httpServer';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { gracefullyProcessExitDoNotHang, isUnderTest } from '../../../utils';
-import { syncLocalStorageWithSettings } from '../../launchApp';
+import { HttpServer } from '../../../utils/httpServer';
+import { open } from '../../../utilsBundle';
import { serverSideCallMetadata } from '../../instrumentation';
+import { syncLocalStorageWithSettings } from '../../launchApp';
+import { launchApp } from '../../launchApp';
import { createPlaywright } from '../../playwright';
import { ProgressController } from '../../progress';
-import { open } from '../../../utilsBundle';
-import type { Page } from '../../page';
+
+import type { Transport } from '../../../utils/httpServer';
import type { BrowserType } from '../../browserType';
-import { launchApp } from '../../launchApp';
+import type { Page } from '../../page';
export type TraceViewerServerOptions = {
host?: string;
diff --git a/packages/playwright-core/src/server/transport.ts b/packages/playwright-core/src/server/transport.ts
index 507225b04c..6de9f9ca8e 100644
--- a/packages/playwright-core/src/server/transport.ts
+++ b/packages/playwright-core/src/server/transport.ts
@@ -15,13 +15,14 @@
* limitations under the License.
*/
+import { makeWaitForNextTask } from '../utils';
+import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from '../utils/happy-eyeballs';
import { ws } from '../utilsBundle';
+
import type { WebSocket } from '../utilsBundle';
-import type { ClientRequest, IncomingMessage } from 'http';
import type { Progress } from './progress';
-import { makeWaitForNextTask } from '../utils';
-import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from '../utils/happy-eyeballs';
import type { HeadersArray } from './types';
+import type { ClientRequest, IncomingMessage } from 'http';
export const perMessageDeflate = {
clientNoContextTakeover: true,
diff --git a/packages/playwright-core/src/server/types.ts b/packages/playwright-core/src/server/types.ts
index b5603f19e6..e7bf2c11f3 100644
--- a/packages/playwright-core/src/server/types.ts
+++ b/packages/playwright-core/src/server/types.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import type { Size, Point, TimeoutOptions, HeadersArray } from '../common/types';
-export type { Size, Point, Rect, Quad, TimeoutOptions, HeadersArray } from '../common/types';
+import type { HeadersArray, Point, Size, TimeoutOptions } from '../common/types';
+export type { HeadersArray, Point, Quad, Rect, Size, TimeoutOptions } from '../common/types';
import type * as channels from '@protocol/channels';
export type StrictOptions = {
diff --git a/packages/playwright-core/src/server/webkit/webkit.ts b/packages/playwright-core/src/server/webkit/webkit.ts
index 5159f8cecb..69273b8e95 100644
--- a/packages/playwright-core/src/server/webkit/webkit.ts
+++ b/packages/playwright-core/src/server/webkit/webkit.ts
@@ -15,17 +15,19 @@
* limitations under the License.
*/
-import { WKBrowser } from '../webkit/wkBrowser';
-import type { Env } from '../../utils/processLauncher';
-import path from 'path';
+import * as path from 'path';
+
import { kBrowserCloseMessageId } from './wkConnection';
+import { wrapInASCIIBox } from '../../utils';
import { BrowserType, kNoXServerRunningError } from '../browserType';
-import type { ConnectionTransport } from '../transport';
+import { WKBrowser } from '../webkit/wkBrowser';
+
+import type { Env } from '../../utils/processLauncher';
import type { BrowserOptions } from '../browser';
-import type * as types from '../types';
-import { wrapInASCIIBox } from '../../utils';
import type { SdkObject } from '../instrumentation';
import type { ProtocolError } from '../protocolError';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
export class WebKit extends BrowserType {
constructor(parent: SdkObject) {
diff --git a/packages/playwright-core/src/server/webkit/wkAccessibility.ts b/packages/playwright-core/src/server/webkit/wkAccessibility.ts
index 80c855ea7b..52b9199df5 100644
--- a/packages/playwright-core/src/server/webkit/wkAccessibility.ts
+++ b/packages/playwright-core/src/server/webkit/wkAccessibility.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import type * as accessibility from '../accessibility';
-import type { WKSession } from './wkConnection';
import type { Protocol } from './protocol';
+import type { WKSession } from './wkConnection';
import type * as dom from '../dom';
import type * as channels from '@protocol/channels';
diff --git a/packages/playwright-core/src/server/webkit/wkBrowser.ts b/packages/playwright-core/src/server/webkit/wkBrowser.ts
index 86833088d8..4924abe77e 100644
--- a/packages/playwright-core/src/server/webkit/wkBrowser.ts
+++ b/packages/playwright-core/src/server/webkit/wkBrowser.ts
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-import type { BrowserOptions } from '../browser';
-import { Browser } from '../browser';
-import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
import { assert } from '../../utils';
+import { Browser } from '../browser';
+import { BrowserContext, assertBrowserContextIsNotOwned, verifyGeolocation } from '../browserContext';
import * as network from '../network';
+import { WKConnection, WKSession, kPageProxyMessageReceived } from './wkConnection';
+import { WKPage } from './wkPage';
+import { TargetClosedError } from '../errors';
+
+import type { BrowserOptions } from '../browser';
+import type { SdkObject } from '../instrumentation';
import type { InitScript, Page } from '../page';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
-import type * as channels from '@protocol/channels';
import type { Protocol } from './protocol';
import type { PageProxyMessageReceivedPayload } from './wkConnection';
-import { kPageProxyMessageReceived, WKConnection, WKSession } from './wkConnection';
-import { WKPage } from './wkPage';
-import { TargetClosedError } from '../errors';
-import type { SdkObject } from '../instrumentation';
+import type * as channels from '@protocol/channels';
const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15';
const BROWSER_VERSION = '18.2';
diff --git a/packages/playwright-core/src/server/webkit/wkConnection.ts b/packages/playwright-core/src/server/webkit/wkConnection.ts
index a2bbed1121..0012d8702f 100644
--- a/packages/playwright-core/src/server/webkit/wkConnection.ts
+++ b/packages/playwright-core/src/server/webkit/wkConnection.ts
@@ -16,14 +16,17 @@
*/
import { EventEmitter } from 'events';
+
import { assert } from '../../utils';
+import { debugLogger } from '../../utils/debugLogger';
+import { helper } from '../helper';
+import { ProtocolError } from '../protocolError';
+
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import type { Protocol } from './protocol';
import type { RecentLogsCollector } from '../../utils/debugLogger';
-import { debugLogger } from '../../utils/debugLogger';
import type { ProtocolLogger } from '../types';
-import { helper } from '../helper';
-import { ProtocolError } from '../protocolError';
+
// WKPlaywright uses this special id to issue Browser.close command which we
// should ignore.
diff --git a/packages/playwright-core/src/server/webkit/wkExecutionContext.ts b/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
index 2b75745cbd..2101b6002b 100644
--- a/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
+++ b/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-import type { WKSession } from './wkConnection';
-import type { Protocol } from './protocol';
-import * as js from '../javascript';
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
+import * as js from '../javascript';
import { isSessionClosedError } from '../protocolError';
+import type { Protocol } from './protocol';
+import type { WKSession } from './wkConnection';
+
export class WKExecutionContext implements js.ExecutionContextDelegate {
private readonly _session: WKSession;
readonly _contextId: number | undefined;
diff --git a/packages/playwright-core/src/server/webkit/wkInput.ts b/packages/playwright-core/src/server/webkit/wkInput.ts
index 5769fd6465..1e4ccf6b0b 100644
--- a/packages/playwright-core/src/server/webkit/wkInput.ts
+++ b/packages/playwright-core/src/server/webkit/wkInput.ts
@@ -15,11 +15,12 @@
* limitations under the License.
*/
+import { isString } from '../../utils';
import * as input from '../input';
-import type * as types from '../types';
import { macEditingCommands } from '../macEditingCommands';
+
+import type * as types from '../types';
import type { WKSession } from './wkConnection';
-import { isString } from '../../utils';
import type { Page } from '../page';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
diff --git a/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts b/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
index 93367726ed..45494d6cc9 100644
--- a/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
+++ b/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-import type * as frames from '../frames';
+import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
import * as network from '../network';
+
+import type * as frames from '../frames';
import type * as types from '../types';
import type { Protocol } from './protocol';
import type { WKSession } from './wkConnection';
-import { assert, headersObjectToArray, headersArrayToObject } from '../../utils';
+
const errorReasons: { [reason: string]: Protocol.Network.ResourceErrorType } = {
'aborted': 'Cancellation',
diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.ts
index 4a78642668..e80031d388 100644
--- a/packages/playwright-core/src/server/webkit/wkPage.ts
+++ b/packages/playwright-core/src/server/webkit/wkPage.ts
@@ -15,27 +15,22 @@
* limitations under the License.
*/
-import path from 'path';
-import { PNG, jpegjs } from '../../utilsBundle';
-import { splitErrorMessage } from '../../utils/stackTrace';
+import * as path from 'path';
+
import { assert, createGuid, debugAssert, headersArrayToObject } from '../../utils';
+import { eventsHelper } from '../../utils/eventsHelper';
import { hostPlatform } from '../../utils/hostPlatform';
-import type * as accessibility from '../accessibility';
+import { splitErrorMessage } from '../../utils/stackTrace';
+import { PNG, jpegjs } from '../../utilsBundle';
+import { BrowserContext } from '../browserContext';
import * as dialog from '../dialog';
import * as dom from '../dom';
-import type * as frames from '../frames';
-import type { RegisteredListener } from '../../utils/eventsHelper';
-import { eventsHelper } from '../../utils/eventsHelper';
+import { TargetClosedError } from '../errors';
import { helper } from '../helper';
-import type { JSHandle } from '../javascript';
import * as network from '../network';
-import { type InitScript, PageBinding, type PageDelegate } from '../page';
+import { PageBinding } from '../page';
import { Page } from '../page';
-import type { Progress } from '../progress';
-import type * as types from '../types';
-import type { Protocol } from './protocol';
import { getAccessibilityTree } from './wkAccessibility';
-import type { WKBrowserContext } from './wkBrowser';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './wkInput';
@@ -43,8 +38,16 @@ import { WKInterceptableRequest, WKRouteImpl } from './wkInterceptableRequest';
import { WKProvisionalPage } from './wkProvisionalPage';
import { WKWorkers } from './wkWorkers';
import { debugLogger } from '../../utils/debugLogger';
-import { BrowserContext } from '../browserContext';
-import { TargetClosedError } from '../errors';
+
+import type { Protocol } from './protocol';
+import type { WKBrowserContext } from './wkBrowser';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type * as accessibility from '../accessibility';
+import type * as frames from '../frames';
+import type { JSHandle } from '../javascript';
+import type { InitScript, PageDelegate } from '../page';
+import type { Progress } from '../progress';
+import type * as types from '../types';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
diff --git a/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts b/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
index 6d7459c978..2958f4597c 100644
--- a/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
+++ b/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
+import { assert } from '../../utils';
+import { eventsHelper } from '../../utils/eventsHelper';
+
+import type { Protocol } from './protocol';
import type { WKSession } from './wkConnection';
import type { WKPage } from './wkPage';
import type { RegisteredListener } from '../../utils/eventsHelper';
-import { eventsHelper } from '../../utils/eventsHelper';
-import type { Protocol } from './protocol';
-import { assert } from '../../utils';
import type * as network from '../network';
export class WKProvisionalPage {
diff --git a/packages/playwright-core/src/server/webkit/wkWorkers.ts b/packages/playwright-core/src/server/webkit/wkWorkers.ts
index ae69b72f8a..644c64a27f 100644
--- a/packages/playwright-core/src/server/webkit/wkWorkers.ts
+++ b/packages/playwright-core/src/server/webkit/wkWorkers.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
-import type { Page } from '../page';
import { Worker } from '../page';
-import type { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
+
+import type { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import type { Page } from '../page';
import type * as types from '../types';
export class WKWorkers {
diff --git a/packages/playwright-core/src/utils/comparators.ts b/packages/playwright-core/src/utils/comparators.ts
index c848200d66..ac6bc24421 100644
--- a/packages/playwright-core/src/utils/comparators.ts
+++ b/packages/playwright-core/src/utils/comparators.ts
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import { colors, jpegjs } from '../utilsBundle';
+import { compare } from '../image_tools/compare';
// @ts-ignore
import pixelmatch from '../third_party/pixelmatch';
-import { compare } from '../image_tools/compare';
+import { colors, jpegjs } from '../utilsBundle';
import { diff } from '../utilsBundle';
import { PNG } from '../utilsBundle';
diff --git a/packages/playwright-core/src/utils/crypto.ts b/packages/playwright-core/src/utils/crypto.ts
index f538912d24..c59b84caf0 100644
--- a/packages/playwright-core/src/utils/crypto.ts
+++ b/packages/playwright-core/src/utils/crypto.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import crypto from 'crypto';
+import * as crypto from 'crypto';
+
import { assert } from './debug';
export function createGuid(): string {
diff --git a/packages/playwright-core/src/utils/debugLogger.ts b/packages/playwright-core/src/utils/debugLogger.ts
index d50180a2ed..24b0a1dbf8 100644
--- a/packages/playwright-core/src/utils/debugLogger.ts
+++ b/packages/playwright-core/src/utils/debugLogger.ts
@@ -14,8 +14,9 @@
* limitations under the License.
*/
+import * as fs from 'fs';
+
import { debug } from '../utilsBundle';
-import fs from 'fs';
const debugLoggerColorMap = {
'api': 45, // cyan
diff --git a/packages/playwright-core/src/utils/expectUtils.ts b/packages/playwright-core/src/utils/expectUtils.ts
index 0ae21e8602..f39af23cee 100644
--- a/packages/playwright-core/src/utils/expectUtils.ts
+++ b/packages/playwright-core/src/utils/expectUtils.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { ExpectedTextValue } from '@protocol/channels';
import { isRegExp, isString } from './rtti';
+import type { ExpectedTextValue } from '@protocol/channels';
+
export function serializeExpectedTextValues(items: (string | RegExp)[], options: { matchSubstring?: boolean, normalizeWhiteSpace?: boolean, ignoreCase?: boolean } = {}): ExpectedTextValue[] {
return items.map(i => ({
string: isString(i) ? i : undefined,
diff --git a/packages/playwright-core/src/utils/fileUtils.ts b/packages/playwright-core/src/utils/fileUtils.ts
index b7f441aa37..8cfd3d1fe0 100644
--- a/packages/playwright-core/src/utils/fileUtils.ts
+++ b/packages/playwright-core/src/utils/fileUtils.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { ManualPromise } from './manualPromise';
-import type { EventEmitter } from 'events';
import { yazl } from '../zipBundle';
+import type { EventEmitter } from 'events';
+
export const fileUploadSizeLimit = 50 * 1024 * 1024;
export const existsAsync = (path: string): Promise<boolean> => new Promise(resolve => fs.stat(path, err => resolve(!err)));
diff --git a/packages/playwright-core/src/utils/happy-eyeballs.ts b/packages/playwright-core/src/utils/happy-eyeballs.ts
index 02b78de4f0..48e1909371 100644
--- a/packages/playwright-core/src/utils/happy-eyeballs.ts
+++ b/packages/playwright-core/src/utils/happy-eyeballs.ts
@@ -19,8 +19,9 @@ import * as http from 'http';
import * as https from 'https';
import * as net from 'net';
import * as tls from 'tls';
-import { ManualPromise } from './manualPromise';
+
import { assert } from './debug';
+import { ManualPromise } from './manualPromise';
import { monotonicTime } from './time';
// Implementation(partial) of Happy Eyeballs 2 algorithm described in
diff --git a/packages/playwright-core/src/utils/hostPlatform.ts b/packages/playwright-core/src/utils/hostPlatform.ts
index 0563e4ab29..058b5b9f78 100644
--- a/packages/playwright-core/src/utils/hostPlatform.ts
+++ b/packages/playwright-core/src/utils/hostPlatform.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import os from 'os';
+import * as os from 'os';
+
import { getLinuxDistributionInfoSync } from './linuxUtils';
export type HostPlatform = 'win64' |
diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/utils/httpServer.ts
index 1d78df4659..71b0754b8f 100644
--- a/packages/playwright-core/src/utils/httpServer.ts
+++ b/packages/playwright-core/src/utils/httpServer.ts
@@ -14,14 +14,16 @@
* limitations under the License.
*/
-import type http from 'http';
-import fs from 'fs';
-import path from 'path';
+import * as fs from 'fs';
+import * as path from 'path';
+
import { mime, wsServer } from '../utilsBundle';
+import { createGuid } from './crypto';
import { assert } from './debug';
-import { createHttpServer } from './network';
import { ManualPromise } from './manualPromise';
-import { createGuid } from './crypto';
+import { createHttpServer } from './network';
+
+import type http from 'http';
export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => boolean;
diff --git a/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts b/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts
index 355d0cec5f..77ce63f313 100644
--- a/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts
+++ b/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts
@@ -14,8 +14,10 @@
* limitations under the License.
*/
+import { parseAttributeSelector, parseSelector, stringifySelector } from './selectorParser';
import { escapeWithQuotes, normalizeEscapedRegexQuotes, toSnakeCase, toTitleCase } from './stringUtils';
-import { type NestedSelectorBody, parseAttributeSelector, parseSelector, stringifySelector } from './selectorParser';
+
+import type { NestedSelectorBody } from './selectorParser';
import type { ParsedSelector } from './selectorParser';
export type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
diff --git a/packages/playwright-core/src/utils/isomorphic/locatorParser.ts b/packages/playwright-core/src/utils/isomorphic/locatorParser.ts
index fff3d078ff..f89dbb50f7 100644
--- a/packages/playwright-core/src/utils/isomorphic/locatorParser.ts
+++ b/packages/playwright-core/src/utils/isomorphic/locatorParser.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import { escapeForAttributeSelector, escapeForTextSelector } from './stringUtils';
import { asLocators } from './locatorGenerators';
-import type { Language, Quote } from './locatorGenerators';
import { parseSelector } from './selectorParser';
+import { escapeForAttributeSelector, escapeForTextSelector } from './stringUtils';
+
+import type { Language, Quote } from './locatorGenerators';
type TemplateParams = { quote: string, text: string }[];
function parseLocator(locator: string, testIdAttributeName: string): { selector: string, preferredQuote: Quote | undefined } {
diff --git a/packages/playwright-core/src/utils/isomorphic/selectorParser.ts b/packages/playwright-core/src/utils/isomorphic/selectorParser.ts
index 64ba3c0c4d..f37d1ef4c3 100644
--- a/packages/playwright-core/src/utils/isomorphic/selectorParser.ts
+++ b/packages/playwright-core/src/utils/isomorphic/selectorParser.ts
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-import type { CSSComplexSelectorList } from './cssParser';
import { InvalidSelectorError, parseCSS } from './cssParser';
+
+import type { CSSComplexSelectorList } from './cssParser';
export { InvalidSelectorError, isInvalidSelectorError } from './cssParser';
export type NestedSelectorBody = { parsed: ParsedSelector, distance?: number };
diff --git a/packages/playwright-core/src/utils/linuxUtils.ts b/packages/playwright-core/src/utils/linuxUtils.ts
index 5d98c823a5..c51d32f9d5 100644
--- a/packages/playwright-core/src/utils/linuxUtils.ts
+++ b/packages/playwright-core/src/utils/linuxUtils.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import fs from 'fs';
+import * as fs from 'fs';
let didFailToReadOSRelease = false;
let osRelease: {
diff --git a/packages/playwright-core/src/utils/network.ts b/packages/playwright-core/src/utils/network.ts
index b800a8773d..5c5b851705 100644
--- a/packages/playwright-core/src/utils/network.ts
+++ b/packages/playwright-core/src/utils/network.ts
@@ -15,15 +15,17 @@
*/
-import http from 'http';
-import https from 'https';
-import http2 from 'http2';
-import type net from 'net';
+import * as http from 'http';
+import * as http2 from 'http2';
+import * as https from 'https';
+import * as url from 'url';
+
import { getProxyForUrl } from '../utilsBundle';
import { HttpsProxyAgent } from '../utilsBundle';
-import url from 'url';
import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from './happy-eyeballs';
+import type net from 'net';
+
export type HTTPRequestParams = {
url: string,
method?: string,
diff --git a/packages/playwright-core/src/utils/processLauncher.ts b/packages/playwright-core/src/utils/processLauncher.ts
index 1310f95277..68176acc8b 100644
--- a/packages/playwright-core/src/utils/processLauncher.ts
+++ b/packages/playwright-core/src/utils/processLauncher.ts
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-import fs from 'fs';
import * as childProcess from 'child_process';
+import * as fs from 'fs';
import * as readline from 'readline';
-import { isUnderTest } from './';
+
import { removeFolders } from './fileUtils';
+import { isUnderTest } from './';
+
export type Env = {[key: string]: string | number | boolean | undefined};
export type LaunchProcessOptions = {
diff --git a/packages/playwright-core/src/utils/spawnAsync.ts b/packages/playwright-core/src/utils/spawnAsync.ts
index 8e286fad47..f68719d620 100644
--- a/packages/playwright-core/src/utils/spawnAsync.ts
+++ b/packages/playwright-core/src/utils/spawnAsync.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import type { SpawnOptions } from 'child_process';
import { spawn } from 'child_process';
+import type { SpawnOptions } from 'child_process';
+
export function spawnAsync(cmd: string, args: string[], options: SpawnOptions = {}): Promise<{stdout: string, stderr: string, code: number | null, error?: Error}> {
const process = spawn(cmd, args, Object.assign({ windowsHide: true }, options));
diff --git a/packages/playwright-core/src/utils/stackTrace.ts b/packages/playwright-core/src/utils/stackTrace.ts
index eba52a30f2..bcab6c7230 100644
--- a/packages/playwright-core/src/utils/stackTrace.ts
+++ b/packages/playwright-core/src/utils/stackTrace.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import path from 'path';
+import * as path from 'path';
+
import { parseStackTraceLine } from '../utilsBundle';
-import type { StackFrame } from '@protocol/channels';
import { colors } from '../utilsBundle';
import { findRepeatedSubsequences } from './sequence';
+import type { StackFrame } from '@protocol/channels';
+
export function rewriteErrorMessage<E extends Error>(e: E, newMessage: string): E {
const lines: string[] = (e.stack?.split('\n') || []).filter(l => l.startsWith(' at '));
e.message = newMessage;
diff --git a/packages/playwright-core/src/utils/traceUtils.ts b/packages/playwright-core/src/utils/traceUtils.ts
index d0090b3665..c6ecc7988b 100644
--- a/packages/playwright-core/src/utils/traceUtils.ts
+++ b/packages/playwright-core/src/utils/traceUtils.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { ClientSideCallMetadata } from '@protocol/channels';
import type { SerializedClientSideCallMetadata, SerializedStack, SerializedStackFrame } from './isomorphic/traceUtils';
+import type { ClientSideCallMetadata } from '@protocol/channels';
export function serializeClientSideCallMetadata(metadatas: ClientSideCallMetadata[]): SerializedClientSideCallMetadata {
const fileNames = new Map<string, number>();
diff --git a/packages/playwright-core/src/utils/userAgent.ts b/packages/playwright-core/src/utils/userAgent.ts
index 17b1bc51c8..40bb41a49f 100644
--- a/packages/playwright-core/src/utils/userAgent.ts
+++ b/packages/playwright-core/src/utils/userAgent.ts
@@ -15,9 +15,10 @@
*/
import { execSync } from 'child_process';
-import os from 'os';
-import { getLinuxDistributionInfoSync } from '../utils/linuxUtils';
+import * as os from 'os';
+
import { wrapInASCIIBox } from './ascii';
+import { getLinuxDistributionInfoSync } from '../utils/linuxUtils';
let cachedUserAgent: string | undefined;
diff --git a/packages/playwright-core/src/utils/wsServer.ts b/packages/playwright-core/src/utils/wsServer.ts
index 636a57c3cc..f6ba7f6b1b 100644
--- a/packages/playwright-core/src/utils/wsServer.ts
+++ b/packages/playwright-core/src/utils/wsServer.ts
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-import type http from 'http';
-import type stream from 'stream';
import { createHttpServer } from '../utils';
-import type { WebSocketServer, WebSocket } from '../utilsBundle';
import { wsServer } from '../utilsBundle';
import { debugLogger } from './debugLogger';
+import type { WebSocket, WebSocketServer } from '../utilsBundle';
+import type http from 'http';
+import type stream from 'stream';
+
+
let lastConnectionId = 0;
const kConnectionSymbol = Symbol('kConnection');
diff --git a/packages/playwright-core/src/utils/zipFile.ts b/packages/playwright-core/src/utils/zipFile.ts
index 3ae68b1650..1f70c5e1bc 100644
--- a/packages/playwright-core/src/utils/zipFile.ts
+++ b/packages/playwright-core/src/utils/zipFile.ts
@@ -15,7 +15,8 @@
*/
import { yauzl } from '../zipBundle';
-import type { UnzipFile, Entry } from '../zipBundle';
+
+import type { Entry, UnzipFile } from '../zipBundle';
export class ZipFile {
private _fileName: string;
diff --git a/packages/playwright-core/src/utilsBundle.ts b/packages/playwright-core/src/utilsBundle.ts
index fba52c05a8..5e7dd3771a 100644
--- a/packages/playwright-core/src/utilsBundle.ts
+++ b/packages/playwright-core/src/utilsBundle.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import url from 'url';
-import path from 'path';
+import * as path from 'path';
+import * as url from 'url';
export const colors: typeof import('../bundles/utils/node_modules/colors/safe') = require('./utilsBundleImpl').colors;
export const debug: typeof import('../bundles/utils/node_modules/@types/debug') = require('./utilsBundleImpl').debug;
@@ -33,13 +33,13 @@ export const program: typeof import('../bundles/utils/node_modules/commander').p
export const progress: typeof import('../bundles/utils/node_modules/@types/progress') = require('./utilsBundleImpl').progress;
export const SocksProxyAgent: typeof import('../bundles/utils/node_modules/socks-proxy-agent').SocksProxyAgent = require('./utilsBundleImpl').SocksProxyAgent;
export const yaml: typeof import('../bundles/utils/node_modules/yaml') = require('./utilsBundleImpl').yaml;
-export type { Scalar as YAMLScalar, YAMLSeq, YAMLMap, YAMLError, Range as YAMLRange } from '../bundles/utils/node_modules/yaml';
+export type { Range as YAMLRange, Scalar as YAMLScalar, YAMLError, YAMLMap, YAMLSeq } from '../bundles/utils/node_modules/yaml';
export const ws: typeof import('../bundles/utils/node_modules/@types/ws') = require('./utilsBundleImpl').ws;
export const wsServer: typeof import('../bundles/utils/node_modules/@types/ws').WebSocketServer = require('./utilsBundleImpl').wsServer;
export const wsReceiver = require('./utilsBundleImpl').wsReceiver;
export const wsSender = require('./utilsBundleImpl').wsSender;
export type { Command } from '../bundles/utils/node_modules/commander';
-export type { WebSocket, WebSocketServer, RawData as WebSocketRawData, EventEmitter as WebSocketEventEmitter } from '../bundles/utils/node_modules/@types/ws';
+export type { EventEmitter as WebSocketEventEmitter, RawData as WebSocketRawData, WebSocket, WebSocketServer } from '../bundles/utils/node_modules/@types/ws';
import type { StackFrame } from '@protocol/channels';
const StackUtils: typeof import('../bundles/utils/node_modules/@types/stack-utils') = require('./utilsBundleImpl').StackUtils;
diff --git a/packages/playwright-core/src/zipBundle.ts b/packages/playwright-core/src/zipBundle.ts
index 9c275873a8..22569758b6 100644
--- a/packages/playwright-core/src/zipBundle.ts
+++ b/packages/playwright-core/src/zipBundle.ts
@@ -17,5 +17,5 @@
export const yazl: typeof import('../bundles/zip/node_modules/@types/yazl') = require('./zipBundleImpl').yazl;
export type { ZipFile } from '../bundles/zip/node_modules/@types/yazl';
export const yauzl: typeof import('../bundles/zip/node_modules/@types/yauzl') = require('./zipBundleImpl').yauzl;
-export type { ZipFile as UnzipFile, Entry } from '../bundles/zip/node_modules/@types/yauzl';
+export type { Entry, ZipFile as UnzipFile } from '../bundles/zip/node_modules/@types/yauzl';
export const extract: typeof import('../bundles/zip/node_modules/extract-zip') = require('./zipBundleImpl').extract;
diff --git a/utils/generate_channels.js b/utils/generate_channels.js
index 827250ad8c..d6bfdf020f 100755
--- a/utils/generate_channels.js
+++ b/utils/generate_channels.js
@@ -153,6 +153,7 @@ const validator_ts = [
// This file is generated by ${path.basename(__filename)}, do not edit manually.
+/* eslint-disable import/order */
import { scheme, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';
export type { Validator, ValidatorContext } from './validatorPrimitives';
export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator } from './validatorPrimitives';