Skip to content

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

chore: always import type (#13365)

Pavel Feldman5ae2017a5be9
diff --git a/.eslintrc.js b/.eslintrc.js
index efe1dcb39f..8c820a71b2 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,12 +1,12 @@
module.exports = {
- parser: '@typescript-eslint/parser',
- plugins: ['@typescript-eslint', 'notice'],
+ parser: "@typescript-eslint/parser",
+ plugins: ["@typescript-eslint", "notice"],
parserOptions: {
ecmaVersion: 9,
- sourceType: 'module',
+ sourceType: "module",
},
extends: [
- 'plugin:react-hooks/recommended'
+ "plugin:react-hooks/recommended"
],
/**
@@ -18,8 +18,9 @@ module.exports = {
* "rule-name", [severity, { opts }]
* Severity: 2 == error, 1 == warning, 0 == off.
*/
- "rules": {
- '@typescript-eslint/no-unused-vars': [2, {args: 'none'}],
+ rules: {
+ "@typescript-eslint/no-unused-vars": [2, {args: "none"}],
+ "@typescript-eslint/consistent-type-imports": [2, {disallowTypeAnnotations: false}],
/**
* Enforced rules
*/
diff --git a/installation-tests/fixture-scripts/playwright-test-types.ts b/installation-tests/fixture-scripts/playwright-test-types.ts
index 8820bba40f..de1c557802 100644
--- a/installation-tests/fixture-scripts/playwright-test-types.ts
+++ b/installation-tests/fixture-scripts/playwright-test-types.ts
@@ -15,7 +15,7 @@
*/
import { test, expect } from '@playwright/test';
-import { Reporter, TestCase } from '@playwright/test/reporter';
+import type { Reporter, TestCase } from '@playwright/test/reporter';
test.use({ locale: 'en-US' });
diff --git a/packages/html-reporter/playwright.config.ts b/packages/html-reporter/playwright.config.ts
index 20278b3753..2d379c65a4 100644
--- a/packages/html-reporter/playwright.config.ts
+++ b/packages/html-reporter/playwright.config.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { PlaywrightTestConfig, devices } from '@playwright/test';
+import type { PlaywrightTestConfig } from '@playwright/test';
+import { devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: 'src',
diff --git a/packages/html-reporter/src/imageDiffView.spec.tsx b/packages/html-reporter/src/imageDiffView.spec.tsx
index 07cff8de71..879abbb36f 100644
--- a/packages/html-reporter/src/imageDiffView.spec.tsx
+++ b/packages/html-reporter/src/imageDiffView.spec.tsx
@@ -16,7 +16,8 @@
import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react/test';
-import { ImageDiff, ImageDiffView } from './imageDiffView';
+import type { ImageDiff } from './imageDiffView';
+import { ImageDiffView } from './imageDiffView';
test.use({ viewport: { width: 1000, height: 800 } });
diff --git a/packages/html-reporter/src/imageDiffView.tsx b/packages/html-reporter/src/imageDiffView.tsx
index 054b15e00e..1ac2630784 100644
--- a/packages/html-reporter/src/imageDiffView.tsx
+++ b/packages/html-reporter/src/imageDiffView.tsx
@@ -17,7 +17,8 @@
import type { TestAttachment } from '@playwright-test/reporters/html';
import * as React from 'react';
import { AttachmentLink } from './links';
-import { TabbedPane, TabbedPaneTab } from './tabbedPane';
+import type { TabbedPaneTab } from './tabbedPane';
+import { TabbedPane } from './tabbedPane';
import './imageDiffView.css';
import './tabbedPane.css';
diff --git a/packages/html-reporter/src/index.tsx b/packages/html-reporter/src/index.tsx
index 7eed862ec6..d2be445e5d 100644
--- a/packages/html-reporter/src/index.tsx
+++ b/packages/html-reporter/src/index.tsx
@@ -21,7 +21,7 @@ import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import './colors.css';
-import { LoadedReport } from './loadedReport';
+import type { LoadedReport } from './loadedReport';
import { ReportView } from './reportView';
// @ts-ignore
const zipjs = zipImport as typeof zip;
diff --git a/packages/html-reporter/src/loadedReport.ts b/packages/html-reporter/src/loadedReport.ts
index 7234598f99..e4d01d8c52 100644
--- a/packages/html-reporter/src/loadedReport.ts
+++ b/packages/html-reporter/src/loadedReport.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { HTMLReport } from '@playwright-test/reporters/html';
-import { Metadata } from './index';
+import type { HTMLReport } from '@playwright-test/reporters/html';
+import type { Metadata } from './index';
export interface LoadedReport {
json(): HTMLReport & { metadata?: Metadata };
diff --git a/packages/html-reporter/src/metadataView.tsx b/packages/html-reporter/src/metadataView.tsx
index 4b15cdf08e..b7643c0bcb 100644
--- a/packages/html-reporter/src/metadataView.tsx
+++ b/packages/html-reporter/src/metadataView.tsx
@@ -18,7 +18,7 @@ import * as React from 'react';
import './colors.css';
import './common.css';
import * as icons from './icons';
-import { Metadata } from './index';
+import type { Metadata } from './index';
import { AutoChip } from './chip';
import './reportView.css';
import './theme.css';
diff --git a/packages/html-reporter/src/reportView.tsx b/packages/html-reporter/src/reportView.tsx
index fbfdd0ec83..f65e7b2b88 100644
--- a/packages/html-reporter/src/reportView.tsx
+++ b/packages/html-reporter/src/reportView.tsx
@@ -21,7 +21,7 @@ import './common.css';
import { Filter } from './filter';
import { HeaderView } from './headerView';
import { Route } from './links';
-import { LoadedReport } from './loadedReport';
+import type { LoadedReport } from './loadedReport';
import './reportView.css';
import { MetadataView } from './metadataView';
import { TestCaseView } from './testCaseView';
diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsx
index 1d41a05b94..106c9259c3 100644
--- a/packages/html-reporter/src/testFileView.tsx
+++ b/packages/html-reporter/src/testFileView.tsx
@@ -18,7 +18,7 @@ import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/htm
import * as React from 'react';
import { msToString } from './uiUtils';
import { Chip } from './chip';
-import { Filter } from './filter';
+import type { Filter } from './filter';
import { Link, ProjectLink } from './links';
import { statusIcon } from './statusIcon';
import './testFileView.css';
diff --git a/packages/html-reporter/src/testFilesView.tsx b/packages/html-reporter/src/testFilesView.tsx
index 659619415f..4309d8358e 100644
--- a/packages/html-reporter/src/testFilesView.tsx
+++ b/packages/html-reporter/src/testFilesView.tsx
@@ -16,7 +16,7 @@
import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/html';
import * as React from 'react';
-import { Filter } from './filter';
+import type { Filter } from './filter';
import { TestFileView } from './testFileView';
import './testFileView.css';
diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx
index 78cc30508d..f5b218a62f 100644
--- a/packages/html-reporter/src/testResultView.tsx
+++ b/packages/html-reporter/src/testResultView.tsx
@@ -23,7 +23,8 @@ import { AutoChip } from './chip';
import { traceImage } from './images';
import { AttachmentLink } from './links';
import { statusIcon } from './statusIcon';
-import { ImageDiff, ImageDiffView } from './imageDiffView';
+import type { ImageDiff } from './imageDiffView';
+import { ImageDiffView } from './imageDiffView';
import './testResultView.css';
function groupImageDiffs(screenshots: Set<TestAttachment>): ImageDiff[] {
diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts
index 76a1807342..957393317a 100644
--- a/packages/playwright-core/src/browserServerImpl.ts
+++ b/packages/playwright-core/src/browserServerImpl.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import { LaunchServerOptions, Logger } from './client/types';
+import type { LaunchServerOptions, Logger } from './client/types';
import { EventEmitter } from 'ws';
-import { BrowserServerLauncher, BrowserServer } from './client/browserType';
+import type { BrowserServerLauncher, BrowserServer } from './client/browserType';
import { envObjectToArray } from './client/clientHelper';
import { createGuid } from './utils/utils';
-import { ProtocolLogger } from './server/types';
+import type { ProtocolLogger } from './server/types';
import { serverSideCallMetadata } from './server/instrumentation';
import { createPlaywright } from './server/playwright';
import { PlaywrightServer } from './remote/playwrightServer';
diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.ts
index 0759091a1e..247eedeec7 100755
--- a/packages/playwright-core/src/cli/cli.ts
+++ b/packages/playwright-core/src/cli/cli.ts
@@ -21,21 +21,24 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
-import { program, Command } from 'commander';
+import type { Command } from 'commander';
+import { program } from 'commander';
import { runDriver, runServer, printApiJson, launchBrowserServer } from './driver';
import { showTraceViewer } from '../server/trace/viewer/traceViewer';
import * as playwright from '../..';
-import { BrowserContext } from '../client/browserContext';
-import { Browser } from '../client/browser';
-import { Page } from '../client/page';
-import { BrowserType } from '../client/browserType';
-import { BrowserContextOptions, LaunchOptions } from '../client/types';
+import type { BrowserContext } from '../client/browserContext';
+import type { Browser } from '../client/browser';
+import type { Page } from '../client/page';
+import type { BrowserType } from '../client/browserType';
+import type { BrowserContextOptions, LaunchOptions } from '../client/types';
import { spawn } from 'child_process';
-import { registry, Executable } from '../utils/registry';
+import type { Executable } from '../utils/registry';
+import { registry } from '../utils/registry';
import { spawnAsync, getPlaywrightVersion, wrapInASCIIBox } from '../utils/utils';
import { writeDockerVersion } from '../utils/dependencies';
import { launchGridAgent } from '../grid/gridAgent';
-import { GridServer, GridFactory } from '../grid/gridServer';
+import type { GridFactory } from '../grid/gridServer';
+import { GridServer } from '../grid/gridServer';
const packageJSON = require('../../package.json');
diff --git a/packages/playwright-core/src/cli/driver.ts b/packages/playwright-core/src/cli/driver.ts
index a9cc612d41..50a5df46a0 100644
--- a/packages/playwright-core/src/cli/driver.ts
+++ b/packages/playwright-core/src/cli/driver.ts
@@ -18,8 +18,8 @@
import fs from 'fs';
import * as playwright from '../..';
-import { BrowserType } from '../client/browserType';
-import { LaunchServerOptions } from '../client/types';
+import type { BrowserType } from '../client/browserType';
+import type { LaunchServerOptions } from '../client/types';
import { DispatcherConnection, Root } from '../dispatchers/dispatcher';
import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';
import { IpcTransport, PipeTransport } from '../protocol/transport';
diff --git a/packages/playwright-core/src/client/accessibility.ts b/packages/playwright-core/src/client/accessibility.ts
index 4af1336ccc..6f14e1b295 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 * as channels from '../protocol/channels';
-import { ElementHandle } from './elementHandle';
-import * as api from '../../types/types';
+import type * as channels from '../protocol/channels';
+import type { ElementHandle } from './elementHandle';
+import type * as api from '../../types/types';
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 360a25a09e..3ac818c1e2 100644
--- a/packages/playwright-core/src/client/android.ts
+++ b/packages/playwright-core/src/client/android.ts
@@ -16,13 +16,13 @@
import fs from 'fs';
import { isString, isRegExp } from '../utils/utils';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { Events } from './events';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
-import * as api from '../../types/types';
-import * as types from './types';
-import { Page } from './page';
+import type * as api from '../../types/types';
+import type * as types from './types';
+import type { Page } from './page';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { Waiter } from './waiter';
import { EventEmitter } from 'events';
diff --git a/packages/playwright-core/src/client/artifact.ts b/packages/playwright-core/src/client/artifact.ts
index af5471dc1d..21cfa01afc 100644
--- a/packages/playwright-core/src/client/artifact.ts
+++ b/packages/playwright-core/src/client/artifact.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import * as fs from 'fs';
import { Stream } from './stream';
import { mkdirIfNeeded } from '../utils/utils';
import { ChannelOwner } from './channelOwner';
-import { Readable } from 'stream';
+import type { Readable } from 'stream';
export class Artifact extends ChannelOwner<channels.ArtifactChannel> {
static from(channel: channels.ArtifactChannel): Artifact {
diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.ts
index abafa579d1..1dd1accfcc 100644
--- a/packages/playwright-core/src/client/browser.ts
+++ b/packages/playwright-core/src/client/browser.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
-import { Page } from './page';
+import type { Page } from './page';
import { ChannelOwner } from './channelOwner';
import { Events } from './events';
-import { BrowserContextOptions } from './types';
+import type { BrowserContextOptions } from './types';
import { isSafeCloseError, kBrowserClosedError } from '../utils/errors';
-import * as api from '../../types/types';
+import type * as api from '../../types/types';
import { CDPSession } from './cdpSession';
import type { BrowserType } from './browserType';
-import { LocalUtils } from './localUtils';
+import type { LocalUtils } from './localUtils';
export class Browser extends ChannelOwner<channels.BrowserChannel> implements api.Browser {
readonly _contexts = new Set<BrowserContext>();
diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts
index f21347f45b..daca2b4f44 100644
--- a/packages/playwright-core/src/client/browserContext.ts
+++ b/packages/playwright-core/src/client/browserContext.ts
@@ -18,7 +18,7 @@
import { Page, BindingCall } from './page';
import { Frame } from './frame';
import * as network from './network';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import fs from 'fs';
import { ChannelOwner } from './channelOwner';
import { evaluationScript } from './clientHelper';
@@ -27,11 +27,11 @@ import { Worker } from './worker';
import { Events } from './events';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { Waiter } from './waiter';
-import { URLMatch, Headers, WaitForEventOptions, BrowserContextOptions, StorageState, LaunchOptions } from './types';
+import type { URLMatch, Headers, WaitForEventOptions, BrowserContextOptions, StorageState, LaunchOptions } from './types';
import { headersObjectToArray, mkdirIfNeeded } from '../utils/utils';
import { isSafeCloseError } from '../utils/errors';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
+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';
diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts
index 84eec92d4c..1a1e6a6318 100644
--- a/packages/playwright-core/src/client/browserType.ts
+++ b/packages/playwright-core/src/client/browserType.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { Browser } from './browser';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
-import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions } from './types';
+import type { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions } from './types';
import { Connection } from './connection';
import { Events } from './events';
-import { ChildProcess } from 'child_process';
+import type { ChildProcess } from 'child_process';
import { envObjectToArray } from './clientHelper';
import { assert, headersObjectToArray, monotonicTime } from '../utils/utils';
-import * as api from '../../types/types';
+import type * as api from '../../types/types';
import { kBrowserClosedError } from '../utils/errors';
import { raceAgainstTimeout } from '../utils/async';
import type { Playwright } from './playwright';
diff --git a/packages/playwright-core/src/client/cdpSession.ts b/packages/playwright-core/src/client/cdpSession.ts
index 828d8a93cd..f5cb30b831 100644
--- a/packages/playwright-core/src/client/cdpSession.ts
+++ b/packages/playwright-core/src/client/cdpSession.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+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';
diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.ts
index d0fc348641..bc2fb4a92a 100644
--- a/packages/playwright-core/src/client/channelOwner.ts
+++ b/packages/playwright-core/src/client/channelOwner.ts
@@ -15,13 +15,15 @@
*/
import { EventEmitter } from 'events';
-import * as channels from '../protocol/channels';
-import { createScheme, ValidationError, Validator } from '../protocol/validator';
+import type * as channels from '../protocol/channels';
+import type { Validator } from '../protocol/validator';
+import { createScheme, ValidationError } from '../protocol/validator';
import { debugLogger } from '../utils/debugLogger';
-import { captureRawStack, captureStackTrace, ParsedStackTrace } from '../utils/stackTrace';
+import type { ParsedStackTrace } from '../utils/stackTrace';
+import { captureRawStack, captureStackTrace } from '../utils/stackTrace';
import { isUnderTest } from '../utils/utils';
import { zones } from '../utils/zones';
-import { ClientInstrumentation } from './clientInstrumentation';
+import type { ClientInstrumentation } from './clientInstrumentation';
import type { Connection } from './connection';
import type { Logger } from './types';
diff --git a/packages/playwright-core/src/client/clientHelper.ts b/packages/playwright-core/src/client/clientHelper.ts
index 62959f5fd7..befe5ec502 100644
--- a/packages/playwright-core/src/client/clientHelper.ts
+++ b/packages/playwright-core/src/client/clientHelper.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import * as types from './types';
+import type * as types from './types';
import fs from 'fs';
import { isString, isRegExp, constructURLBasedOnBaseURL } from '../utils/utils';
diff --git a/packages/playwright-core/src/client/clientInstrumentation.ts b/packages/playwright-core/src/client/clientInstrumentation.ts
index 9d9aedc068..6275067b1e 100644
--- a/packages/playwright-core/src/client/clientInstrumentation.ts
+++ b/packages/playwright-core/src/client/clientInstrumentation.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ParsedStackTrace } from '../utils/stackTrace';
+import type { ParsedStackTrace } from '../utils/stackTrace';
export interface ClientInstrumentation {
addListener(listener: ClientInstrumentationListener): void;
diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.ts
index c5db28f9ac..833f3fdab0 100644
--- a/packages/playwright-core/src/client/connection.ts
+++ b/packages/playwright-core/src/client/connection.ts
@@ -30,13 +30,13 @@ import { parseError } from '../protocol/serializers';
import { CDPSession } from './cdpSession';
import { Playwright } from './playwright';
import { Electron, ElectronApplication } from './electron';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { Stream } from './stream';
import { WritableStream } from './writableStream';
import { debugLogger } from '../utils/debugLogger';
import { SelectorsOwner } from './selectors';
import { Android, AndroidSocket, AndroidDevice } from './android';
-import { ParsedStackTrace } from '../utils/stackTrace';
+import type { ParsedStackTrace } from '../utils/stackTrace';
import { Artifact } from './artifact';
import { EventEmitter } from 'events';
import { JsonPipe } from './jsonPipe';
diff --git a/packages/playwright-core/src/client/consoleMessage.ts b/packages/playwright-core/src/client/consoleMessage.ts
index ef4bad95c0..b70883d3e1 100644
--- a/packages/playwright-core/src/client/consoleMessage.ts
+++ b/packages/playwright-core/src/client/consoleMessage.ts
@@ -16,9 +16,9 @@
import * as util from 'util';
import { JSHandle } from './jsHandle';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
-import * as api from '../../types/types';
+import type * as api from '../../types/types';
type ConsoleMessageLocation = channels.ConsoleMessageInitializer['location'];
diff --git a/packages/playwright-core/src/client/coverage.ts b/packages/playwright-core/src/client/coverage.ts
index 358609843f..33d7f9168e 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 * as channels from '../protocol/channels';
-import * as api from '../../types/types';
+import type * as channels from '../protocol/channels';
+import type * as api from '../../types/types';
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 27a22c742d..8fdf15e8ef 100644
--- a/packages/playwright-core/src/client/dialog.ts
+++ b/packages/playwright-core/src/client/dialog.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
-import * as api from '../../types/types';
+import type * as api from '../../types/types';
export class Dialog extends ChannelOwner<channels.DialogChannel> implements api.Dialog {
static from(dialog: channels.DialogChannel): Dialog {
diff --git a/packages/playwright-core/src/client/download.ts b/packages/playwright-core/src/client/download.ts
index a010dd1f6d..257419a0e6 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 { Readable } from 'stream';
-import * as api from '../../types/types';
-import { Artifact } from './artifact';
-import { Page } from './page';
+import type { Readable } from 'stream';
+import type * as api from '../../types/types';
+import type { Artifact } from './artifact';
+import type { Page } from './page';
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 709aae9da6..983e360740 100644
--- a/packages/playwright-core/src/client/electron.ts
+++ b/packages/playwright-core/src/client/electron.ts
@@ -15,10 +15,10 @@
*/
import type { BrowserWindow } from 'electron';
-import * as childProcess from 'child_process';
-import * as structs from '../../types/structs';
-import * as api from '../../types/types';
-import * as channels from '../protocol/channels';
+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 '../utils/timeoutSettings';
import { headersObjectToArray } from '../utils/utils';
import { BrowserContext } from './browserContext';
@@ -26,8 +26,8 @@ import { ChannelOwner } from './channelOwner';
import { envObjectToArray } from './clientHelper';
import { Events } from './events';
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
-import { Page } from './page';
-import { Env, WaitForEventOptions, Headers } from './types';
+import type { Page } from './page';
+import type { Env, WaitForEventOptions, Headers } from './types';
import { Waiter } from './waiter';
type ElectronOptions = Omit<channels.ElectronLaunchOptions, 'env'|'extraHTTPHeaders'> & {
diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts
index 82ba3c62bb..de0c439b0e 100644
--- a/packages/playwright-core/src/client/elementHandle.ts
+++ b/packages/playwright-core/src/client/elementHandle.ts
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { Frame } from './frame';
-import { Locator } from './locator';
+import type { Locator } from './locator';
import { JSHandle, serializeArgument, parseResult } from './jsHandle';
-import { ChannelOwner } from './channelOwner';
-import { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types';
+import type { ChannelOwner } from './channelOwner';
+import type { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types';
import fs from 'fs';
import * as mime from 'mime';
import path from 'path';
import { assert, isString, mkdirIfNeeded } from '../utils/utils';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
-import { BrowserContext } from './browserContext';
+import type * as api from '../../types/types';
+import type * as structs from '../../types/structs';
+import type { BrowserContext } from './browserContext';
import { WritableStream } from './writableStream';
import { pipeline } from 'stream';
import { promisify } from 'util';
diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts
index 3f8009b981..040a795b41 100644
--- a/packages/playwright-core/src/client/fetch.ts
+++ b/packages/playwright-core/src/client/fetch.ts
@@ -17,17 +17,17 @@
import fs from 'fs';
import path from 'path';
import * as util from 'util';
-import { Serializable } from '../../types/structs';
-import * as api from '../../types/types';
-import { HeadersArray } from '../common/types';
-import * as channels from '../protocol/channels';
+import type { Serializable } from '../../types/structs';
+import type * as api from '../../types/types';
+import type { HeadersArray } from '../common/types';
+import type * as channels from '../protocol/channels';
import { kBrowserOrContextClosedError } from '../utils/errors';
import { assert, headersObjectToArray, isFilePayload, isString, mkdirIfNeeded, objectToArray } from '../utils/utils';
import { ChannelOwner } from './channelOwner';
import * as network from './network';
import { RawHeaders } from './network';
-import { FilePayload, Headers, StorageState } from './types';
-import { Playwright } from './playwright';
+import type { FilePayload, Headers, StorageState } from './types';
+import type { Playwright } from './playwright';
import { createInstrumentation } from './clientInstrumentation';
import { Tracing } from './tracing';
diff --git a/packages/playwright-core/src/client/fileChooser.ts b/packages/playwright-core/src/client/fileChooser.ts
index 6f39c30c8c..24405f4c92 100644
--- a/packages/playwright-core/src/client/fileChooser.ts
+++ b/packages/playwright-core/src/client/fileChooser.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { ElementHandle } from './elementHandle';
-import { Page } from './page';
-import { FilePayload } from './types';
-import * as channels from '../protocol/channels';
-import * as api from '../../types/types';
+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';
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 2bc6e204bf..1be9d27f02 100644
--- a/packages/playwright-core/src/client/frame.ts
+++ b/packages/playwright-core/src/client/frame.ts
@@ -16,21 +16,22 @@
*/
import { assert } from '../utils/utils';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { FrameLocator, Locator } from './locator';
import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';
import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle';
import fs from 'fs';
import * as network from './network';
-import { Page } from './page';
+import type { Page } from './page';
import { EventEmitter } from 'events';
import { Waiter } from './waiter';
import { Events } from './events';
-import { LifecycleEvent, URLMatch, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions, StrictOptions, kLifecycleEvents } from './types';
+import type { LifecycleEvent, URLMatch, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions, StrictOptions } from './types';
+import { kLifecycleEvents } from './types';
import { urlMatches } from './clientHelper';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as structs from '../../types/structs';
import { debugLogger } from '../utils/debugLogger';
export type WaitForNavigationOptions = {
diff --git a/packages/playwright-core/src/client/input.ts b/packages/playwright-core/src/client/input.ts
index b442c2f701..59a0285f7f 100644
--- a/packages/playwright-core/src/client/input.ts
+++ b/packages/playwright-core/src/client/input.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import * as api from '../../types/types';
+import type * as channels from '../protocol/channels';
+import type * as api from '../../types/types';
import type { Page } from './page';
export class Keyboard implements api.Keyboard {
diff --git a/packages/playwright-core/src/client/jsHandle.ts b/packages/playwright-core/src/client/jsHandle.ts
index 647c92b4f3..13acb7da19 100644
--- a/packages/playwright-core/src/client/jsHandle.ts
+++ b/packages/playwright-core/src/client/jsHandle.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as structs from '../../types/structs';
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 32097605d0..5c730efb4e 100644
--- a/packages/playwright-core/src/client/jsonPipe.ts
+++ b/packages/playwright-core/src/client/jsonPipe.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
export class JsonPipe extends ChannelOwner<channels.JsonPipeChannel> {
diff --git a/packages/playwright-core/src/client/localUtils.ts b/packages/playwright-core/src/client/localUtils.ts
index 6856f5d891..4fea8e5cfd 100644
--- a/packages/playwright-core/src/client/localUtils.ts
+++ b/packages/playwright-core/src/client/localUtils.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
export class LocalUtils extends ChannelOwner<channels.LocalUtilsChannel> {
diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.ts
index bdcfe0f06f..5ba66ad80a 100644
--- a/packages/playwright-core/src/client/locator.ts
+++ b/packages/playwright-core/src/client/locator.ts
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-import * as structs from '../../types/structs';
-import * as api from '../../types/types';
-import * as channels from '../protocol/channels';
+import type * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as channels from '../protocol/channels';
import type { ParsedStackTrace } from '../utils/stackTrace';
import * as util from 'util';
import { isRegExp, monotonicTime } from '../utils/utils';
import { ElementHandle } from './elementHandle';
-import { Frame } from './frame';
-import { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
+import type { Frame } from './frame';
+import type { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
import { parseResult, serializeArgument } from './jsHandle';
import { escapeWithQuotes } from '../utils/stringUtils';
diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts
index 372eb3b6e4..d5c96b4561 100644
--- a/packages/playwright-core/src/client/network.ts
+++ b/packages/playwright-core/src/client/network.ts
@@ -15,19 +15,19 @@
*/
import { URLSearchParams } from 'url';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { Frame } from './frame';
-import { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
+import type { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
import fs from 'fs';
import * as mime from 'mime';
import { isString, headersObjectToArray } from '../utils/utils';
import { ManualPromise } from '../utils/async';
import { Events } from './events';
-import { Page } from './page';
+import type { Page } from './page';
import { Waiter } from './waiter';
-import * as api from '../../types/types';
-import { HeadersArray, URLMatch } from '../common/types';
+import type * as api from '../../types/types';
+import type { HeadersArray, URLMatch } from '../common/types';
import { urlMatches } from './clientHelper';
import { MultiMap } from '../utils/multimap';
import { APIResponse } from './fetch';
diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts
index fde819af87..8df4adc533 100644
--- a/packages/playwright-core/src/client/page.ts
+++ b/packages/playwright-core/src/client/page.ts
@@ -19,36 +19,38 @@ import { Events } from './events';
import { assert } from '../utils/utils';
import { TimeoutSettings } from '../utils/timeoutSettings';
import type { ParsedStackTrace } from '../utils/stackTrace';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { parseError, serializeError } from '../protocol/serializers';
import { Accessibility } from './accessibility';
-import { BrowserContext } from './browserContext';
+import type { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner';
import { ConsoleMessage } from './consoleMessage';
import { Dialog } from './dialog';
import { Download } from './download';
import { ElementHandle, determineScreenshotType } from './elementHandle';
-import { Locator, FrameLocator } from './locator';
+import type { Locator, FrameLocator } from './locator';
import { Worker } from './worker';
-import { Frame, verifyLoadState, WaitForNavigationOptions } from './frame';
+import type { WaitForNavigationOptions } from './frame';
+import { Frame, verifyLoadState } from './frame';
import { Keyboard, Mouse, Touchscreen } from './input';
import { assertMaxArguments, serializeArgument, parseResult, JSHandle } from './jsHandle';
-import { Request, Response, Route, RouteHandlerCallback, WebSocket, validateHeaders, RouteHandler } from './network';
+import type { RouteHandlerCallback } from './network';
+import { Request, Response, Route, WebSocket, validateHeaders, RouteHandler } from './network';
import { FileChooser } from './fileChooser';
import { Buffer } from 'buffer';
import { Coverage } from './coverage';
import { Waiter } from './waiter';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
+import type * as api from '../../types/types';
+import type * as structs from '../../types/structs';
import fs from 'fs';
import path from 'path';
-import { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
+import type { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
import { evaluationScript, urlMatches } from './clientHelper';
import { isString, isRegExp, isObject, mkdirIfNeeded, headersObjectToArray } from '../utils/utils';
import { isSafeCloseError } from '../utils/errors';
import { Video } from './video';
import { Artifact } from './artifact';
-import { APIRequestContext } from './fetch';
+import type { APIRequestContext } from './fetch';
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 7064fe561d..d16a087883 100644
--- a/packages/playwright-core/src/client/playwright.ts
+++ b/packages/playwright-core/src/client/playwright.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { TimeoutError } from '../utils/errors';
import * as socks from '../utils/socksProxy';
import { Android } from './android';
@@ -24,7 +24,7 @@ import { Electron } from './electron';
import { APIRequest } from './fetch';
import { LocalUtils } from './localUtils';
import { Selectors, SelectorsOwner } from './selectors';
-import { Size } from './types';
+import type { Size } from './types';
type DeviceDescriptor = {
userAgent: string,
diff --git a/packages/playwright-core/src/client/selectors.ts b/packages/playwright-core/src/client/selectors.ts
index 3d42fdb3ba..f4aeccc18c 100644
--- a/packages/playwright-core/src/client/selectors.ts
+++ b/packages/playwright-core/src/client/selectors.ts
@@ -15,10 +15,10 @@
*/
import { evaluationScript } from './clientHelper';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
-import { SelectorEngine } from './types';
-import * as api from '../../types/types';
+import type { SelectorEngine } from './types';
+import type * as api from '../../types/types';
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 ff27f433fc..9386c63fbc 100644
--- a/packages/playwright-core/src/client/stream.ts
+++ b/packages/playwright-core/src/client/stream.ts
@@ -15,7 +15,7 @@
*/
import { Readable } from 'stream';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
export class Stream extends ChannelOwner<channels.StreamChannel> {
diff --git a/packages/playwright-core/src/client/tracing.ts b/packages/playwright-core/src/client/tracing.ts
index e46e59c38f..1718ecb200 100644
--- a/packages/playwright-core/src/client/tracing.ts
+++ b/packages/playwright-core/src/client/tracing.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import * as api from '../../types/types';
-import * as channels from '../protocol/channels';
+import type * as api from '../../types/types';
+import type * as channels from '../protocol/channels';
import { Artifact } from './artifact';
import { ChannelOwner } from './channelOwner';
-import { LocalUtils } from './localUtils';
+import type { LocalUtils } from './localUtils';
export class Tracing extends ChannelOwner<channels.TracingChannel> implements api.Tracing {
_localUtils!: LocalUtils;
diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts
index 348fe0239d..2b5d249f3e 100644
--- a/packages/playwright-core/src/client/types.ts
+++ b/packages/playwright-core/src/client/types.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import type { Size } from '../common/types';
export type { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } from '../common/types';
diff --git a/packages/playwright-core/src/client/video.ts b/packages/playwright-core/src/client/video.ts
index a45726a16a..51f0d4a1a3 100644
--- a/packages/playwright-core/src/client/video.ts
+++ b/packages/playwright-core/src/client/video.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { Page } from './page';
-import * as api from '../../types/types';
-import { Artifact } from './artifact';
-import { Connection } from './connection';
+import type { Page } from './page';
+import type * as api from '../../types/types';
+import type { Artifact } from './artifact';
+import type { Connection } from './connection';
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 a2e07edf61..2e60baf78e 100644
--- a/packages/playwright-core/src/client/waiter.ts
+++ b/packages/playwright-core/src/client/waiter.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import { EventEmitter } from 'events';
+import type { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { TimeoutError } from '../utils/errors';
import { createGuid } from '../utils/utils';
-import * as channels from '../protocol/channels';
-import { ChannelOwner } from './channelOwner';
+import type * as channels from '../protocol/channels';
+import type { ChannelOwner } from './channelOwner';
export class Waiter {
private _dispose: (() => void)[];
diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.ts
index 809928928b..ed6c16e881 100644
--- a/packages/playwright-core/src/client/worker.ts
+++ b/packages/playwright-core/src/client/worker.ts
@@ -15,13 +15,13 @@
*/
import { Events } from './events';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { assertMaxArguments, JSHandle, parseResult, serializeArgument } from './jsHandle';
-import { Page } from './page';
-import { BrowserContext } from './browserContext';
-import * as api from '../../types/types';
-import * as structs from '../../types/structs';
+import type { Page } from './page';
+import type { BrowserContext } from './browserContext';
+import type * as api from '../../types/types';
+import type * as structs from '../../types/structs';
export class Worker extends ChannelOwner<channels.WorkerChannel> implements api.Worker {
_page: Page | undefined; // Set for web workers.
diff --git a/packages/playwright-core/src/client/writableStream.ts b/packages/playwright-core/src/client/writableStream.ts
index 4532e2ef78..8a70033e7f 100644
--- a/packages/playwright-core/src/client/writableStream.ts
+++ b/packages/playwright-core/src/client/writableStream.ts
@@ -15,7 +15,7 @@
*/
import { Writable } from 'stream';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
export class WritableStream extends ChannelOwner<channels.WritableStreamChannel> {
diff --git a/packages/playwright-core/src/dispatchers/androidDispatcher.ts b/packages/playwright-core/src/dispatchers/androidDispatcher.ts
index 897e23cf7b..caad182506 100644
--- a/packages/playwright-core/src/dispatchers/androidDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/androidDispatcher.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import { Dispatcher, DispatcherScope, existingDispatcher } from './dispatcher';
-import { Android, AndroidDevice, SocketBackend } from '../server/android/android';
-import * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, existingDispatcher } from './dispatcher';
+import type { Android, SocketBackend } from '../server/android/android';
+import { AndroidDevice } from '../server/android/android';
+import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
-import { CallMetadata } from '../server/instrumentation';
+import type { CallMetadata } from '../server/instrumentation';
export class AndroidDispatcher extends Dispatcher<Android, channels.AndroidChannel> implements channels.AndroidChannel {
_type_Android = true;
diff --git a/packages/playwright-core/src/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/dispatchers/artifactDispatcher.ts
index 742d2e2638..3c3e19bddd 100644
--- a/packages/playwright-core/src/dispatchers/artifactDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/artifactDispatcher.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';
import fs from 'fs';
import { mkdirIfNeeded } from '../utils/utils';
-import { Artifact } from '../server/artifact';
+import type { Artifact } from '../server/artifact';
export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactChannel> implements channels.ArtifactChannel {
_type_Artifact = true;
diff --git a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
index b8197f925e..13e2ae2d93 100644
--- a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
@@ -15,18 +15,19 @@
*/
import { BrowserContext } from '../server/browserContext';
-import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, lookupDispatcher } from './dispatcher';
import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
-import { FrameDispatcher } from './frameDispatcher';
-import * as channels from '../protocol/channels';
+import type { FrameDispatcher } from './frameDispatcher';
+import type * as channels from '../protocol/channels';
import { RouteDispatcher, RequestDispatcher, ResponseDispatcher, APIRequestContextDispatcher } from './networkDispatchers';
import { CRBrowserContext } from '../server/chromium/crBrowser';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { RecorderSupplement } from '../server/supplements/recorderSupplement';
-import { CallMetadata } from '../server/instrumentation';
+import type { CallMetadata } from '../server/instrumentation';
import { ArtifactDispatcher } from './artifactDispatcher';
-import { Artifact } from '../server/artifact';
-import { Request, Response } from '../server/network';
+import type { Artifact } from '../server/artifact';
+import type { Request, Response } from '../server/network';
import { TracingDispatcher } from './tracingDispatcher';
import * as fs from 'fs';
import * as path from 'path';
diff --git a/packages/playwright-core/src/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/dispatchers/browserDispatcher.ts
index d0681c90a9..e252e0b746 100644
--- a/packages/playwright-core/src/dispatchers/browserDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/browserDispatcher.ts
@@ -15,13 +15,15 @@
*/
import { Browser } from '../server/browser';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
-import { Dispatcher, DispatcherScope } from './dispatcher';
-import { CRBrowser } from '../server/chromium/crBrowser';
-import { PageDispatcher } from './pageDispatcher';
-import { CallMetadata, serverSideCallMetadata } from '../server/instrumentation';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type { CRBrowser } from '../server/chromium/crBrowser';
+import type { PageDispatcher } from './pageDispatcher';
+import type { CallMetadata } from '../server/instrumentation';
+import { serverSideCallMetadata } from '../server/instrumentation';
import { BrowserContext } from '../server/browserContext';
import { Selectors } from '../server/selectors';
diff --git a/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts b/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts
index bed9f0b604..5dd252a25e 100644
--- a/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-import { BrowserType } from '../server/browserType';
+import type { BrowserType } from '../server/browserType';
import { BrowserDispatcher } from './browserDispatcher';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { BrowserContextDispatcher } from './browserContextDispatcher';
-import { CallMetadata } from '../server/instrumentation';
+import type { CallMetadata } from '../server/instrumentation';
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
import { getUserAgent } from '../utils/utils';
import * as socks from '../utils/socksProxy';
diff --git a/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts
index ce967f829c..d23ccd15ea 100644
--- a/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-import { CRSession, CRSessionEvents } from '../server/chromium/crConnection';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type { CRSession } from '../server/chromium/crConnection';
+import { CRSessionEvents } from '../server/chromium/crConnection';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionChannel> implements channels.CDPSessionChannel {
_type_CDPSession = true;
diff --git a/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts b/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts
index a83a0d61ca..f6af34d654 100644
--- a/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import { ConsoleMessage } from '../server/console';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type { ConsoleMessage } from '../server/console';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
export class ConsoleMessageDispatcher extends Dispatcher<ConsoleMessage, channels.ConsoleMessageChannel> implements channels.ConsoleMessageChannel {
diff --git a/packages/playwright-core/src/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/dispatchers/dialogDispatcher.ts
index 0c9edd2d73..eebb15aa27 100644
--- a/packages/playwright-core/src/dispatchers/dialogDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/dialogDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import { Dialog } from '../server/dialog';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type { Dialog } from '../server/dialog';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogChannel> implements channels.DialogChannel {
_type_Dialog = true;
diff --git a/packages/playwright-core/src/dispatchers/dispatcher.ts b/packages/playwright-core/src/dispatchers/dispatcher.ts
index b3ca1602ea..a7c806c35d 100644
--- a/packages/playwright-core/src/dispatchers/dispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/dispatcher.ts
@@ -15,13 +15,15 @@
*/
import { EventEmitter } from 'events';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { serializeError } from '../protocol/serializers';
-import { createScheme, Validator, ValidationError } from '../protocol/validator';
+import type { Validator } from '../protocol/validator';
+import { createScheme, ValidationError } from '../protocol/validator';
import { assert, debugAssert, isUnderTest, monotonicTime } from '../utils/utils';
import { tOptional } from '../protocol/validatorPrimitives';
import { kBrowserOrContextClosedError } from '../utils/errors';
-import { CallMetadata, SdkObject } from '../server/instrumentation';
+import type { CallMetadata } from '../server/instrumentation';
+import { SdkObject } from '../server/instrumentation';
import { rewriteErrorMessage } from '../utils/stackTrace';
import type { PlaywrightDispatcher } from './playwrightDispatcher';
diff --git a/packages/playwright-core/src/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/dispatchers/electronDispatcher.ts
index 31738fe1f0..ba23edcf1a 100644
--- a/packages/playwright-core/src/dispatchers/electronDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/electronDispatcher.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import { Dispatcher, DispatcherScope } from './dispatcher';
-import { Electron, ElectronApplication } from '../server/electron/electron';
-import * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type { Electron } from '../server/electron/electron';
+import { ElectronApplication } from '../server/electron/electron';
+import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
-import { PageDispatcher } from './pageDispatcher';
+import type { PageDispatcher } from './pageDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
diff --git a/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts
index bec12cc334..c422d1d099 100644
--- a/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-import { ElementHandle } from '../server/dom';
-import { Frame } from '../server/frames';
-import * as js from '../server/javascript';
-import * as channels from '../protocol/channels';
-import { DispatcherScope, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
+import type { ElementHandle } from '../server/dom';
+import type { Frame } from '../server/frames';
+import type * as js from '../server/javascript';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';
-import { FrameDispatcher } from './frameDispatcher';
-import { CallMetadata } from '../server/instrumentation';
-import { WritableStreamDispatcher } from './writableStreamDispatcher';
+import type { FrameDispatcher } from './frameDispatcher';
+import type { CallMetadata } from '../server/instrumentation';
+import type { WritableStreamDispatcher } from './writableStreamDispatcher';
export class ElementHandleDispatcher extends JSHandleDispatcher implements channels.ElementHandleChannel {
_type_ElementHandle = true;
diff --git a/packages/playwright-core/src/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/dispatchers/frameDispatcher.ts
index 36a31ce6a2..0064d6943f 100644
--- a/packages/playwright-core/src/dispatchers/frameDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/frameDispatcher.ts
@@ -14,14 +14,17 @@
* limitations under the License.
*/
-import { Frame, NavigationEvent } from '../server/frames';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
+import type { NavigationEvent } from '../server/frames';
+import { Frame } from '../server/frames';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
-import { ResponseDispatcher, RequestDispatcher } from './networkDispatchers';
-import { CallMetadata } from '../server/instrumentation';
-import { WritableStreamDispatcher } from './writableStreamDispatcher';
+import type { ResponseDispatcher } from './networkDispatchers';
+import { RequestDispatcher } from './networkDispatchers';
+import type { CallMetadata } from '../server/instrumentation';
+import type { WritableStreamDispatcher } from './writableStreamDispatcher';
export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel> implements channels.FrameChannel {
_type_Frame = true;
diff --git a/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts
index 70218bcf5d..45dd36d0d0 100644
--- a/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import * as js from '../server/javascript';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type * as js from '../server/javascript';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
diff --git a/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts
index f9d8f0a412..0b4c19309b 100644
--- a/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { createGuid } from '../utils/utils';
import { serializeError } from '../protocol/serializers';
diff --git a/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts
index 129b9e7228..6af8f72d13 100644
--- a/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-import EventEmitter from 'events';
+import type EventEmitter from 'events';
import fs from 'fs';
import path from 'path';
import yauzl from 'yauzl';
import yazl from 'yazl';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { ManualPromise } from '../utils/async';
import { assert, createGuid } from '../utils/utils';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.LocalUtilsChannel> implements channels.LocalUtilsChannel {
_type_LocalUtils: boolean;
diff --git a/packages/playwright-core/src/dispatchers/networkDispatchers.ts b/packages/playwright-core/src/dispatchers/networkDispatchers.ts
index 8607912a32..e527a6bdf7 100644
--- a/packages/playwright-core/src/dispatchers/networkDispatchers.ts
+++ b/packages/playwright-core/src/dispatchers/networkDispatchers.ts
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { APIRequestContext } from '../server/fetch';
-import { CallMetadata } from '../server/instrumentation';
-import { Request, Response, Route, WebSocket } from '../server/network';
-import { Dispatcher, DispatcherScope, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
+import type { CallMetadata } from '../server/instrumentation';
+import type { Request, Response, Route } from '../server/network';
+import { WebSocket } from '../server/network';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { TracingDispatcher } from './tracingDispatcher';
diff --git a/packages/playwright-core/src/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/dispatchers/pageDispatcher.ts
index f02d86bc2c..5508a1b35a 100644
--- a/packages/playwright-core/src/dispatchers/pageDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/pageDispatcher.ts
@@ -14,25 +14,27 @@
* limitations under the License.
*/
-import { BrowserContext } from '../server/browserContext';
-import { Frame } from '../server/frames';
+import type { BrowserContext } from '../server/browserContext';
+import type { Frame } from '../server/frames';
import { Page, Worker } from '../server/page';
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import { parseError, serializeError } from '../protocol/serializers';
import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';
import { DialogDispatcher } from './dialogDispatcher';
import { FrameDispatcher } from './frameDispatcher';
-import { RequestDispatcher, ResponseDispatcher, RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
+import type { ResponseDispatcher } from './networkDispatchers';
+import { RequestDispatcher, RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
import { serializeResult, parseArgument } from './jsHandleDispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
-import { FileChooser } from '../server/fileChooser';
-import { CRCoverage } from '../server/chromium/crCoverage';
-import { JSHandle } from '../server/javascript';
-import { CallMetadata } from '../server/instrumentation';
-import { Artifact } from '../server/artifact';
+import type { FileChooser } from '../server/fileChooser';
+import type { CRCoverage } from '../server/chromium/crCoverage';
+import type { JSHandle } from '../server/javascript';
+import type { CallMetadata } from '../server/instrumentation';
+import type { Artifact } from '../server/artifact';
import { ArtifactDispatcher } from './artifactDispatcher';
-import { Download } from '../server/download';
+import type { Download } from '../server/download';
import { createGuid } from '../utils/utils';
export class PageDispatcher extends Dispatcher<Page, channels.PageChannel> implements channels.PageChannel {
diff --git a/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts
index 240f7055c7..9b2f671978 100644
--- a/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { Browser } from '../server/browser';
+import type * as channels from '../protocol/channels';
+import type { Browser } from '../server/browser';
import { GlobalAPIRequestContext } from '../server/fetch';
-import { Playwright } from '../server/playwright';
-import { SocksProxy, SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
-import * as types from '../server/types';
+import type { Playwright } from '../server/playwright';
+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
+import { SocksProxy } from '../utils/socksProxy';
+import type * as types from '../server/types';
import { AndroidDispatcher } from './androidDispatcher';
import { BrowserTypeDispatcher } from './browserTypeDispatcher';
-import { Dispatcher, DispatcherScope } from './dispatcher';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
import { ElectronDispatcher } from './electronDispatcher';
import { LocalUtilsDispatcher } from './localUtilsDispatcher';
import { APIRequestContextDispatcher } from './networkDispatchers';
diff --git a/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts b/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts
index 662d34fe51..d137ee24fc 100644
--- a/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import { Dispatcher, DispatcherScope } from './dispatcher';
-import * as channels from '../protocol/channels';
-import { Selectors } from '../server/selectors';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type * as channels from '../protocol/channels';
+import type { Selectors } from '../server/selectors';
export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsChannel> implements channels.SelectorsChannel {
_type_Selectors = true;
diff --git a/packages/playwright-core/src/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/dispatchers/streamDispatcher.ts
index 22a8c47107..5bc15f6e8f 100644
--- a/packages/playwright-core/src/dispatchers/streamDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/streamDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
-import * as stream from 'stream';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type * as stream from 'stream';
import { createGuid } from '../utils/utils';
export class StreamDispatcher extends Dispatcher<{ guid: string, stream: stream.Readable }, channels.StreamChannel> implements channels.StreamChannel {
diff --git a/packages/playwright-core/src/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/dispatchers/tracingDispatcher.ts
index ba89a4707a..afc743086c 100644
--- a/packages/playwright-core/src/dispatchers/tracingDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/tracingDispatcher.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { Tracing } from '../server/trace/recorder/tracing';
import { ArtifactDispatcher } from './artifactDispatcher';
-import { Dispatcher, DispatcherScope, existingDispatcher } from './dispatcher';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher, existingDispatcher } from './dispatcher';
export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannel> implements channels.TracingChannel {
_type_Tracing = true;
diff --git a/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts
index 16465f1deb..e98c38f32a 100644
--- a/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { Dispatcher, DispatcherScope } from './dispatcher';
-import * as fs from 'fs';
+import type * as channels from '../protocol/channels';
+import type { DispatcherScope } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type * as fs from 'fs';
import { createGuid } from '../utils/utils';
export class WritableStreamDispatcher extends Dispatcher<{ guid: string, stream: fs.WriteStream }, channels.WritableStreamChannel> implements channels.WritableStreamChannel {
diff --git a/packages/playwright-core/src/grid/dockerGridFactory.ts b/packages/playwright-core/src/grid/dockerGridFactory.ts
index b57b23af60..62ddf08b59 100644
--- a/packages/playwright-core/src/grid/dockerGridFactory.ts
+++ b/packages/playwright-core/src/grid/dockerGridFactory.ts
@@ -16,7 +16,7 @@
import http from 'http';
import os from 'os';
-import { GridAgentLaunchOptions, GridFactory } from './gridServer';
+import type { GridAgentLaunchOptions, GridFactory } from './gridServer';
import * as utils from '../utils/utils';
const dockerFactory: GridFactory = {
diff --git a/packages/playwright-core/src/grid/gridClient.ts b/packages/playwright-core/src/grid/gridClient.ts
index 68098c716e..ad29c2336a 100644
--- a/packages/playwright-core/src/grid/gridClient.ts
+++ b/packages/playwright-core/src/grid/gridClient.ts
@@ -16,7 +16,7 @@
import WebSocket from 'ws';
import { Connection } from '../client/connection';
-import { Playwright } from '../client/playwright';
+import type { Playwright } from '../client/playwright';
import { getPlaywrightVersion } from '../utils/utils';
export class GridClient {
diff --git a/packages/playwright-core/src/grid/gridServer.ts b/packages/playwright-core/src/grid/gridServer.ts
index e9f212de70..05644167ab 100644
--- a/packages/playwright-core/src/grid/gridServer.ts
+++ b/packages/playwright-core/src/grid/gridServer.ts
@@ -18,7 +18,8 @@ import debug from 'debug';
import assert from 'assert';
import { EventEmitter } from 'events';
import { URL } from 'url';
-import WebSocket, { Server as WebSocketServer } from 'ws';
+import type { Server as WebSocketServer } from 'ws';
+import type WebSocket from 'ws';
import { HttpServer } from '../utils/httpServer';
import { createGuid, getPlaywrightVersion } from '../utils/utils';
diff --git a/packages/playwright-core/src/grid/simpleGridFactory.ts b/packages/playwright-core/src/grid/simpleGridFactory.ts
index cfc7253cce..d865516874 100644
--- a/packages/playwright-core/src/grid/simpleGridFactory.ts
+++ b/packages/playwright-core/src/grid/simpleGridFactory.ts
@@ -15,7 +15,7 @@
*/
import child_process from 'child_process';
-import { GridAgentLaunchOptions, GridFactory } from './gridServer';
+import type { GridAgentLaunchOptions, GridFactory } from './gridServer';
import path from 'path';
const simpleFactory: GridFactory = {
diff --git a/packages/playwright-core/src/outofprocess.ts b/packages/playwright-core/src/outofprocess.ts
index 9bfae2895b..68c5b31882 100644
--- a/packages/playwright-core/src/outofprocess.ts
+++ b/packages/playwright-core/src/outofprocess.ts
@@ -16,7 +16,7 @@
import { Connection } from './client/connection';
import { IpcTransport } from './protocol/transport';
-import { Playwright } from './client/playwright';
+import type { Playwright } from './client/playwright';
import * as childProcess from 'child_process';
import * as path from 'path';
import { ManualPromise } from './utils/async';
diff --git a/packages/playwright-core/src/protocol/callMetadata.ts b/packages/playwright-core/src/protocol/callMetadata.ts
index d8890d6fa6..370bd245af 100644
--- a/packages/playwright-core/src/protocol/callMetadata.ts
+++ b/packages/playwright-core/src/protocol/callMetadata.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Point, StackFrame, SerializedError } from './channels';
+import type { Point, StackFrame, SerializedError } from './channels';
export type CallMetadata = {
id: string;
diff --git a/packages/playwright-core/src/protocol/serializers.ts b/packages/playwright-core/src/protocol/serializers.ts
index 1d884e402c..87843538a5 100644
--- a/packages/playwright-core/src/protocol/serializers.ts
+++ b/packages/playwright-core/src/protocol/serializers.ts
@@ -15,7 +15,7 @@
*/
import { TimeoutError } from '../utils/errors';
-import { SerializedError, SerializedValue } from './channels';
+import type { SerializedError, SerializedValue } from './channels';
export function serializeError(e: any): SerializedError {
if (isError(e))
diff --git a/packages/playwright-core/src/protocol/transport.ts b/packages/playwright-core/src/protocol/transport.ts
index e23ccb683d..63f09ce4e5 100644
--- a/packages/playwright-core/src/protocol/transport.ts
+++ b/packages/playwright-core/src/protocol/transport.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ChildProcess } from 'child_process';
+import type { ChildProcess } from 'child_process';
import { makeWaitForNextTask } from '../utils/utils';
export interface WritableStream {
diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.ts
index 850a348a1c..bf21714e9d 100644
--- a/packages/playwright-core/src/protocol/validator.ts
+++ b/packages/playwright-core/src/protocol/validator.ts
@@ -16,7 +16,8 @@
// This file is generated by generate_channels.js, do not edit manually.
-import { Validator, ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
+import type { Validator } from './validatorPrimitives';
+import { ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
export type { Validator } from './validatorPrimitives';
export { ValidationError } from './validatorPrimitives';
diff --git a/packages/playwright-core/src/remote/playwrightClient.ts b/packages/playwright-core/src/remote/playwrightClient.ts
index 65666c4fd3..0dbc914a58 100644
--- a/packages/playwright-core/src/remote/playwrightClient.ts
+++ b/packages/playwright-core/src/remote/playwrightClient.ts
@@ -16,7 +16,7 @@
import WebSocket from 'ws';
import { Connection } from '../client/connection';
-import { Playwright } from '../client/playwright';
+import type { Playwright } from '../client/playwright';
import { makeWaitForNextTask } from '../utils/utils';
// TODO: this file should be removed because it uses the old protocol.
diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.ts
index 58e13cba61..0a4cb56170 100644
--- a/packages/playwright-core/src/remote/playwrightConnection.ts
+++ b/packages/playwright-core/src/remote/playwrightConnection.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import WebSocket from 'ws';
-import { DispatcherConnection, DispatcherScope, Root } from '../dispatchers/dispatcher';
+import type WebSocket from 'ws';
+import type { DispatcherScope } from '../dispatchers/dispatcher';
+import { DispatcherConnection, Root } from '../dispatchers/dispatcher';
import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';
import { Browser } from '../server/browser';
import { serverSideCallMetadata } from '../server/instrumentation';
-import { createPlaywright, Playwright } from '../server/playwright';
+import type { Playwright } from '../server/playwright';
+import { createPlaywright } from '../server/playwright';
import { gracefullyCloseAll } from '../utils/processLauncher';
import { registry } from '../utils/registry';
import { SocksProxy } from '../utils/socksProxy';
diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.ts
index 30c82f07c3..aef92c1377 100644
--- a/packages/playwright-core/src/remote/playwrightServer.ts
+++ b/packages/playwright-core/src/remote/playwrightServer.ts
@@ -17,7 +17,7 @@
import debug from 'debug';
import * as http from 'http';
import WebSocket from 'ws';
-import { Browser } from '../server/browser';
+import type { Browser } from '../server/browser';
import { PlaywrightConnection } from './playwrightConnection';
const debugLog = debug('pw:server');
diff --git a/packages/playwright-core/src/server/accessibility.ts b/packages/playwright-core/src/server/accessibility.ts
index d3797fb426..5e8daf0ffd 100644
--- a/packages/playwright-core/src/server/accessibility.ts
+++ b/packages/playwright-core/src/server/accessibility.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import * as dom from './dom';
-import * as types from './types';
+import type * as dom from './dom';
+import type * as types from './types';
export interface AXNode {
isInteresting(insideControl: boolean): boolean;
diff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.ts
index 49bd3f9b25..71b8c6ab56 100644
--- a/packages/playwright-core/src/server/android/android.ts
+++ b/packages/playwright-core/src/server/android/android.ts
@@ -15,16 +15,17 @@
*/
import debug from 'debug';
-import * as types from '../types';
+import type * as types from '../types';
import { EventEmitter } from 'events';
import fs from 'fs';
import os from 'os';
import path from 'path';
-import * as stream from 'stream';
+import type * as stream from 'stream';
import * as ws from 'ws';
import { createGuid, makeWaitForNextTask, removeFolders } from '../../utils/utils';
-import { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
-import { BrowserContext, validateBrowserContextOptions } from '../browserContext';
+import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
+import type { BrowserContext } from '../browserContext';
+import { validateBrowserContextOptions } from '../browserContext';
import { ProgressController } from '../progress';
import { CRBrowser } from '../chromium/crBrowser';
import { helper } from '../helper';
@@ -32,7 +33,7 @@ import { PipeTransport } from '../../protocol/transport';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { gracefullyCloseSet } from '../../utils/processLauncher';
import { TimeoutSettings } from '../../utils/timeoutSettings';
-import { AndroidWebView } from '../../protocol/channels';
+import type { AndroidWebView } from '../../protocol/channels';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
diff --git a/packages/playwright-core/src/server/android/backendAdb.ts b/packages/playwright-core/src/server/android/backendAdb.ts
index 9c579823a0..c45a3367eb 100644
--- a/packages/playwright-core/src/server/android/backendAdb.ts
+++ b/packages/playwright-core/src/server/android/backendAdb.ts
@@ -16,10 +16,10 @@
import assert from 'assert';
import debug from 'debug';
-import * as types from '../types';
+import type * as types from '../types';
import * as net from 'net';
import { EventEmitter } from 'events';
-import { Backend, DeviceBackend, SocketBackend } from './android';
+import type { Backend, DeviceBackend, SocketBackend } from './android';
import { createGuid } from '../../utils/utils';
export class AdbBackend implements Backend {
diff --git a/packages/playwright-core/src/server/browser.ts b/packages/playwright-core/src/server/browser.ts
index fb6da28634..617cc1bedf 100644
--- a/packages/playwright-core/src/server/browser.ts
+++ b/packages/playwright-core/src/server/browser.ts
@@ -14,16 +14,17 @@
* limitations under the License.
*/
-import * as types from './types';
+import type * as types from './types';
import { BrowserContext, validateBrowserContextOptions } from './browserContext';
import { Page } from './page';
import { Download } from './download';
-import { ProxySettings } from './types';
-import { ChildProcess } from 'child_process';
-import { RecentLogsCollector } from '../utils/debugLogger';
-import { CallMetadata, SdkObject } from './instrumentation';
+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 { Selectors } from './selectors';
+import type { Selectors } from './selectors';
export interface BrowserProcess {
onclose?: ((exitCode: number | null, signal: string | null) => void);
diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts
index 45a6d1a4db..9cc5872633 100644
--- a/packages/playwright-core/src/server/browserContext.ts
+++ b/packages/playwright-core/src/server/browserContext.ts
@@ -18,18 +18,20 @@
import * as os from 'os';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { debugMode, mkdirIfNeeded, createGuid } from '../utils/utils';
-import { Browser, BrowserOptions } from './browser';
-import { Download } from './download';
-import * as frames from './frames';
+import type { Browser, BrowserOptions } from './browser';
+import type { Download } from './download';
+import type * as frames from './frames';
import { helper } from './helper';
import * as network from './network';
-import { Page, PageBinding, PageDelegate } from './page';
-import { Progress } from './progress';
-import { Selectors } from './selectors';
-import * as types from './types';
+import type { PageDelegate } from './page';
+import { Page, PageBinding } from './page';
+import type { Progress } from './progress';
+import type { Selectors } from './selectors';
+import type * as types from './types';
import path from 'path';
import fs from 'fs';
-import { CallMetadata, serverSideCallMetadata, SdkObject } from './instrumentation';
+import type { CallMetadata } from './instrumentation';
+import { serverSideCallMetadata, SdkObject } from './instrumentation';
import { Debugger } from './supplements/debugger';
import { Tracing } from './trace/recorder/tracing';
import { HarRecorder } from './supplements/har/harRecorder';
diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.ts
index dd21bbb679..e0e4b31388 100644
--- a/packages/playwright-core/src/server/browserType.ts
+++ b/packages/playwright-core/src/server/browserType.ts
@@ -17,19 +17,25 @@
import fs from 'fs';
import * as os from 'os';
import path from 'path';
-import { BrowserContext, normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
-import { registry, BrowserName } from '../utils/registry';
-import { ConnectionTransport, WebSocketTransport } from './transport';
-import { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser';
-import { launchProcess, Env, envArrayToObject } from '../utils/processLauncher';
+import type { BrowserContext } from './browserContext';
+import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
+import type { BrowserName } from '../utils/registry';
+import { registry } from '../utils/registry';
+import type { ConnectionTransport } from './transport';
+import { WebSocketTransport } from './transport';
+import type { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser';
+import type { Env } from '../utils/processLauncher';
+import { launchProcess, envArrayToObject } from '../utils/processLauncher';
import { PipeTransport } from './pipeTransport';
-import { Progress, ProgressController } from './progress';
-import * as types from './types';
+import type { Progress } from './progress';
+import { ProgressController } from './progress';
+import type * as types from './types';
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/timeoutSettings';
import { debugMode, existsAsync } from '../utils/utils';
import { helper } from './helper';
import { RecentLogsCollector } from '../utils/debugLogger';
-import { CallMetadata, SdkObject } from './instrumentation';
+import type { CallMetadata } from './instrumentation';
+import { SdkObject } from './instrumentation';
export const kNoXServerRunningError = 'Looks like you launched a headed browser without having a XServer running.\n' +
'Set either \'headless: false\' 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 93f93d8a43..2f39ec9efc 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -19,20 +19,25 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import { CRBrowser } from './crBrowser';
-import { Env, gracefullyCloseSet } from '../../utils/processLauncher';
+import type { Env } from '../../utils/processLauncher';
+import { gracefullyCloseSet } from '../../utils/processLauncher';
import { kBrowserCloseMessageId } from './crConnection';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { BrowserType, kNoXServerRunningError } from '../browserType';
-import { ConnectionTransport, ProtocolRequest, WebSocketTransport } from '../transport';
+import type { ConnectionTransport, ProtocolRequest } from '../transport';
+import { WebSocketTransport } from '../transport';
import { CRDevTools } from './crDevTools';
-import { Browser, BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
-import * as types from '../types';
-import { debugMode, fetchData, getUserAgent, headersArrayToObject, HTTPRequestParams, removeFolders, streamToString, wrapInASCIIBox } from '../../utils/utils';
+import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
+import { Browser } from '../browser';
+import type * as types from '../types';
+import type { HTTPRequestParams } from '../../utils/utils';
+import { debugMode, fetchData, getUserAgent, headersArrayToObject, removeFolders, streamToString, wrapInASCIIBox } from '../../utils/utils';
import { RecentLogsCollector } from '../../utils/debugLogger';
-import { Progress, ProgressController } from '../progress';
+import type { Progress } from '../progress';
+import { ProgressController } from '../progress';
import { TimeoutSettings } from '../../utils/timeoutSettings';
import { helper } from '../helper';
-import { CallMetadata } from '../instrumentation';
+import type { CallMetadata } from '../instrumentation';
import http from 'http';
import https from 'https';
import { registry } from '../../utils/registry';
diff --git a/packages/playwright-core/src/server/chromium/crAccessibility.ts b/packages/playwright-core/src/server/chromium/crAccessibility.ts
index 6de870c1c6..5709539e48 100644
--- a/packages/playwright-core/src/server/chromium/crAccessibility.ts
+++ b/packages/playwright-core/src/server/chromium/crAccessibility.ts
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import { CRSession } from './crConnection';
-import { Protocol } from './protocol';
-import * as dom from '../dom';
-import * as accessibility from '../accessibility';
-import * as types from '../types';
+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 types from '../types';
export async function getAccessibilityTree(client: CRSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const { nodes } = await client.send('Accessibility.getFullAXTree');
diff --git a/packages/playwright-core/src/server/chromium/crApp.ts b/packages/playwright-core/src/server/chromium/crApp.ts
index de890f28c2..dd132dc648 100644
--- a/packages/playwright-core/src/server/chromium/crApp.ts
+++ b/packages/playwright-core/src/server/chromium/crApp.ts
@@ -15,8 +15,8 @@
*/
import fs from 'fs';
-import { Page } from '../page';
-import { CRPage } from './crPage';
+import type { Page } from '../page';
+import type { CRPage } from './crPage';
export async function installAppIcon(page: Page) {
const icon = await fs.promises.readFile(require.resolve('./appIcon.png'));
diff --git a/packages/playwright-core/src/server/chromium/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.ts
index dcb42f9aa1..2f85948a88 100644
--- a/packages/playwright-core/src/server/chromium/crBrowser.ts
+++ b/packages/playwright-core/src/server/chromium/crBrowser.ts
@@ -15,21 +15,24 @@
* limitations under the License.
*/
-import { Browser, BrowserOptions } from '../browser';
+import type { BrowserOptions } from '../browser';
+import { Browser } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
import { assert } from '../../utils/utils';
import * as network from '../network';
-import { Page, PageBinding, PageDelegate, Worker } from '../page';
+import type { PageBinding, PageDelegate } from '../page';
+import { Page, Worker } from '../page';
import { Frame } from '../frames';
-import { Dialog } from '../dialog';
-import { ConnectionTransport } from '../transport';
-import * as types from '../types';
-import { ConnectionEvents, CRConnection, CRSession } from './crConnection';
+import type { Dialog } from '../dialog';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
+import type { CRSession } from './crConnection';
+import { ConnectionEvents, CRConnection } from './crConnection';
import { CRPage } from './crPage';
import { readProtocolStream } from './crProtocolHelper';
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
import { CRExecutionContext } from './crExecutionContext';
-import { CRDevTools } from './crDevTools';
+import type { CRDevTools } from './crDevTools';
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 660937b0ac..2138051353 100644
--- a/packages/playwright-core/src/server/chromium/crConnection.ts
+++ b/packages/playwright-core/src/server/chromium/crConnection.ts
@@ -16,12 +16,13 @@
*/
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
-import { Protocol } from './protocol';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { Protocol } from './protocol';
import { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { debugLogger, RecentLogsCollector } from '../../utils/debugLogger';
-import { ProtocolLogger } from '../types';
+import type { RecentLogsCollector } from '../../utils/debugLogger';
+import { debugLogger } from '../../utils/debugLogger';
+import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { ProtocolError } from '../protocolError';
diff --git a/packages/playwright-core/src/server/chromium/crCoverage.ts b/packages/playwright-core/src/server/chromium/crCoverage.ts
index 63ba1bb43e..022c6bf666 100644
--- a/packages/playwright-core/src/server/chromium/crCoverage.ts
+++ b/packages/playwright-core/src/server/chromium/crCoverage.ts
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-import { CRSession } from './crConnection';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
-import { Protocol } from './protocol';
-import * as types from '../types';
+import type { CRSession } from './crConnection';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
+import type { Protocol } from './protocol';
+import type * as types from '../types';
import { assert } from '../../utils/utils';
export class CRCoverage {
diff --git a/packages/playwright-core/src/server/chromium/crDevTools.ts b/packages/playwright-core/src/server/chromium/crDevTools.ts
index 47f44d0ad0..40cd134bcc 100644
--- a/packages/playwright-core/src/server/chromium/crDevTools.ts
+++ b/packages/playwright-core/src/server/chromium/crDevTools.ts
@@ -15,7 +15,7 @@
*/
import fs from 'fs';
-import { CRSession } from './crConnection';
+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 33d65a9939..ca1b3ea2dd 100644
--- a/packages/playwright-core/src/server/chromium/crDragDrop.ts
+++ b/packages/playwright-core/src/server/chromium/crDragDrop.ts
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { CRPage } from './crPage';
-import * as types from '../types';
+import type { CRPage } from './crPage';
+import type * as types from '../types';
import { assert } from '../../utils/utils';
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
import { toModifiersMask } from './crProtocolHelper';
declare global {
diff --git a/packages/playwright-core/src/server/chromium/crExecutionContext.ts b/packages/playwright-core/src/server/chromium/crExecutionContext.ts
index e7ce0b4712..b1bd9decb5 100644
--- a/packages/playwright-core/src/server/chromium/crExecutionContext.ts
+++ b/packages/playwright-core/src/server/chromium/crExecutionContext.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import { CRSession } from './crConnection';
+import type { CRSession } from './crConnection';
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
import * as js from '../javascript';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
diff --git a/packages/playwright-core/src/server/chromium/crInput.ts b/packages/playwright-core/src/server/chromium/crInput.ts
index 7cb361b4d1..6c27025be5 100644
--- a/packages/playwright-core/src/server/chromium/crInput.ts
+++ b/packages/playwright-core/src/server/chromium/crInput.ts
@@ -16,12 +16,12 @@
*/
import * as input from '../input';
-import * as types from '../types';
-import { CRSession } from './crConnection';
+import type * as types from '../types';
+import type { CRSession } from './crConnection';
import { macEditingCommands } from '../macEditingCommands';
import { isString } from '../../utils/utils';
-import { DragManager } from './crDragDrop';
-import { CRPage } from './crPage';
+import type { DragManager } from './crDragDrop';
+import type { CRPage } from './crPage';
import { toButtonsMask, toModifiersMask } from './crProtocolHelper';
export class RawKeyboardImpl implements input.RawKeyboard {
diff --git a/packages/playwright-core/src/server/chromium/crNetworkManager.ts b/packages/playwright-core/src/server/chromium/crNetworkManager.ts
index 5cb6b93659..98b5de3642 100644
--- a/packages/playwright-core/src/server/chromium/crNetworkManager.ts
+++ b/packages/playwright-core/src/server/chromium/crNetworkManager.ts
@@ -15,15 +15,16 @@
* limitations under the License.
*/
-import { CRSession } from './crConnection';
-import { Page } from '../page';
+import type { CRSession } from './crConnection';
+import type { Page } from '../page';
import { helper } from '../helper';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
-import { Protocol } from './protocol';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
+import type { Protocol } from './protocol';
import * as network from '../network';
-import * as frames from '../frames';
-import * as types from '../types';
-import { CRPage } from './crPage';
+import type * as frames from '../frames';
+import type * as types from '../types';
+import type { CRPage } from './crPage';
import { assert, headersObjectToArray } from '../../utils/utils';
export class CRNetworkManager {
diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts
index f9c2ec8aa4..20f63c6d12 100644
--- a/packages/playwright-core/src/server/chromium/crPage.ts
+++ b/packages/playwright-core/src/server/chromium/crPage.ts
@@ -16,21 +16,24 @@
*/
import path from 'path';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
import { registry } from '../../utils/registry';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { assert, createGuid, headersArrayToObject } from '../../utils/utils';
import * as dialog from '../dialog';
import * as dom from '../dom';
-import * as frames from '../frames';
+import type * as frames from '../frames';
import { helper } from '../helper';
import * as network from '../network';
-import { Page, PageBinding, PageDelegate, Worker } from '../page';
-import { Progress } from '../progress';
-import * as types from '../types';
+import type { PageBinding, PageDelegate } from '../page';
+import { Page, Worker } from '../page';
+import type { Progress } from '../progress';
+import type * as types from '../types';
import { getAccessibilityTree } from './crAccessibility';
import { CRBrowserContext } from './crBrowser';
-import { CRConnection, CRSession, CRSessionEvents } from './crConnection';
+import type { CRSession } from './crConnection';
+import { CRConnection, CRSessionEvents } from './crConnection';
import { CRCoverage } from './crCoverage';
import { DragManager } from './crDragDrop';
import { CRExecutionContext } from './crExecutionContext';
@@ -39,7 +42,7 @@ import { CRNetworkManager } from './crNetworkManager';
import { CRPDF } from './crPdf';
import { exceptionToError, releaseObject, toConsoleMessageLocation } from './crProtocolHelper';
import { platformToFontFamilies } from './defaultFontFamilies';
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
import { VideoRecorder } from './videoRecorder';
diff --git a/packages/playwright-core/src/server/chromium/crPdf.ts b/packages/playwright-core/src/server/chromium/crPdf.ts
index 19831822f2..9f541687f4 100644
--- a/packages/playwright-core/src/server/chromium/crPdf.ts
+++ b/packages/playwright-core/src/server/chromium/crPdf.ts
@@ -16,8 +16,8 @@
*/
import { assert } from '../../utils/utils';
-import * as types from '../types';
-import { CRSession } from './crConnection';
+import type * as types from '../types';
+import type { CRSession } from './crConnection';
import { readProtocolStream } from './crProtocolHelper';
const PagePaperFormats: { [key: string]: { width: number, height: number }} = {
diff --git a/packages/playwright-core/src/server/chromium/crProtocolHelper.ts b/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
index a5361ec713..94b9277e7f 100644
--- a/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
+++ b/packages/playwright-core/src/server/chromium/crProtocolHelper.ts
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import { CRSession } from './crConnection';
-import { Protocol } from './protocol';
+import type { CRSession } from './crConnection';
+import type { Protocol } from './protocol';
import fs from 'fs';
-import * as types from '../types';
+import type * as types from '../types';
import { mkdirIfNeeded } from '../../utils/utils';
import { splitErrorMessage } from '../../utils/stackTrace';
diff --git a/packages/playwright-core/src/server/chromium/defaultFontFamilies.ts b/packages/playwright-core/src/server/chromium/defaultFontFamilies.ts
index bc1c0dbfc0..a42a97dbd1 100644
--- a/packages/playwright-core/src/server/chromium/defaultFontFamilies.ts
+++ b/packages/playwright-core/src/server/chromium/defaultFontFamilies.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
// DO NOT EDIT: this map is generated from Chromium source code by utils/generate_chromium_default_font_families.js
export const platformToFontFamilies: { [key in 'linux'|'mac'|'win']: Protocol.Page.setFontFamiliesParameters } = {
diff --git a/packages/playwright-core/src/server/chromium/videoRecorder.ts b/packages/playwright-core/src/server/chromium/videoRecorder.ts
index b320d0fda3..d1cc9c5544 100644
--- a/packages/playwright-core/src/server/chromium/videoRecorder.ts
+++ b/packages/playwright-core/src/server/chromium/videoRecorder.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import { ChildProcess } from 'child_process';
+import type { ChildProcess } from 'child_process';
import { assert, monotonicTime } from '../../utils/utils';
import { Page } from '../page';
import { launchProcess } from '../../utils/processLauncher';
-import { Progress, ProgressController } from '../progress';
+import type { Progress } from '../progress';
+import { ProgressController } from '../progress';
import { serverSideCallMetadata } from '../instrumentation';
-import * as types from '../types';
+import type * as types from '../types';
const fps = 25;
diff --git a/packages/playwright-core/src/server/common/selectorParser.ts b/packages/playwright-core/src/server/common/selectorParser.ts
index 7e3de28b4f..db58f151c3 100644
--- a/packages/playwright-core/src/server/common/selectorParser.ts
+++ b/packages/playwright-core/src/server/common/selectorParser.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { InvalidSelectorError, CSSComplexSelectorList, parseCSS } from './cssParser';
+import type { CSSComplexSelectorList } from './cssParser';
+import { InvalidSelectorError, parseCSS } from './cssParser';
export { InvalidSelectorError, isInvalidSelectorError } from './cssParser';
export type ParsedSelectorPart = {
diff --git a/packages/playwright-core/src/server/console.ts b/packages/playwright-core/src/server/console.ts
index 3d3b85bc79..ccb23e7b39 100644
--- a/packages/playwright-core/src/server/console.ts
+++ b/packages/playwright-core/src/server/console.ts
@@ -15,8 +15,8 @@
*/
import { SdkObject } from './instrumentation';
-import * as js from './javascript';
-import { ConsoleMessageLocation } from './types';
+import type * as js from './javascript';
+import type { ConsoleMessageLocation } from './types';
export class ConsoleMessage extends SdkObject {
private _type: string;
diff --git a/packages/playwright-core/src/server/cookieStore.ts b/packages/playwright-core/src/server/cookieStore.ts
index fa93759ebc..9c7bd2dd38 100644
--- a/packages/playwright-core/src/server/cookieStore.ts
+++ b/packages/playwright-core/src/server/cookieStore.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as types from './types';
+import type * as types from './types';
class Cookie {
private _raw: types.NetworkCookie;
diff --git a/packages/playwright-core/src/server/dialog.ts b/packages/playwright-core/src/server/dialog.ts
index d334c147b9..e90e1e8a67 100644
--- a/packages/playwright-core/src/server/dialog.ts
+++ b/packages/playwright-core/src/server/dialog.ts
@@ -16,7 +16,7 @@
*/
import { assert } from '../utils/utils';
-import { Page } from './page';
+import type { Page } from './page';
import { SdkObject } from './instrumentation';
type OnHandle = (accept: boolean, promptText?: string) => Promise<void>;
diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.ts
index 316d350e86..7407de72c8 100644
--- a/packages/playwright-core/src/server/dom.ts
+++ b/packages/playwright-core/src/server/dom.ts
@@ -16,18 +16,19 @@
import * as mime from 'mime';
import * as injectedScriptSource from '../generated/injectedScriptSource';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
import { isSessionClosedError } from './protocolError';
-import { ScreenshotOptions } from './screenshotter';
-import * as frames from './frames';
+import type { ScreenshotOptions } from './screenshotter';
+import type * as frames from './frames';
import type { InjectedScript, InjectedScriptPoll, LogEntry, HitTargetInterceptionResult } from './injected/injectedScript';
-import { CallMetadata } from './instrumentation';
+import type { CallMetadata } from './instrumentation';
import * as js from './javascript';
-import { Page } from './page';
-import { Progress, ProgressController } from './progress';
-import { SelectorInfo } from './selectors';
-import * as types from './types';
-import { TimeoutOptions } from '../common/types';
+import type { Page } from './page';
+import type { Progress } from './progress';
+import { ProgressController } from './progress';
+import type { SelectorInfo } from './selectors';
+import type * as types from './types';
+import type { TimeoutOptions } from '../common/types';
import { experimentalFeaturesEnabled, isUnderTest } from '../utils/utils';
type SetInputFilesFiles = channels.ElementHandleSetInputFilesParams['files'];
diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.ts
index 8b6dac8822..195315deef 100644
--- a/packages/playwright-core/src/server/electron/electron.ts
+++ b/packages/playwright-core/src/server/electron/electron.ts
@@ -17,28 +17,31 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
-import { CRBrowser, CRBrowserContext } from '../chromium/crBrowser';
-import { CRConnection, CRSession } from '../chromium/crConnection';
-import { CRPage } from '../chromium/crPage';
+import type { CRBrowserContext } from '../chromium/crBrowser';
+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 * as js from '../javascript';
-import { Page } from '../page';
+import type { Page } from '../page';
import { TimeoutSettings } from '../../utils/timeoutSettings';
import { wrapInASCIIBox } from '../../utils/utils';
import { WebSocketTransport } from '../transport';
import { launchProcess, envArrayToObject } from '../../utils/processLauncher';
import { BrowserContext, validateBrowserContextOptions } from '../browserContext';
import type { BrowserWindow } from 'electron';
-import { Progress, ProgressController } from '../progress';
+import type { Progress } from '../progress';
+import { ProgressController } from '../progress';
import { helper } from '../helper';
import { eventsHelper } from '../../utils/eventsHelper';
-import { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
-import * as childProcess from 'child_process';
+import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
+import type * as childProcess from 'child_process';
import * as readline from 'readline';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { serverSideCallMetadata, SdkObject } from '../instrumentation';
-import * as channels from '../../protocol/channels';
-import { BrowserContextOptions } from '../types';
+import type * as channels from '../../protocol/channels';
+import type { BrowserContextOptions } from '../types';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.ts
index 9c5e282f67..abc05af34a 100644
--- a/packages/playwright-core/src/server/fetch.ts
+++ b/packages/playwright-core/src/server/fetch.ts
@@ -18,22 +18,25 @@ import * as http from 'http';
import * as https from 'https';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SocksProxyAgent } from 'socks-proxy-agent';
-import { pipeline, Readable, Transform, TransformCallback } from 'stream';
+import type { Readable, TransformCallback } from 'stream';
+import { pipeline, Transform } from 'stream';
import url from 'url';
import zlib from 'zlib';
-import { HTTPCredentials } from '../../types/types';
-import * as channels from '../protocol/channels';
+import type { HTTPCredentials } from '../../types/types';
+import type * as channels from '../protocol/channels';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { assert, createGuid, getUserAgent, monotonicTime } from '../utils/utils';
import { BrowserContext } from './browserContext';
import { CookieStore, domainMatches } from './cookieStore';
import { MultipartFormData } from './formData';
-import { CallMetadata, SdkObject } from './instrumentation';
-import { Playwright } from './playwright';
-import { Progress, ProgressController } from './progress';
+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 * as types from './types';
-import { HeadersArray, ProxySettings } from './types';
+import type * as types from './types';
+import type { HeadersArray, ProxySettings } from './types';
type FetchRequestOptions = {
userAgent: string;
diff --git a/packages/playwright-core/src/server/fileChooser.ts b/packages/playwright-core/src/server/fileChooser.ts
index c5fe59beaf..513a6fde07 100644
--- a/packages/playwright-core/src/server/fileChooser.ts
+++ b/packages/playwright-core/src/server/fileChooser.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { ElementHandle } from './dom';
-import { Page } from './page';
+import type { ElementHandle } from './dom';
+import type { Page } from './page';
export class FileChooser {
private _page: Page;
diff --git a/packages/playwright-core/src/server/firefox/ffAccessibility.ts b/packages/playwright-core/src/server/firefox/ffAccessibility.ts
index bac79b9646..4cd76c1e26 100644
--- a/packages/playwright-core/src/server/firefox/ffAccessibility.ts
+++ b/packages/playwright-core/src/server/firefox/ffAccessibility.ts
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import * as accessibility from '../accessibility';
-import { FFSession } from './ffConnection';
-import { Protocol } from './protocol';
-import * as dom from '../dom';
-import * as types from '../types';
+import type * as accessibility from '../accessibility';
+import type { FFSession } from './ffConnection';
+import type { Protocol } from './protocol';
+import type * as dom from '../dom';
+import type * as types from '../types';
export async function getAccessibilityTree(session: FFSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const objectId = needle ? needle._objectId : undefined;
diff --git a/packages/playwright-core/src/server/firefox/ffBrowser.ts b/packages/playwright-core/src/server/firefox/ffBrowser.ts
index f0c79fc45c..91d3116c87 100644
--- a/packages/playwright-core/src/server/firefox/ffBrowser.ts
+++ b/packages/playwright-core/src/server/firefox/ffBrowser.ts
@@ -17,15 +17,16 @@
import { kBrowserClosedError } from '../../utils/errors';
import { assert } from '../../utils/utils';
-import { Browser, BrowserOptions } from '../browser';
+import type { BrowserOptions } from '../browser';
+import { Browser } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
import * as network from '../network';
-import { Page, PageBinding, PageDelegate } from '../page';
-import { ConnectionTransport } from '../transport';
-import * as types from '../types';
+import type { Page, PageBinding, PageDelegate } from '../page';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
import { ConnectionEvents, FFConnection } from './ffConnection';
import { FFPage } from './ffPage';
-import { Protocol } from './protocol';
+import type { Protocol } from './protocol';
export class FFBrowser extends Browser {
_connection: FFConnection;
diff --git a/packages/playwright-core/src/server/firefox/ffConnection.ts b/packages/playwright-core/src/server/firefox/ffConnection.ts
index 0611faf31c..aa2108eb68 100644
--- a/packages/playwright-core/src/server/firefox/ffConnection.ts
+++ b/packages/playwright-core/src/server/firefox/ffConnection.ts
@@ -17,11 +17,12 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
-import { Protocol } from './protocol';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { debugLogger, RecentLogsCollector } from '../../utils/debugLogger';
-import { ProtocolLogger } from '../types';
+import type { RecentLogsCollector } from '../../utils/debugLogger';
+import { debugLogger } from '../../utils/debugLogger';
+import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { ProtocolError } from '../protocolError';
diff --git a/packages/playwright-core/src/server/firefox/ffExecutionContext.ts b/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
index 16b8c8d2b9..127303ee2d 100644
--- a/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
+++ b/packages/playwright-core/src/server/firefox/ffExecutionContext.ts
@@ -16,8 +16,8 @@
*/
import * as js from '../javascript';
-import { FFSession } from './ffConnection';
-import { Protocol } from './protocol';
+import type { FFSession } from './ffConnection';
+import type { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import { isSessionClosedError } from '../protocolError';
diff --git a/packages/playwright-core/src/server/firefox/ffInput.ts b/packages/playwright-core/src/server/firefox/ffInput.ts
index 7190c0f63b..6791c6b363 100644
--- a/packages/playwright-core/src/server/firefox/ffInput.ts
+++ b/packages/playwright-core/src/server/firefox/ffInput.ts
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import * as input from '../input';
-import { Page } from '../page';
-import * as types from '../types';
-import { FFSession } from './ffConnection';
+import type * as input from '../input';
+import type { Page } from '../page';
+import type * as types from '../types';
+import type { FFSession } from './ffConnection';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
let mask = 0;
diff --git a/packages/playwright-core/src/server/firefox/ffNetworkManager.ts b/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
index 56893dd3ed..c0018a0c42 100644
--- a/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
+++ b/packages/playwright-core/src/server/firefox/ffNetworkManager.ts
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
-import { FFSession } from './ffConnection';
-import { Page } from '../page';
+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 * as frames from '../frames';
-import * as types from '../types';
-import { Protocol } from './protocol';
-import { HeadersArray } from '../../server/types';
+import type * as frames from '../frames';
+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 d87d73360b..951d3ac807 100644
--- a/packages/playwright-core/src/server/firefox/ffPage.ts
+++ b/packages/playwright-core/src/server/firefox/ffPage.ts
@@ -17,19 +17,21 @@
import * as dialog from '../dialog';
import * as dom from '../dom';
-import * as frames from '../frames';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
+import type * as frames from '../frames';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
import { assert } from '../../utils/utils';
-import { Page, PageBinding, PageDelegate, Worker } from '../page';
-import * as types from '../types';
+import type { PageBinding, PageDelegate } from '../page';
+import { Page, Worker } from '../page';
+import type * as types from '../types';
import { getAccessibilityTree } from './ffAccessibility';
-import { FFBrowserContext } from './ffBrowser';
+import type { FFBrowserContext } from './ffBrowser';
import { FFSession, FFSessionEvents } from './ffConnection';
import { FFExecutionContext } from './ffExecutionContext';
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './ffInput';
import { FFNetworkManager } from './ffNetworkManager';
-import { Protocol } from './protocol';
-import { Progress } from '../progress';
+import type { Protocol } from './protocol';
+import type { Progress } from '../progress';
import { splitErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';
import { ManualPromise } from '../../utils/async';
diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.ts
index d5331f7d95..361ede064a 100644
--- a/packages/playwright-core/src/server/firefox/firefox.ts
+++ b/packages/playwright-core/src/server/firefox/firefox.ts
@@ -21,10 +21,10 @@ import path from 'path';
import { FFBrowser } from './ffBrowser';
import { kBrowserCloseMessageId } from './ffConnection';
import { BrowserType, kNoXServerRunningError } from '../browserType';
-import { Env } from '../../utils/processLauncher';
-import { ConnectionTransport } from '../transport';
-import { BrowserOptions, PlaywrightOptions } from '../browser';
-import * as types from '../types';
+import type { Env } from '../../utils/processLauncher';
+import type { ConnectionTransport } from '../transport';
+import type { BrowserOptions, PlaywrightOptions } from '../browser';
+import type * as types from '../types';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { wrapInASCIIBox } from '../../utils/utils';
diff --git a/packages/playwright-core/src/server/formData.ts b/packages/playwright-core/src/server/formData.ts
index 4aa88a8289..dadb92320f 100644
--- a/packages/playwright-core/src/server/formData.ts
+++ b/packages/playwright-core/src/server/formData.ts
@@ -15,7 +15,7 @@
*/
import mime from 'mime';
-import * as channels from '../protocol/channels';
+import type * as channels from '../protocol/channels';
export class MultipartFormData {
private readonly _boundary: string;
diff --git a/packages/playwright-core/src/server/frames.ts b/packages/playwright-core/src/server/frames.ts
index 58eb7ea796..93e372b29d 100644
--- a/packages/playwright-core/src/server/frames.ts
+++ b/packages/playwright-core/src/server/frames.ts
@@ -15,29 +15,33 @@
* limitations under the License.
*/
-import * as channels from '../protocol/channels';
-import { ConsoleMessage } from './console';
+import type * as channels from '../protocol/channels';
+import type { ConsoleMessage } from './console';
import * as dom from './dom';
import { helper } from './helper';
-import { eventsHelper, RegisteredListener } from '../utils/eventsHelper';
+import type { RegisteredListener } from '../utils/eventsHelper';
+import { eventsHelper } from '../utils/eventsHelper';
import * as js from './javascript';
import * as network from './network';
-import { Dialog } from './dialog';
+import type { Dialog } from './dialog';
import { Page } from './page';
import * as types from './types';
import { BrowserContext } from './browserContext';
-import { Progress, ProgressController } from './progress';
+import type { Progress } from './progress';
+import { ProgressController } from './progress';
import { assert, constructURLBasedOnBaseURL, makeWaitForNextTask } from '../utils/utils';
import { ManualPromise } from '../utils/async';
import { debugLogger } from '../utils/debugLogger';
-import { CallMetadata, serverSideCallMetadata, SdkObject } from './instrumentation';
+import type { CallMetadata } from './instrumentation';
+import { serverSideCallMetadata, SdkObject } from './instrumentation';
import { type InjectedScript } from './injected/injectedScript';
import type { ElementStateWithoutStable, FrameExpectParams, InjectedScriptPoll, InjectedScriptProgress } from './injected/injectedScript';
import { isSessionClosedError } from './protocolError';
-import { isInvalidSelectorError, splitSelectorByFrame, stringifySelector, ParsedSelector } from './common/selectorParser';
-import { SelectorInfo } from './selectors';
-import { ScreenshotOptions } from './screenshotter';
-import { InputFilesItems } from './dom';
+import type { ParsedSelector } from './common/selectorParser';
+import { isInvalidSelectorError, splitSelectorByFrame, stringifySelector } from './common/selectorParser';
+import type { SelectorInfo } from './selectors';
+import type { ScreenshotOptions } from './screenshotter';
+import type { InputFilesItems } from './dom';
type ContextData = {
contextPromise: ManualPromise<dom.FrameExecutionContext | Error>;
diff --git a/packages/playwright-core/src/server/helper.ts b/packages/playwright-core/src/server/helper.ts
index 6341d18ae0..a2190a1bed 100644
--- a/packages/playwright-core/src/server/helper.ts
+++ b/packages/playwright-core/src/server/helper.ts
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-import { EventEmitter } from 'events';
-import * as types from './types';
-import { Progress } from './progress';
+import type { EventEmitter } from 'events';
+import type * as types from './types';
+import type { Progress } from './progress';
import { debugLogger } from '../utils/debugLogger';
-import { eventsHelper, RegisteredListener } from '../utils/eventsHelper';
+import type { RegisteredListener } from '../utils/eventsHelper';
+import { eventsHelper } from '../utils/eventsHelper';
class Helper {
static completeUserURL(urlString: string): string {
diff --git a/packages/playwright-core/src/server/injected/injectedScript.ts b/packages/playwright-core/src/server/injected/injectedScript.ts
index 1753d3186c..26cbba9c47 100644
--- a/packages/playwright-core/src/server/injected/injectedScript.ts
+++ b/packages/playwright-core/src/server/injected/injectedScript.ts
@@ -14,14 +14,16 @@
* limitations under the License.
*/
-import { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
import { XPathEngine } from './xpathSelectorEngine';
import { ReactEngine } from './reactSelectorEngine';
import { VueEngine } from './vueSelectorEngine';
import { RoleEngine } from './roleSelectorEngine';
-import { allEngineNames, ParsedSelector, ParsedSelectorPart, parseSelector, stringifySelector } from '../common/selectorParser';
-import { SelectorEvaluatorImpl, isVisible, parentElementOrShadowHost, elementMatchesText, TextMatcher, createRegexTextMatcher, createStrictTextMatcher, createLaxTextMatcher } from './selectorEvaluator';
-import { CSSComplexSelectorList } from '../common/cssParser';
+import type { ParsedSelector, ParsedSelectorPart } from '../common/selectorParser';
+import { allEngineNames, parseSelector, stringifySelector } from '../common/selectorParser';
+import type { TextMatcher } from './selectorEvaluator';
+import { SelectorEvaluatorImpl, isVisible, parentElementOrShadowHost, elementMatchesText, createRegexTextMatcher, createStrictTextMatcher, createLaxTextMatcher } from './selectorEvaluator';
+import type { CSSComplexSelectorList } from '../common/cssParser';
import { generateSelector } from './selectorGenerator';
import type * as channels from '../../protocol/channels';
import { Highlight } from './highlight';
diff --git a/packages/playwright-core/src/server/injected/reactSelectorEngine.ts b/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
index 012be43940..d2dc94359f 100644
--- a/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/reactSelectorEngine.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
import { isInsideScope } from './selectorEvaluator';
import { checkComponentAttribute, parseComponentSelector } from './componentUtils';
diff --git a/packages/playwright-core/src/server/injected/roleSelectorEngine.ts b/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
index f5315c0236..3fcd78b83e 100644
--- a/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/roleSelectorEngine.ts
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-import { SelectorEngine, SelectorRoot } from './selectorEngine';
-import { matchesAttribute, parseComponentSelector, ParsedComponentAttribute, ParsedAttributeOperator } from './componentUtils';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { ParsedComponentAttribute, ParsedAttributeOperator } from './componentUtils';
+import { matchesAttribute, parseComponentSelector } from './componentUtils';
import { getAriaChecked, getAriaDisabled, getAriaExpanded, getAriaLevel, getAriaPressed, getAriaRole, getAriaSelected, getElementAccessibleName, isElementHiddenForAria, kAriaCheckedRoles, kAriaExpandedRoles, kAriaLevelRoles, kAriaPressedRoles, kAriaSelectedRoles } from './roleUtils';
const kSupportedAttributes = ['selected', 'checked', 'pressed', 'expanded', 'level', 'disabled', 'name', 'include-hidden'];
diff --git a/packages/playwright-core/src/server/injected/selectorEvaluator.ts b/packages/playwright-core/src/server/injected/selectorEvaluator.ts
index 1ae998b3e8..db036cb0f1 100644
--- a/packages/playwright-core/src/server/injected/selectorEvaluator.ts
+++ b/packages/playwright-core/src/server/injected/selectorEvaluator.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../common/cssParser';
+import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../common/cssParser';
import { customCSSNames } from '../common/selectorParser';
export type QueryContext = {
diff --git a/packages/playwright-core/src/server/injected/vueSelectorEngine.ts b/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
index 29689475eb..470c90b478 100644
--- a/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/vueSelectorEngine.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
import { isInsideScope } from './selectorEvaluator';
import { checkComponentAttribute, parseComponentSelector } from './componentUtils';
diff --git a/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts b/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts
index 26fb703616..f12dd4d3f4 100644
--- a/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts
+++ b/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { SelectorEngine, SelectorRoot } from './selectorEngine';
+import type { SelectorEngine, SelectorRoot } from './selectorEngine';
export const XPathEngine: SelectorEngine = {
queryAll(root: SelectorRoot, selector: string): Element[] {
diff --git a/packages/playwright-core/src/server/input.ts b/packages/playwright-core/src/server/input.ts
index 305abd566a..422d723faf 100644
--- a/packages/playwright-core/src/server/input.ts
+++ b/packages/playwright-core/src/server/input.ts
@@ -16,7 +16,7 @@
import { assert } from '../utils/utils';
import * as keyboardLayout from './usKeyboardLayout';
-import * as types from './types';
+import type * as types from './types';
import type { Page } from './page';
export const keypadLocation = keyboardLayout.keypadLocation;
diff --git a/packages/playwright-core/src/server/javascript.ts b/packages/playwright-core/src/server/javascript.ts
index e42300170a..8d48cd615b 100644
--- a/packages/playwright-core/src/server/javascript.ts
+++ b/packages/playwright-core/src/server/javascript.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import * as dom from './dom';
+import type * as dom from './dom';
import * as utilityScriptSource from '../generated/utilityScriptSource';
import { serializeAsCallArgument } from './common/utilityScriptSerializers';
import { type UtilityScript } from './injected/utilityScript';
diff --git a/packages/playwright-core/src/server/network.ts b/packages/playwright-core/src/server/network.ts
index abce84c6a3..2e173bab23 100644
--- a/packages/playwright-core/src/server/network.ts
+++ b/packages/playwright-core/src/server/network.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import * as frames from './frames';
-import * as types from './types';
-import * as channels from '../protocol/channels';
+import type * as frames from './frames';
+import type * as types from './types';
+import type * as channels from '../protocol/channels';
import { assert } from '../utils/utils';
import { ManualPromise } from '../utils/async';
import { SdkObject } from './instrumentation';
-import { NameValue } from '../common/types';
+import type { NameValue } from '../common/types';
import { APIRequestContext } from './fetch';
export function filterCookies(cookies: types.NetworkCookie[], urls: string[]): types.NetworkCookie[] {
diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.ts
index 7a6bd7f844..cb7435ae5a 100644
--- a/packages/playwright-core/src/server/page.ts
+++ b/packages/playwright-core/src/server/page.ts
@@ -15,28 +15,33 @@
* limitations under the License.
*/
-import * as dom from './dom';
+import type * as dom from './dom';
import * as frames from './frames';
import * as input from './input';
import * as js from './javascript';
import * as network from './network';
-import { Screenshotter, ScreenshotOptions } from './screenshotter';
+import type { ScreenshotOptions } from './screenshotter';
+import { Screenshotter } from './screenshotter';
import { TimeoutSettings } from '../utils/timeoutSettings';
-import * as types from './types';
+import type * as types from './types';
import { BrowserContext } from './browserContext';
import { ConsoleMessage } from './console';
import * as accessibility from './accessibility';
import { FileChooser } from './fileChooser';
-import { Progress, ProgressController } from './progress';
+import type { Progress } from './progress';
+import { ProgressController } from './progress';
import { assert, isError } from '../utils/utils';
import { ManualPromise } from '../utils/async';
import { debugLogger } from '../utils/debugLogger';
-import { getComparator, ImageComparatorOptions } from '../utils/comparators';
-import { SelectorInfo, Selectors } from './selectors';
-import { CallMetadata, SdkObject } from './instrumentation';
-import { Artifact } from './artifact';
-import { TimeoutOptions } from '../common/types';
-import { isInvalidSelectorError, ParsedSelector } from './common/selectorParser';
+import type { ImageComparatorOptions } from '../utils/comparators';
+import { getComparator } from '../utils/comparators';
+import type { SelectorInfo, Selectors } from './selectors';
+import type { CallMetadata } from './instrumentation';
+import { SdkObject } from './instrumentation';
+import type { Artifact } from './artifact';
+import type { TimeoutOptions } from '../common/types';
+import type { ParsedSelector } from './common/selectorParser';
+import { isInvalidSelectorError } from './common/selectorParser';
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 40c37fb1b1..a3e0384d06 100644
--- a/packages/playwright-core/src/server/pipeTransport.ts
+++ b/packages/playwright-core/src/server/pipeTransport.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
import { makeWaitForNextTask } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';
diff --git a/packages/playwright-core/src/server/playwright.ts b/packages/playwright-core/src/server/playwright.ts
index f84c2962bc..54aeb95ac7 100644
--- a/packages/playwright-core/src/server/playwright.ts
+++ b/packages/playwright-core/src/server/playwright.ts
@@ -16,15 +16,16 @@
import { Android } from './android/android';
import { AdbBackend } from './android/backendAdb';
-import { PlaywrightOptions } from './browser';
+import type { PlaywrightOptions } from './browser';
import { Chromium } from './chromium/chromium';
import { Electron } from './electron/electron';
import { Firefox } from './firefox/firefox';
import { Selectors } from './selectors';
import { WebKit } from './webkit/webkit';
-import { CallMetadata, createInstrumentation, SdkObject } from './instrumentation';
+import type { CallMetadata } from './instrumentation';
+import { createInstrumentation, SdkObject } from './instrumentation';
import { debugLogger } from '../utils/debugLogger';
-import { Page } from './page';
+import type { Page } from './page';
export class Playwright extends SdkObject {
readonly selectors: Selectors;
diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.ts
index 216eda0235..d2e312a196 100644
--- a/packages/playwright-core/src/server/progress.ts
+++ b/packages/playwright-core/src/server/progress.ts
@@ -16,9 +16,9 @@
import { TimeoutError } from '../utils/errors';
import { assert, monotonicTime } from '../utils/utils';
-import { LogName } from '../utils/debugLogger';
-import { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
-import { ElementHandle } from './dom';
+import type { LogName } from '../utils/debugLogger';
+import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
+import type { ElementHandle } from './dom';
import { ManualPromise } from '../utils/async';
import type { LogEntry } from './injected/injectedScript';
diff --git a/packages/playwright-core/src/server/screenshotter.ts b/packages/playwright-core/src/server/screenshotter.ts
index dfaf834809..27b20f482d 100644
--- a/packages/playwright-core/src/server/screenshotter.ts
+++ b/packages/playwright-core/src/server/screenshotter.ts
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-import * as dom from './dom';
-import { Rect } from '../common/types';
+import type * as dom from './dom';
+import type { Rect } from '../common/types';
import { helper } from './helper';
-import { Page } from './page';
-import { Frame } from './frames';
-import { ParsedSelector } from './common/selectorParser';
-import * as types from './types';
-import { Progress } from './progress';
+import type { Page } from './page';
+import type { Frame } from './frames';
+import type { ParsedSelector } from './common/selectorParser';
+import type * as types from './types';
+import type { Progress } from './progress';
import { assert } from '../utils/utils';
import { MultiMap } from '../utils/multimap';
diff --git a/packages/playwright-core/src/server/selectors.ts b/packages/playwright-core/src/server/selectors.ts
index 25d5cc78b0..dbcfde373a 100644
--- a/packages/playwright-core/src/server/selectors.ts
+++ b/packages/playwright-core/src/server/selectors.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import * as dom from './dom';
-import * as frames from './frames';
-import * as js from './javascript';
-import * as types from './types';
-import { allEngineNames, InvalidSelectorError, ParsedSelector, parseSelector, stringifySelector } from './common/selectorParser';
+import type * as dom from './dom';
+import type * as frames from './frames';
+import type * as js from './javascript';
+import type * as types from './types';
+import type { ParsedSelector } from './common/selectorParser';
+import { allEngineNames, InvalidSelectorError, parseSelector, stringifySelector } from './common/selectorParser';
import { createGuid, experimentalFeaturesEnabled } from '../utils/utils';
export type SelectorInfo = {
diff --git a/packages/playwright-core/src/server/supplements/debugger.ts b/packages/playwright-core/src/server/supplements/debugger.ts
index 0e99cefc0e..d56fa5d1fd 100644
--- a/packages/playwright-core/src/server/supplements/debugger.ts
+++ b/packages/playwright-core/src/server/supplements/debugger.ts
@@ -16,8 +16,8 @@
import { EventEmitter } from 'events';
import { debugMode, isUnderTest, monotonicTime } from '../../utils/utils';
-import { BrowserContext } from '../browserContext';
-import { CallMetadata, InstrumentationListener, SdkObject } from '../instrumentation';
+import type { BrowserContext } from '../browserContext';
+import type { CallMetadata, InstrumentationListener, SdkObject } from '../instrumentation';
import { commandsWithTracingSnapshots, pausesBeforeInputActions } from '../../protocol/channels';
const symbol = Symbol('Debugger');
diff --git a/packages/playwright-core/src/server/supplements/har/harRecorder.ts b/packages/playwright-core/src/server/supplements/har/harRecorder.ts
index 881a98d11c..1684332758 100644
--- a/packages/playwright-core/src/server/supplements/har/harRecorder.ts
+++ b/packages/playwright-core/src/server/supplements/har/harRecorder.ts
@@ -15,10 +15,10 @@
*/
import fs from 'fs';
-import { APIRequestContext } from '../../fetch';
+import type { APIRequestContext } from '../../fetch';
import { Artifact } from '../../artifact';
-import { BrowserContext } from '../../browserContext';
-import * as har from './har';
+import type { BrowserContext } from '../../browserContext';
+import type * as har from './har';
import { HarTracer } from './harTracer';
type HarOptions = {
diff --git a/packages/playwright-core/src/server/supplements/har/harTracer.ts b/packages/playwright-core/src/server/supplements/har/harTracer.ts
index 6a0e791e99..ec289575b1 100644
--- a/packages/playwright-core/src/server/supplements/har/harTracer.ts
+++ b/packages/playwright-core/src/server/supplements/har/harTracer.ts
@@ -15,13 +15,15 @@
*/
import { BrowserContext } from '../../browserContext';
-import { APIRequestContext, APIRequestEvent, APIRequestFinishedEvent } from '../../fetch';
+import type { APIRequestEvent, APIRequestFinishedEvent } from '../../fetch';
+import { APIRequestContext } from '../../fetch';
import { helper } from '../../helper';
import * as network from '../../network';
import { Page } from '../../page';
-import * as har from './har';
+import type * as har from './har';
import { calculateSha1, monotonicTime } from '../../../utils/utils';
-import { eventsHelper, RegisteredListener } from '../../../utils/eventsHelper';
+import type { RegisteredListener } from '../../../utils/eventsHelper';
+import { eventsHelper } from '../../../utils/eventsHelper';
import * as mime from 'mime';
import { ManualPromise } from '../../../utils/async';
diff --git a/packages/playwright-core/src/server/supplements/recorder/codeGenerator.ts b/packages/playwright-core/src/server/supplements/recorder/codeGenerator.ts
index 7a11fa48f2..448f92c7a5 100644
--- a/packages/playwright-core/src/server/supplements/recorder/codeGenerator.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/codeGenerator.ts
@@ -16,9 +16,9 @@
import { EventEmitter } from 'events';
import type { BrowserContextOptions, LaunchOptions } from '../../../..';
-import { Frame } from '../../frames';
-import { LanguageGenerator, LanguageGeneratorOptions } from './language';
-import { Action, Signal, FrameDescription } from './recorderActions';
+import type { Frame } from '../../frames';
+import type { LanguageGenerator, LanguageGeneratorOptions } from './language';
+import type { Action, Signal, FrameDescription } from './recorderActions';
export type ActionInContext = {
frame: FrameDescription;
diff --git a/packages/playwright-core/src/server/supplements/recorder/csharp.ts b/packages/playwright-core/src/server/supplements/recorder/csharp.ts
index 4c7f21ff5e..57f08259ea 100644
--- a/packages/playwright-core/src/server/supplements/recorder/csharp.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/csharp.ts
@@ -15,10 +15,13 @@
*/
import type { BrowserContextOptions } from '../../../..';
-import { LanguageGenerator, LanguageGeneratorOptions, sanitizeDeviceOptions, toSignalMap } from './language';
-import { ActionInContext } from './codeGenerator';
-import { actionTitle, Action } from './recorderActions';
-import { MouseClickOptions, toModifiers } from './utils';
+import type { LanguageGenerator, LanguageGeneratorOptions } from './language';
+import { sanitizeDeviceOptions, toSignalMap } from './language';
+import type { ActionInContext } from './codeGenerator';
+import type { Action } from './recorderActions';
+import { actionTitle } from './recorderActions';
+import type { MouseClickOptions } from './utils';
+import { toModifiers } from './utils';
import { escapeWithQuotes } from '../../../utils/stringUtils';
import deviceDescriptors from '../../deviceDescriptors';
diff --git a/packages/playwright-core/src/server/supplements/recorder/java.ts b/packages/playwright-core/src/server/supplements/recorder/java.ts
index e000d8ca7f..0ca92d7d31 100644
--- a/packages/playwright-core/src/server/supplements/recorder/java.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/java.ts
@@ -15,10 +15,13 @@
*/
import type { BrowserContextOptions } from '../../../..';
-import { LanguageGenerator, LanguageGeneratorOptions, toSignalMap } from './language';
-import { ActionInContext } from './codeGenerator';
-import { Action, actionTitle } from './recorderActions';
-import { MouseClickOptions, toModifiers } from './utils';
+import type { LanguageGenerator, LanguageGeneratorOptions } from './language';
+import { toSignalMap } from './language';
+import type { ActionInContext } from './codeGenerator';
+import type { Action } from './recorderActions';
+import { actionTitle } from './recorderActions';
+import type { MouseClickOptions } from './utils';
+import { toModifiers } from './utils';
import deviceDescriptors from '../../deviceDescriptors';
import { JavaScriptFormatter } from './javascript';
import { escapeWithQuotes } from '../../../utils/stringUtils';
diff --git a/packages/playwright-core/src/server/supplements/recorder/javascript.ts b/packages/playwright-core/src/server/supplements/recorder/javascript.ts
index 6317efc19d..916c610a0a 100644
--- a/packages/playwright-core/src/server/supplements/recorder/javascript.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/javascript.ts
@@ -15,10 +15,13 @@
*/
import type { BrowserContextOptions } from '../../../..';
-import { LanguageGenerator, LanguageGeneratorOptions, sanitizeDeviceOptions, toSignalMap } from './language';
-import { ActionInContext } from './codeGenerator';
-import { Action, actionTitle } from './recorderActions';
-import { MouseClickOptions, toModifiers } from './utils';
+import type { LanguageGenerator, LanguageGeneratorOptions } from './language';
+import { sanitizeDeviceOptions, toSignalMap } from './language';
+import type { ActionInContext } from './codeGenerator';
+import type { Action } from './recorderActions';
+import { actionTitle } from './recorderActions';
+import type { MouseClickOptions } from './utils';
+import { toModifiers } from './utils';
import deviceDescriptors from '../../deviceDescriptors';
import { escapeWithQuotes } from '../../../utils/stringUtils';
diff --git a/packages/playwright-core/src/server/supplements/recorder/language.ts b/packages/playwright-core/src/server/supplements/recorder/language.ts
index 7160484d7d..8a35707f61 100644
--- a/packages/playwright-core/src/server/supplements/recorder/language.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/language.ts
@@ -15,8 +15,8 @@
*/
import type { BrowserContextOptions, LaunchOptions } from '../../../..';
-import { ActionInContext } from './codeGenerator';
-import { Action, DialogSignal, DownloadSignal, NavigationSignal, PopupSignal } from './recorderActions';
+import type { ActionInContext } from './codeGenerator';
+import type { Action, DialogSignal, DownloadSignal, NavigationSignal, PopupSignal } from './recorderActions';
export type LanguageGeneratorOptions = {
browserName: string;
diff --git a/packages/playwright-core/src/server/supplements/recorder/python.ts b/packages/playwright-core/src/server/supplements/recorder/python.ts
index 33c78f873d..56b3aab5f2 100644
--- a/packages/playwright-core/src/server/supplements/recorder/python.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/python.ts
@@ -15,10 +15,13 @@
*/
import type { BrowserContextOptions } from '../../../..';
-import { LanguageGenerator, LanguageGeneratorOptions, sanitizeDeviceOptions, toSignalMap } from './language';
-import { ActionInContext } from './codeGenerator';
-import { actionTitle, Action } from './recorderActions';
-import { MouseClickOptions, toModifiers } from './utils';
+import type { LanguageGenerator, LanguageGeneratorOptions } from './language';
+import { sanitizeDeviceOptions, toSignalMap } from './language';
+import type { ActionInContext } from './codeGenerator';
+import type { Action } from './recorderActions';
+import { actionTitle } from './recorderActions';
+import type { MouseClickOptions } from './utils';
+import { toModifiers } from './utils';
import { escapeWithQuotes } from '../../../utils/stringUtils';
import deviceDescriptors from '../../deviceDescriptors';
diff --git a/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts b/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts
index 1d7c470904..e851cdff2c 100644
--- a/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts
@@ -16,7 +16,7 @@
import fs from 'fs';
import path from 'path';
-import { Page } from '../../page';
+import type { Page } from '../../page';
import { ProgressController } from '../../progress';
import { EventEmitter } from 'events';
import { serverSideCallMetadata } from '../../instrumentation';
diff --git a/packages/playwright-core/src/server/supplements/recorder/recorderTypes.ts b/packages/playwright-core/src/server/supplements/recorder/recorderTypes.ts
index 6ee15e65b8..17dec3d773 100644
--- a/packages/playwright-core/src/server/supplements/recorder/recorderTypes.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/recorderTypes.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { Point } from '../../../common/types';
-import { SerializedError } from '../../../protocol/channels';
+import type { Point } from '../../../common/types';
+import type { SerializedError } from '../../../protocol/channels';
export type Mode = 'inspecting' | 'recording' | 'none';
diff --git a/packages/playwright-core/src/server/supplements/recorder/recorderUtils.ts b/packages/playwright-core/src/server/supplements/recorder/recorderUtils.ts
index 81f66702bd..7361d6fc96 100644
--- a/packages/playwright-core/src/server/supplements/recorder/recorderUtils.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/recorderUtils.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { CallMetadata } from '../../instrumentation';
-import { CallLog, CallLogStatus } from './recorderTypes';
+import type { CallMetadata } from '../../instrumentation';
+import type { CallLog, CallLogStatus } from './recorderTypes';
export function metadataToCallLog(metadata: CallMetadata, status: CallLogStatus): CallLog {
let title = metadata.apiName || metadata.method;
diff --git a/packages/playwright-core/src/server/supplements/recorder/utils.ts b/packages/playwright-core/src/server/supplements/recorder/utils.ts
index 8ee92aa453..53a0b82e74 100644
--- a/packages/playwright-core/src/server/supplements/recorder/utils.ts
+++ b/packages/playwright-core/src/server/supplements/recorder/utils.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { Frame } from '../../frames';
-import * as actions from './recorderActions';
+import type { Frame } from '../../frames';
+import type * as actions from './recorderActions';
export type MouseClickOptions = Parameters<Frame['click']>[2];
diff --git a/packages/playwright-core/src/server/supplements/recorderSupplement.ts b/packages/playwright-core/src/server/supplements/recorderSupplement.ts
index 95b9e74459..38a0198582 100644
--- a/packages/playwright-core/src/server/supplements/recorderSupplement.ts
+++ b/packages/playwright-core/src/server/supplements/recorderSupplement.ts
@@ -15,9 +15,10 @@
*/
import * as fs from 'fs';
-import * as actions from './recorder/recorderActions';
+import type * as actions from './recorder/recorderActions';
import type * as channels from '../../protocol/channels';
-import { CodeGenerator, ActionInContext } from './recorder/codeGenerator';
+import type { ActionInContext } from './recorder/codeGenerator';
+import { CodeGenerator } from './recorder/codeGenerator';
import { toClickOptions, toModifiers } from './recorder/utils';
import { Page } from '../page';
import { Frame } from '../frames';
@@ -28,10 +29,11 @@ import { CSharpLanguageGenerator } from './recorder/csharp';
import { PythonLanguageGenerator } from './recorder/python';
import * as recorderSource from '../../generated/recorderSource';
import * as consoleApiSource from '../../generated/consoleApiSource';
-import { IRecorderApp, RecorderApp } from './recorder/recorderApp';
-import { CallMetadata, InstrumentationListener, SdkObject } from '../instrumentation';
-import { Point } from '../../common/types';
-import { CallLog, CallLogStatus, EventData, Mode, Source, UIState } from './recorder/recorderTypes';
+import type { IRecorderApp } from './recorder/recorderApp';
+import { RecorderApp } from './recorder/recorderApp';
+import type { CallMetadata, InstrumentationListener, SdkObject } from '../instrumentation';
+import type { Point } from '../../common/types';
+import type { CallLog, CallLogStatus, EventData, Mode, Source, UIState } from './recorder/recorderTypes';
import { createGuid, monotonicTime } from '../../utils/utils';
import { metadataToCallLog } from './recorder/recorderUtils';
import { Debugger } from './debugger';
diff --git a/packages/playwright-core/src/server/trace/common/snapshotTypes.ts b/packages/playwright-core/src/server/trace/common/snapshotTypes.ts
index 3863e613c6..b66b05cf73 100644
--- a/packages/playwright-core/src/server/trace/common/snapshotTypes.ts
+++ b/packages/playwright-core/src/server/trace/common/snapshotTypes.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Entry as HAREntry } from '../../supplements/har/har';
+import type { Entry as HAREntry } from '../../supplements/har/har';
export type ResourceSnapshot = HAREntry;
diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
index 088f02f8b2..9f7ca1f90b 100644
--- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
+++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts
@@ -16,13 +16,15 @@
import { BrowserContext } from '../../browserContext';
import { Page } from '../../page';
-import { eventsHelper, RegisteredListener } from '../../../utils/eventsHelper';
+import type { RegisteredListener } from '../../../utils/eventsHelper';
+import { eventsHelper } from '../../../utils/eventsHelper';
import { debugLogger } from '../../../utils/debugLogger';
-import { Frame } from '../../frames';
-import { frameSnapshotStreamer, SnapshotData } from './snapshotterInjected';
+import type { Frame } from '../../frames';
+import type { SnapshotData } from './snapshotterInjected';
+import { frameSnapshotStreamer } from './snapshotterInjected';
import { calculateSha1, createGuid, monotonicTime } from '../../../utils/utils';
-import { FrameSnapshot } from '../common/snapshotTypes';
-import { ElementHandle } from '../../dom';
+import type { FrameSnapshot } from '../common/snapshotTypes';
+import type { ElementHandle } from '../../dom';
import * as mime from 'mime';
export type SnapshotterBlob = {
diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts b/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts
index ae3752cb30..03f9b86543 100644
--- a/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts
+++ b/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { NodeSnapshot } from '../common/snapshotTypes';
+import type { NodeSnapshot } from '../common/snapshotTypes';
export type SnapshotData = {
doctype?: string,
diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.ts
index 5743a9c6b3..98e218acc0 100644
--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts
+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts
@@ -14,28 +14,33 @@
* limitations under the License.
*/
-import { EventEmitter } from 'events';
+import type { EventEmitter } from 'events';
import fs from 'fs';
import os from 'os';
import path from 'path';
import yazl from 'yazl';
-import { NameValue } from '../../../common/types';
-import { commandsWithTracingSnapshots, TracingTracingStopChunkParams } from '../../../protocol/channels';
+import type { NameValue } from '../../../common/types';
+import type { TracingTracingStopChunkParams } from '../../../protocol/channels';
+import { commandsWithTracingSnapshots } from '../../../protocol/channels';
import { ManualPromise } from '../../../utils/async';
-import { eventsHelper, RegisteredListener } from '../../../utils/eventsHelper';
+import type { RegisteredListener } from '../../../utils/eventsHelper';
+import { eventsHelper } from '../../../utils/eventsHelper';
import { assert, calculateSha1, createGuid, mkdirIfNeeded, monotonicTime, removeFolders } from '../../../utils/utils';
import { Artifact } from '../../artifact';
import { BrowserContext } from '../../browserContext';
import { ElementHandle } from '../../dom';
-import { APIRequestContext } from '../../fetch';
-import { CallMetadata, InstrumentationListener, SdkObject } from '../../instrumentation';
+import type { APIRequestContext } from '../../fetch';
+import type { CallMetadata, InstrumentationListener } from '../../instrumentation';
+import { SdkObject } from '../../instrumentation';
import { Page } from '../../page';
-import * as har from '../../supplements/har/har';
-import { HarTracer, HarTracerDelegate } from '../../supplements/har/harTracer';
-import { FrameSnapshot } from '../common/snapshotTypes';
-import * as trace from '../common/traceEvents';
+import type * as har from '../../supplements/har/har';
+import type { HarTracerDelegate } from '../../supplements/har/harTracer';
+import { HarTracer } from '../../supplements/har/harTracer';
+import type { FrameSnapshot } from '../common/snapshotTypes';
+import type * as trace from '../common/traceEvents';
import { VERSION } from '../common/traceEvents';
-import { Snapshotter, SnapshotterBlob, SnapshotterDelegate } from './snapshotter';
+import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter';
+import { Snapshotter } from './snapshotter';
export type TracerOptions = {
name?: string;
diff --git a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
index a77b1618b7..9af2f7b83a 100644
--- a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
+++ b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-import { BrowserContext } from '../../browserContext';
-import { Page } from '../../page';
-import { FrameSnapshot } from '../common/snapshotTypes';
-import { SnapshotRenderer } from '../../../../../trace-viewer/src/snapshotRenderer';
+import type { BrowserContext } from '../../browserContext';
+import type { Page } from '../../page';
+import type { FrameSnapshot } from '../common/snapshotTypes';
+import type { SnapshotRenderer } from '../../../../../trace-viewer/src/snapshotRenderer';
import { BaseSnapshotStorage } from '../../../../../trace-viewer/src/snapshotStorage';
-import { Snapshotter, SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter';
-import { ElementHandle } from '../../dom';
-import { HarTracer, HarTracerDelegate } from '../../supplements/har/harTracer';
-import * as har from '../../supplements/har/har';
+import type { SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter';
+import { Snapshotter } from '../recorder/snapshotter';
+import type { ElementHandle } from '../../dom';
+import type { HarTracerDelegate } from '../../supplements/har/harTracer';
+import { HarTracer } from '../../supplements/har/harTracer';
+import type * as har from '../../supplements/har/har';
export class InMemorySnapshotter extends BaseSnapshotStorage 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 57e9ea4af6..530d124146 100644
--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts
+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts
@@ -20,7 +20,7 @@ import * as consoleApiSource from '../../../generated/consoleApiSource';
import { HttpServer } from '../../../utils/httpServer';
import { findChromiumChannel } from '../../../utils/registry';
import { isUnderTest } from '../../../utils/utils';
-import { BrowserContext } from '../../browserContext';
+import type { BrowserContext } from '../../browserContext';
import { installAppIcon } from '../../chromium/crApp';
import { serverSideCallMetadata } from '../../instrumentation';
import { createPlaywright } from '../../playwright';
diff --git a/packages/playwright-core/src/server/transport.ts b/packages/playwright-core/src/server/transport.ts
index b3751fd2c0..5e6bf8f94a 100644
--- a/packages/playwright-core/src/server/transport.ts
+++ b/packages/playwright-core/src/server/transport.ts
@@ -16,7 +16,7 @@
*/
import WebSocket from 'ws';
-import { Progress } from './progress';
+import type { Progress } from './progress';
import { makeWaitForNextTask } from '../utils/utils';
export type ProtocolRequest = {
diff --git a/packages/playwright-core/src/server/webkit/webkit.ts b/packages/playwright-core/src/server/webkit/webkit.ts
index dd32a078ab..a5ac94d958 100644
--- a/packages/playwright-core/src/server/webkit/webkit.ts
+++ b/packages/playwright-core/src/server/webkit/webkit.ts
@@ -16,13 +16,13 @@
*/
import { WKBrowser } from '../webkit/wkBrowser';
-import { Env } from '../../utils/processLauncher';
+import type { Env } from '../../utils/processLauncher';
import path from 'path';
import { kBrowserCloseMessageId } from './wkConnection';
import { BrowserType, kNoXServerRunningError } from '../browserType';
-import { ConnectionTransport } from '../transport';
-import { BrowserOptions, PlaywrightOptions } from '../browser';
-import * as types from '../types';
+import type { ConnectionTransport } from '../transport';
+import type { BrowserOptions, PlaywrightOptions } from '../browser';
+import type * as types from '../types';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { wrapInASCIIBox } from '../../utils/utils';
diff --git a/packages/playwright-core/src/server/webkit/wkAccessibility.ts b/packages/playwright-core/src/server/webkit/wkAccessibility.ts
index 5c6f248206..6c9beea675 100644
--- a/packages/playwright-core/src/server/webkit/wkAccessibility.ts
+++ b/packages/playwright-core/src/server/webkit/wkAccessibility.ts
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import * as accessibility from '../accessibility';
-import { WKSession } from './wkConnection';
-import { Protocol } from './protocol';
-import * as dom from '../dom';
-import * as types from '../types';
+import type * as accessibility from '../accessibility';
+import type { WKSession } from './wkConnection';
+import type { Protocol } from './protocol';
+import type * as dom from '../dom';
+import type * as types from '../types';
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
const objectId = needle ? needle._objectId : undefined;
diff --git a/packages/playwright-core/src/server/webkit/wkBrowser.ts b/packages/playwright-core/src/server/webkit/wkBrowser.ts
index ec3a083917..d54ffd2fee 100644
--- a/packages/playwright-core/src/server/webkit/wkBrowser.ts
+++ b/packages/playwright-core/src/server/webkit/wkBrowser.ts
@@ -15,16 +15,19 @@
* limitations under the License.
*/
-import { Browser, BrowserOptions } from '../browser';
+import type { BrowserOptions } from '../browser';
+import { Browser } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
import { assert } from '../../utils/utils';
import * as network from '../network';
-import { Page, PageBinding, PageDelegate } from '../page';
-import { ConnectionTransport } from '../transport';
-import * as types from '../types';
-import { Protocol } from './protocol';
-import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
+import type { Page, PageBinding, PageDelegate } from '../page';
+import type { ConnectionTransport } from '../transport';
+import type * as types from '../types';
+import type { Protocol } from './protocol';
+import type { PageProxyMessageReceivedPayload } from './wkConnection';
+import { kPageProxyMessageReceived, WKConnection, WKSession } from './wkConnection';
import { WKPage } from './wkPage';
import { kBrowserClosedError } from '../../utils/errors';
diff --git a/packages/playwright-core/src/server/webkit/wkConnection.ts b/packages/playwright-core/src/server/webkit/wkConnection.ts
index d3b452d5f3..7f8337fd11 100644
--- a/packages/playwright-core/src/server/webkit/wkConnection.ts
+++ b/packages/playwright-core/src/server/webkit/wkConnection.ts
@@ -17,11 +17,12 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
-import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
-import { Protocol } from './protocol';
+import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
+import type { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { debugLogger, RecentLogsCollector } from '../../utils/debugLogger';
-import { ProtocolLogger } from '../types';
+import type { RecentLogsCollector } from '../../utils/debugLogger';
+import { debugLogger } from '../../utils/debugLogger';
+import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { kBrowserClosedError } from '../../utils/errors';
import { ProtocolError } from '../protocolError';
diff --git a/packages/playwright-core/src/server/webkit/wkExecutionContext.ts b/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
index 5a5b25ba76..2595a09ff9 100644
--- a/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
+++ b/packages/playwright-core/src/server/webkit/wkExecutionContext.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { WKSession } from './wkConnection';
-import { Protocol } from './protocol';
+import type { WKSession } from './wkConnection';
+import type { Protocol } from './protocol';
import * as js from '../javascript';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import { isSessionClosedError } from '../protocolError';
diff --git a/packages/playwright-core/src/server/webkit/wkInput.ts b/packages/playwright-core/src/server/webkit/wkInput.ts
index b31a05d5ec..5d0550ac1a 100644
--- a/packages/playwright-core/src/server/webkit/wkInput.ts
+++ b/packages/playwright-core/src/server/webkit/wkInput.ts
@@ -16,9 +16,9 @@
*/
import * as input from '../input';
-import * as types from '../types';
+import type * as types from '../types';
import { macEditingCommands } from '../macEditingCommands';
-import { WKSession } from './wkConnection';
+import type { WKSession } from './wkConnection';
import { isString } from '../../utils/utils';
import type { Page } from '../page';
diff --git a/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts b/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
index ba681c434c..c8e9389438 100644
--- a/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
+++ b/packages/playwright-core/src/server/webkit/wkInterceptableRequest.ts
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-import * as frames from '../frames';
+import type * as frames from '../frames';
import * as network from '../network';
-import * as types from '../types';
-import { Protocol } from './protocol';
-import { WKSession } from './wkConnection';
+import type * as types from '../types';
+import type { Protocol } from './protocol';
+import type { WKSession } from './wkConnection';
import { assert, headersObjectToArray, headersArrayToObject } from '../../utils/utils';
import { ManualPromise } from '../../utils/async';
diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.ts
index 2fe09e0d6b..caf9e58444 100644
--- a/packages/playwright-core/src/server/webkit/wkPage.ts
+++ b/packages/playwright-core/src/server/webkit/wkPage.ts
@@ -20,20 +20,22 @@ import path from 'path';
import * as png from 'pngjs';
import { splitErrorMessage } from '../../utils/stackTrace';
import { assert, createGuid, debugAssert, headersArrayToObject, headersObjectToArray, hostPlatform } from '../../utils/utils';
-import * as accessibility from '../accessibility';
+import type * as accessibility from '../accessibility';
import * as dialog from '../dialog';
import * as dom from '../dom';
-import * as frames from '../frames';
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
+import type * as frames from '../frames';
+import type { RegisteredListener } from '../../utils/eventsHelper';
+import { eventsHelper } from '../../utils/eventsHelper';
import { helper } from '../helper';
-import { JSHandle } from '../javascript';
+import type { JSHandle } from '../javascript';
import * as network from '../network';
-import { Page, PageBinding, PageDelegate } from '../page';
-import { Progress } from '../progress';
-import * as types from '../types';
-import { Protocol } from './protocol';
+import type { PageBinding, PageDelegate } 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 { WKBrowserContext } from './wkBrowser';
+import type { WKBrowserContext } from './wkBrowser';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './wkInput';
diff --git a/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts b/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
index 67f3c4d26d..c41ece8c29 100644
--- a/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
+++ b/packages/playwright-core/src/server/webkit/wkProvisionalPage.ts
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-import { WKSession } from './wkConnection';
-import { WKPage } from './wkPage';
-import { RegisteredListener, eventsHelper } from '../../utils/eventsHelper';
-import { 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/utils';
export class WKProvisionalPage {
diff --git a/packages/playwright-core/src/server/webkit/wkWorkers.ts b/packages/playwright-core/src/server/webkit/wkWorkers.ts
index 294813ccdc..f4b28588d1 100644
--- a/packages/playwright-core/src/server/webkit/wkWorkers.ts
+++ b/packages/playwright-core/src/server/webkit/wkWorkers.ts
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
-import { Page, Worker } from '../page';
-import { Protocol } from './protocol';
+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 * as types from '../types';
+import type * as types from '../types';
export class WKWorkers {
private _sessionListeners: RegisteredListener[] = [];
diff --git a/packages/playwright-core/src/utils/eventsHelper.ts b/packages/playwright-core/src/utils/eventsHelper.ts
index 70f5207a88..bdf9a1502f 100644
--- a/packages/playwright-core/src/utils/eventsHelper.ts
+++ b/packages/playwright-core/src/utils/eventsHelper.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { EventEmitter } from 'events';
+import type { EventEmitter } from 'events';
export type RegisteredListener = {
emitter: EventEmitter;
diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/utils/httpServer.ts
index f7a3eb52f7..60bf243ab2 100644
--- a/packages/playwright-core/src/utils/httpServer.ts
+++ b/packages/playwright-core/src/utils/httpServer.ts
@@ -20,7 +20,7 @@ import path from 'path';
import { Server as WebSocketServer } from 'ws';
import * as mime from 'mime';
import { assert } from './utils';
-import { VirtualFileSystem } from './vfs';
+import type { VirtualFileSystem } from './vfs';
export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => boolean;
diff --git a/packages/playwright-core/src/utils/registry.ts b/packages/playwright-core/src/utils/registry.ts
index 409a032ea4..5912ccebaa 100644
--- a/packages/playwright-core/src/utils/registry.ts
+++ b/packages/playwright-core/src/utils/registry.ts
@@ -22,7 +22,8 @@ import * as fs from 'fs';
import lockfile from 'proper-lockfile';
import { getUbuntuVersion } from './ubuntuVersion';
import { getFromENV, getAsBooleanFromENV, getClientLanguage, calculateSha1, removeFolders, existsAsync, hostPlatform, canAccessFile, spawnAsync, fetchData, wrapInASCIIBox, transformCommandsForRoot } from './utils';
-import { DependencyGroup, installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
+import type { DependencyGroup } from './dependencies';
+import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';
const PACKAGE_PATH = path.join(__dirname, '..', '..');
diff --git a/packages/playwright-core/src/utils/socksProxy.ts b/packages/playwright-core/src/utils/socksProxy.ts
index b4c2fb65f4..245f04c650 100644
--- a/packages/playwright-core/src/utils/socksProxy.ts
+++ b/packages/playwright-core/src/utils/socksProxy.ts
@@ -16,7 +16,8 @@
import dns from 'dns';
import EventEmitter from 'events';
-import net, { AddressInfo } from 'net';
+import type { AddressInfo } from 'net';
+import net from 'net';
import util from 'util';
import { debugLogger } from './debugLogger';
import { createSocket } from './netUtils';
diff --git a/packages/playwright-core/src/utils/stackTrace.ts b/packages/playwright-core/src/utils/stackTrace.ts
index 727fb6ea9a..7042b4758e 100644
--- a/packages/playwright-core/src/utils/stackTrace.ts
+++ b/packages/playwright-core/src/utils/stackTrace.ts
@@ -15,7 +15,7 @@
*/
import path from 'path';
-import { StackFrame } from '../protocol/channels';
+import type { StackFrame } from '../protocol/channels';
import StackUtils from 'stack-utils';
import { isUnderTest } from './utils';
diff --git a/packages/playwright-core/src/utils/utils.ts b/packages/playwright-core/src/utils/utils.ts
index 6d7e4ad9e1..b5c1b7e924 100644
--- a/packages/playwright-core/src/utils/utils.ts
+++ b/packages/playwright-core/src/utils/utils.ts
@@ -16,17 +16,18 @@
import path from 'path';
import fs from 'fs';
-import stream from 'stream';
+import type stream from 'stream';
import removeFolder from 'rimraf';
import * as crypto from 'crypto';
import os from 'os';
import http from 'http';
import https from 'https';
-import { spawn, SpawnOptions, execSync } from 'child_process';
+import type { SpawnOptions } from 'child_process';
+import { spawn, execSync } from 'child_process';
import { getProxyForUrl } from 'proxy-from-env';
import * as URL from 'url';
import { getUbuntuVersionSync, parseOSReleaseText } from './ubuntuVersion';
-import { NameValue } from '../protocol/channels';
+import type { NameValue } from '../protocol/channels';
import ProgressBar from 'progress';
// `https-proxy-agent` v5 is written in TypeScript and exposes generated types.
diff --git a/packages/playwright-core/src/utils/vfs.ts b/packages/playwright-core/src/utils/vfs.ts
index 4b487c9ecb..f0a4241a36 100644
--- a/packages/playwright-core/src/utils/vfs.ts
+++ b/packages/playwright-core/src/utils/vfs.ts
@@ -16,7 +16,7 @@
import path from 'path';
import fs from 'fs';
-import stream from 'stream';
+import type stream from 'stream';
import yauzl from 'yauzl';
export interface VirtualFileSystem {
diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts
index e6764d0963..4d8e7d7e68 100644
--- a/packages/playwright-test/src/cli.ts
+++ b/packages/playwright-test/src/cli.ts
@@ -16,15 +16,16 @@
/* eslint-disable no-console */
-import { Command } from 'commander';
+import type { Command } from 'commander';
import fs from 'fs';
import url from 'url';
import path from 'path';
import os from 'os';
import type { Config } from './types';
-import { Runner, builtInReporters, BuiltInReporter, kDefaultConfigFiles } from './runner';
+import type { BuiltInReporter } from './runner';
+import { Runner, builtInReporters, kDefaultConfigFiles } from './runner';
import { stopProfiling, startProfiling } from './profiler';
-import { FilePatternFilter } from './util';
+import type { FilePatternFilter } from './util';
import { showHTMLReport } from './reporters/html';
import { GridServer } from 'playwright-core/lib/grid/gridServer';
import dockerFactory from 'playwright-core/lib/grid/dockerGridFactory';
diff --git a/packages/playwright-test/src/dispatcher.ts b/packages/playwright-test/src/dispatcher.ts
index 81adc33577..8412206894 100644
--- a/packages/playwright-test/src/dispatcher.ts
+++ b/packages/playwright-test/src/dispatcher.ts
@@ -17,10 +17,10 @@
import child_process from 'child_process';
import path from 'path';
import { EventEmitter } from 'events';
-import { RunPayload, TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, WorkerInitParams, StepBeginPayload, StepEndPayload, SerializedLoaderData, TeardownErrorsPayload } from './ipc';
+import type { RunPayload, TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, WorkerInitParams, StepBeginPayload, StepEndPayload, SerializedLoaderData, TeardownErrorsPayload } from './ipc';
import type { TestResult, Reporter, TestStep, TestError } from '../types/testReporter';
-import { Suite, TestCase } from './test';
-import { Loader } from './loader';
+import type { Suite, TestCase } from './test';
+import type { Loader } from './loader';
import { ManualPromise } from 'playwright-core/lib/utils/async';
export type TestGroup = {
diff --git a/packages/playwright-test/src/fixtures.ts b/packages/playwright-test/src/fixtures.ts
index 2d621f2d85..e592d1a5a6 100644
--- a/packages/playwright-test/src/fixtures.ts
+++ b/packages/playwright-test/src/fixtures.ts
@@ -16,10 +16,10 @@
import { formatLocation, debugTest } from './util';
import * as crypto from 'crypto';
-import { FixturesWithLocation, Location, WorkerInfo } from './types';
+import type { FixturesWithLocation, Location, WorkerInfo } from './types';
import { ManualPromise } from 'playwright-core/lib/utils/async';
-import { TestInfoImpl } from './testInfo';
-import { FixtureDescription, TimeoutManager } from './timeoutManager';
+import type { TestInfoImpl } from './testInfo';
+import type { FixtureDescription, TimeoutManager } from './timeoutManager';
type FixtureScope = 'test' | 'worker';
type FixtureOptions = { auto?: boolean, scope?: FixtureScope, option?: boolean, timeout?: number | undefined };
diff --git a/packages/playwright-test/src/globals.ts b/packages/playwright-test/src/globals.ts
index 6c0c0040c1..fb5119d613 100644
--- a/packages/playwright-test/src/globals.ts
+++ b/packages/playwright-test/src/globals.ts
@@ -15,7 +15,7 @@
*/
import type { TestInfoImpl } from './testInfo';
-import { Suite } from './test';
+import type { Suite } from './test';
let currentTestInfoValue: TestInfoImpl | null = null;
export function setCurrentTestInfo(testInfo: TestInfoImpl | null) {
diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.ts
index b21480df4f..b9fd27dedc 100644
--- a/packages/playwright-test/src/loader.ts
+++ b/packages/playwright-test/src/loader.ts
@@ -20,13 +20,14 @@ import type { FullConfigInternal } from './types';
import { getPackageJsonPath, mergeObjects, errorWithFile } from './util';
import { setCurrentlyLoadingFileSuite } from './globals';
import { Suite } from './test';
-import { SerializedLoaderData } from './ipc';
+import type { SerializedLoaderData } from './ipc';
import * as path from 'path';
import * as url from 'url';
import * as fs from 'fs';
import { ProjectImpl } from './project';
-import { Reporter } from '../types/testReporter';
-import { BuiltInReporter, builtInReporters } from './runner';
+import type { Reporter } from '../types/testReporter';
+import type { BuiltInReporter } from './runner';
+import { builtInReporters } from './runner';
import { isRegExp } from 'playwright-core/lib/utils/utils';
import { serializeError } from './util';
diff --git a/packages/playwright-test/src/matchers/matchers.ts b/packages/playwright-test/src/matchers/matchers.ts
index c409c53acb..d157e0d0a0 100644
--- a/packages/playwright-test/src/matchers/matchers.ts
+++ b/packages/playwright-test/src/matchers/matchers.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Locator, Page, APIResponse } from 'playwright-core';
+import type { Locator, Page, APIResponse } from 'playwright-core';
import type { FrameExpectOptions } from 'playwright-core/lib/client/types';
import { constructURLBasedOnBaseURL } from 'playwright-core/lib/utils/utils';
import type { Expect } from '../types';
@@ -22,7 +22,7 @@ import { expectTypes, callLogText } from '../util';
import { toBeTruthy } from './toBeTruthy';
import { toEqual } from './toEqual';
import { toExpectedTextValues, toMatchText } from './toMatchText';
-import { ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
+import type { ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
interface LocatorEx extends Locator {
_expect(customStackTrace: ParsedStackTrace, expression: string, options: Omit<FrameExpectOptions, 'expectedValue'> & { expectedValue?: any }): Promise<{ matches: boolean, received?: any, log?: string[] }>;
diff --git a/packages/playwright-test/src/matchers/toBeTruthy.ts b/packages/playwright-test/src/matchers/toBeTruthy.ts
index c885d1720d..53e18f4500 100644
--- a/packages/playwright-test/src/matchers/toBeTruthy.ts
+++ b/packages/playwright-test/src/matchers/toBeTruthy.ts
@@ -15,7 +15,8 @@
*/
import type { Expect } from '../types';
-import { expectTypes, callLogText, currentExpectTimeout, ParsedStackTrace, captureStackTrace } from '../util';
+import type { ParsedStackTrace } from '../util';
+import { expectTypes, callLogText, currentExpectTimeout, captureStackTrace } from '../util';
export async function toBeTruthy(
this: ReturnType<Expect['getState']>,
diff --git a/packages/playwright-test/src/matchers/toEqual.ts b/packages/playwright-test/src/matchers/toEqual.ts
index e920b636fe..39f516c394 100644
--- a/packages/playwright-test/src/matchers/toEqual.ts
+++ b/packages/playwright-test/src/matchers/toEqual.ts
@@ -17,7 +17,8 @@
import type { Expect } from '../types';
import { expectTypes } from '../util';
import { callLogText, currentExpectTimeout } from '../util';
-import { ParsedStackTrace, captureStackTrace } from 'playwright-core/lib/utils/stackTrace';
+import type { ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
+import { captureStackTrace } from 'playwright-core/lib/utils/stackTrace';
// Omit colon and one or more spaces, so can call getLabelPrinter.
const EXPECTED_LABEL = 'Expected';
diff --git a/packages/playwright-test/src/matchers/toMatchSnapshot.ts b/packages/playwright-test/src/matchers/toMatchSnapshot.ts
index 45df6f7d51..f325590c4f 100644
--- a/packages/playwright-test/src/matchers/toMatchSnapshot.ts
+++ b/packages/playwright-test/src/matchers/toMatchSnapshot.ts
@@ -14,24 +14,25 @@
* limitations under the License.
*/
-import { Locator, Page } from 'playwright-core';
+import type { Locator, Page } from 'playwright-core';
import type { Page as PageEx } from 'playwright-core/lib/client/page';
import type { Locator as LocatorEx } from 'playwright-core/lib/client/locator';
import type { Expect } from '../types';
import { currentTestInfo } from '../globals';
-import { getComparator, ImageComparatorOptions, Comparator } from 'playwright-core/lib/utils/comparators';
+import type { ImageComparatorOptions, Comparator } from 'playwright-core/lib/utils/comparators';
+import { getComparator } from 'playwright-core/lib/utils/comparators';
import type { PageScreenshotOptions } from 'playwright-core/types/types';
import {
addSuffixToFilePath, serializeError, sanitizeForFilePath,
trimLongString, callLogText, currentExpectTimeout,
expectTypes, captureStackTrace } from '../util';
-import { UpdateSnapshots } from '../types';
+import type { UpdateSnapshots } from '../types';
import colors from 'colors/safe';
import fs from 'fs';
import path from 'path';
import * as mime from 'mime';
-import { TestInfoImpl } from '../testInfo';
-import { SyncExpectationResult } from '../expect';
+import type { TestInfoImpl } from '../testInfo';
+import type { SyncExpectationResult } from '../expect';
type NameOrSegments = string | string[];
const snapshotNamesSymbol = Symbol('snapshotNames');
diff --git a/packages/playwright-test/src/matchers/toMatchText.ts b/packages/playwright-test/src/matchers/toMatchText.ts
index caeceeb44b..ab1c28c2eb 100644
--- a/packages/playwright-test/src/matchers/toMatchText.ts
+++ b/packages/playwright-test/src/matchers/toMatchText.ts
@@ -18,7 +18,8 @@
import type { ExpectedTextValue } from 'playwright-core/lib/protocol/channels';
import { isRegExp, isString } from 'playwright-core/lib/utils/utils';
import type { Expect } from '../types';
-import { expectTypes, callLogText, currentExpectTimeout, captureStackTrace, ParsedStackTrace } from '../util';
+import type { ParsedStackTrace } from '../util';
+import { expectTypes, callLogText, currentExpectTimeout, captureStackTrace } from '../util';
import {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring
diff --git a/packages/playwright-test/src/project.ts b/packages/playwright-test/src/project.ts
index e85fda8082..d5a83efb6f 100644
--- a/packages/playwright-test/src/project.ts
+++ b/packages/playwright-test/src/project.ts
@@ -15,9 +15,10 @@
*/
import type { Fixtures, FixturesWithLocation, FullProjectInternal } from './types';
-import { Suite, TestCase } from './test';
+import type { TestCase } from './test';
+import { Suite } from './test';
import { FixturePool, isFixtureOption } from './fixtures';
-import { TestTypeImpl } from './testType';
+import type { TestTypeImpl } from './testType';
import { calculateSha1 } from 'playwright-core/lib/utils/utils';
export class ProjectImpl {
diff --git a/packages/playwright-test/src/reporters/base.ts b/packages/playwright-test/src/reporters/base.ts
index 9da073fe2e..87640ec1e1 100644
--- a/packages/playwright-test/src/reporters/base.ts
+++ b/packages/playwright-test/src/reporters/base.ts
@@ -20,8 +20,8 @@ import fs from 'fs';
import milliseconds from 'ms';
import path from 'path';
import StackUtils from 'stack-utils';
-import { FullConfig, TestCase, Suite, TestResult, TestError, Reporter, FullResult, TestStep, Location } from '../../types/testReporter';
-import { FullConfigInternal } from '../types';
+import type { FullConfig, TestCase, Suite, TestResult, TestError, Reporter, FullResult, TestStep, Location } from '../../types/testReporter';
+import type { FullConfigInternal } from '../types';
const stackUtils = new StackUtils();
diff --git a/packages/playwright-test/src/reporters/dot.ts b/packages/playwright-test/src/reporters/dot.ts
index b29f113151..343604213b 100644
--- a/packages/playwright-test/src/reporters/dot.ts
+++ b/packages/playwright-test/src/reporters/dot.ts
@@ -16,7 +16,7 @@
import colors from 'colors/safe';
import { BaseReporter } from './base';
-import { FullResult, TestCase, TestResult, FullConfig, Suite } from '../../types/testReporter';
+import type { FullResult, TestCase, TestResult, FullConfig, Suite } from '../../types/testReporter';
class DotReporter extends BaseReporter {
private _counter = 0;
diff --git a/packages/playwright-test/src/reporters/empty.ts b/packages/playwright-test/src/reporters/empty.ts
index 921c8ac4d2..e5d310868e 100644
--- a/packages/playwright-test/src/reporters/empty.ts
+++ b/packages/playwright-test/src/reporters/empty.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Reporter } from '../../types/testReporter';
+import type { Reporter } from '../../types/testReporter';
class EmptyReporter implements Reporter {
}
diff --git a/packages/playwright-test/src/reporters/github.ts b/packages/playwright-test/src/reporters/github.ts
index 3ee6578f5d..5071ec63df 100644
--- a/packages/playwright-test/src/reporters/github.ts
+++ b/packages/playwright-test/src/reporters/github.ts
@@ -17,7 +17,7 @@
import milliseconds from 'ms';
import path from 'path';
import { BaseReporter, formatError, formatFailure, stripAnsiEscapes } from './base';
-import { TestCase, FullResult, TestError } from '../../types/testReporter';
+import type { TestCase, FullResult, TestError } from '../../types/testReporter';
type GitHubLogType = 'debug' | 'notice' | 'warning' | 'error';
diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts
index 55a625a526..0590fe4606 100644
--- a/packages/playwright-test/src/reporters/html.ts
+++ b/packages/playwright-test/src/reporters/html.ts
@@ -18,16 +18,18 @@ import colors from 'colors/safe';
import fs from 'fs';
import open from 'open';
import path from 'path';
-import { Transform, TransformCallback } from 'stream';
-import { FullConfig, Suite, Reporter } from '../../types/testReporter';
+import type { TransformCallback } from 'stream';
+import { Transform } from 'stream';
+import type { FullConfig, Suite, Reporter } from '../../types/testReporter';
import { HttpServer } from 'playwright-core/lib/utils/httpServer';
import { calculateSha1, removeFolders } from 'playwright-core/lib/utils/utils';
-import RawReporter, { JsonAttachment, JsonReport, JsonSuite, JsonTestCase, JsonTestResult, JsonTestStep } from './raw';
+import type { JsonAttachment, JsonReport, JsonSuite, JsonTestCase, JsonTestResult, JsonTestStep } from './raw';
+import RawReporter from './raw';
import assert from 'assert';
import yazl from 'yazl';
import { stripAnsiEscapes } from './base';
import { getPackageJsonPath } from '../util';
-import { FullConfigInternal } from '../types';
+import type { FullConfigInternal } from '../types';
export type Stats = {
total: number;
diff --git a/packages/playwright-test/src/reporters/json.ts b/packages/playwright-test/src/reporters/json.ts
index e0370b529d..97be4ad40a 100644
--- a/packages/playwright-test/src/reporters/json.ts
+++ b/packages/playwright-test/src/reporters/json.ts
@@ -16,7 +16,7 @@
import fs from 'fs';
import path from 'path';
-import { FullConfig, TestCase, Suite, TestResult, TestError, TestStep, FullResult, TestStatus, Location, Reporter } from '../../types/testReporter';
+import type { FullConfig, TestCase, Suite, TestResult, TestError, TestStep, FullResult, TestStatus, Location, Reporter } from '../../types/testReporter';
import { prepareErrorStack } from './base';
export interface JSONReport {
diff --git a/packages/playwright-test/src/reporters/junit.ts b/packages/playwright-test/src/reporters/junit.ts
index c53081bae0..c1b9afabab 100644
--- a/packages/playwright-test/src/reporters/junit.ts
+++ b/packages/playwright-test/src/reporters/junit.ts
@@ -16,7 +16,7 @@
import fs from 'fs';
import path from 'path';
-import { FullConfig, FullResult, Reporter, Suite, TestCase } from '../../types/testReporter';
+import type { FullConfig, FullResult, Reporter, Suite, TestCase } from '../../types/testReporter';
import { monotonicTime } from '../util';
import { formatFailure, formatTestTitle, stripAnsiEscapes } from './base';
diff --git a/packages/playwright-test/src/reporters/line.ts b/packages/playwright-test/src/reporters/line.ts
index f5d1083f4c..2e74a9eafc 100644
--- a/packages/playwright-test/src/reporters/line.ts
+++ b/packages/playwright-test/src/reporters/line.ts
@@ -16,7 +16,7 @@
import colors from 'colors/safe';
import { BaseReporter, formatFailure, formatTestTitle } from './base';
-import { FullConfig, TestCase, Suite, TestResult, FullResult } from '../../types/testReporter';
+import type { FullConfig, TestCase, Suite, TestResult, FullResult } from '../../types/testReporter';
class LineReporter extends BaseReporter {
private _current = 0;
diff --git a/packages/playwright-test/src/reporters/list.ts b/packages/playwright-test/src/reporters/list.ts
index 5e63c5a98b..8f7f393467 100644
--- a/packages/playwright-test/src/reporters/list.ts
+++ b/packages/playwright-test/src/reporters/list.ts
@@ -18,7 +18,7 @@
import colors from 'colors/safe';
import milliseconds from 'ms';
import { BaseReporter, formatTestTitle } from './base';
-import { FullConfig, FullResult, Suite, TestCase, TestResult, TestStep } from '../../types/testReporter';
+import type { FullConfig, FullResult, Suite, TestCase, TestResult, TestStep } from '../../types/testReporter';
// Allow it in the Visual Studio Code Terminal and the new Windows Terminal
const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === 'win32' && process.env.TERM_PROGRAM !== 'vscode' && !process.env.WT_SESSION;
diff --git a/packages/playwright-test/src/reporters/multiplexer.ts b/packages/playwright-test/src/reporters/multiplexer.ts
index 71a3e62f3b..63720d1ab3 100644
--- a/packages/playwright-test/src/reporters/multiplexer.ts
+++ b/packages/playwright-test/src/reporters/multiplexer.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { FullConfig, Suite, TestCase, TestError, TestResult, Reporter, FullResult, TestStep } from '../../types/testReporter';
+import type { FullConfig, Suite, TestCase, TestError, TestResult, Reporter, FullResult, TestStep } from '../../types/testReporter';
export class Multiplexer implements Reporter {
private _reporters: Reporter[];
diff --git a/packages/playwright-test/src/reporters/raw.ts b/packages/playwright-test/src/reporters/raw.ts
index 8c80fb83da..81974e900e 100644
--- a/packages/playwright-test/src/reporters/raw.ts
+++ b/packages/playwright-test/src/reporters/raw.ts
@@ -16,14 +16,14 @@
import fs from 'fs';
import path from 'path';
-import { FullConfig, Location, Suite, TestCase, TestResult, TestStatus, TestStep } from '../../types/testReporter';
+import type { FullConfig, Location, Suite, TestCase, TestResult, TestStatus, TestStep } from '../../types/testReporter';
import { assert, calculateSha1 } from 'playwright-core/lib/utils/utils';
import { sanitizeForFilePath } from '../util';
import { formatResultFailure } from './base';
import { toPosixPath, serializePatterns } from './json';
import { MultiMap } from 'playwright-core/lib/utils/multimap';
import { codeFrameColumns } from '@babel/code-frame';
-import { FullConfigInternal } from '../types';
+import type { FullConfigInternal } from '../types';
export type JsonLocation = Location;
export type JsonError = string;
diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts
index 0ecaa94c2f..369a6d59f2 100644
--- a/packages/playwright-test/src/runner.ts
+++ b/packages/playwright-test/src/runner.ts
@@ -19,11 +19,14 @@ import rimraf from 'rimraf';
import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';
-import { Dispatcher, TestGroup } from './dispatcher';
-import { createFileMatcher, createTitleMatcher, FilePatternFilter, serializeError } from './util';
-import { TestCase, Suite } from './test';
+import type { TestGroup } from './dispatcher';
+import { Dispatcher } from './dispatcher';
+import type { FilePatternFilter } from './util';
+import { createFileMatcher, createTitleMatcher, serializeError } from './util';
+import type { TestCase } from './test';
+import { Suite } from './test';
import { Loader } from './loader';
-import { FullResult, Reporter, TestError } from '../types/testReporter';
+import type { FullResult, Reporter, TestError } from '../types/testReporter';
import { Multiplexer } from './reporters/multiplexer';
import { formatError } from './reporters/base';
import DotReporter from './reporters/dot';
@@ -34,9 +37,9 @@ import JSONReporter from './reporters/json';
import JUnitReporter from './reporters/junit';
import EmptyReporter from './reporters/empty';
import HtmlReporter from './reporters/html';
-import { ProjectImpl } from './project';
+import type { ProjectImpl } from './project';
import { Minimatch } from 'minimatch';
-import { Config } from './types';
+import type { Config } from './types';
import type { FullConfigInternal } from './types';
import { WebServer } from './webServer';
import { raceAgainstTimeout } from 'playwright-core/lib/utils/async';
diff --git a/packages/playwright-test/src/test.ts b/packages/playwright-test/src/test.ts
index 935490f7d7..652a63789c 100644
--- a/packages/playwright-test/src/test.ts
+++ b/packages/playwright-test/src/test.ts
@@ -15,9 +15,9 @@
*/
import type { FixturePool } from './fixtures';
-import * as reporterTypes from '../types/testReporter';
+import type * as reporterTypes from '../types/testReporter';
import type { TestTypeImpl } from './testType';
-import { Annotation, FixturesWithLocation, FullProject, FullProjectInternal, Location } from './types';
+import type { Annotation, FixturesWithLocation, FullProject, FullProjectInternal, Location } from './types';
class Base {
title: string;
diff --git a/packages/playwright-test/src/testInfo.ts b/packages/playwright-test/src/testInfo.ts
index 47a5028437..611791ae6f 100644
--- a/packages/playwright-test/src/testInfo.ts
+++ b/packages/playwright-test/src/testInfo.ts
@@ -20,12 +20,12 @@ import path from 'path';
import { calculateSha1 } from 'playwright-core/lib/utils/utils';
import type { TestError, TestInfo, TestStatus } from '../types/test';
import type { FullConfigInternal, FullProjectInternal } from './types';
-import { WorkerInitParams } from './ipc';
-import { Loader } from './loader';
-import { ProjectImpl } from './project';
-import { TestCase } from './test';
+import type { WorkerInitParams } from './ipc';
+import type { Loader } from './loader';
+import type { ProjectImpl } from './project';
+import type { TestCase } from './test';
import { TimeoutManager } from './timeoutManager';
-import { Annotation, TestStepInternal } from './types';
+import type { Annotation, TestStepInternal } from './types';
import { addSuffixToFilePath, getContainedPath, monotonicTime, sanitizeForFilePath, serializeError, trimLongString } from './util';
export class TestInfoImpl implements TestInfo {
diff --git a/packages/playwright-test/src/testType.ts b/packages/playwright-test/src/testType.ts
index e3bd8f4103..f429ca5b87 100644
--- a/packages/playwright-test/src/testType.ts
+++ b/packages/playwright-test/src/testType.ts
@@ -18,7 +18,7 @@ import { expect } from './expect';
import { currentlyLoadingFileSuite, currentTestInfo, setCurrentlyLoadingFileSuite } from './globals';
import { TestCase, Suite } from './test';
import { wrapFunctionWithLocation } from './transform';
-import { Fixtures, FixturesWithLocation, Location, TestType } from './types';
+import type { Fixtures, FixturesWithLocation, Location, TestType } from './types';
import { errorWithLocation, serializeError } from './util';
const testTypeSymbol = Symbol('testType');
diff --git a/packages/playwright-test/src/timeoutManager.ts b/packages/playwright-test/src/timeoutManager.ts
index 538b625778..e6bad9e172 100644
--- a/packages/playwright-test/src/timeoutManager.ts
+++ b/packages/playwright-test/src/timeoutManager.ts
@@ -17,7 +17,7 @@
import colors from 'colors/safe';
import { TimeoutRunner, TimeoutRunnerError } from 'playwright-core/lib/utils/async';
import type { TestError } from '../types/test';
-import { Location } from './types';
+import type { Location } from './types';
export type TimeSlot = {
timeout: number;
diff --git a/packages/playwright-test/src/transform.ts b/packages/playwright-test/src/transform.ts
index 1d273fc796..84c4189bd8 100644
--- a/packages/playwright-test/src/transform.ts
+++ b/packages/playwright-test/src/transform.ts
@@ -22,7 +22,8 @@ import * as pirates from 'pirates';
import * as sourceMapSupport from 'source-map-support';
import * as url from 'url';
import type { Location } from './types';
-import { tsConfigLoader, TsConfigLoaderResult } from './third_party/tsconfig-loader';
+import type { TsConfigLoaderResult } from './third_party/tsconfig-loader';
+import { tsConfigLoader } from './third_party/tsconfig-loader';
import Module from 'module';
const version = 8;
diff --git a/packages/playwright-test/src/tsxTransform.ts b/packages/playwright-test/src/tsxTransform.ts
index a883818016..353ab4d592 100644
--- a/packages/playwright-test/src/tsxTransform.ts
+++ b/packages/playwright-test/src/tsxTransform.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { types as t, NodePath } from '@babel/core';
+import type { NodePath } from '@babel/core';
+import { types as t } from '@babel/core';
import { declare } from '@babel/helper-plugin-utils';
export default declare(api => {
diff --git a/packages/playwright-test/src/util.ts b/packages/playwright-test/src/util.ts
index 32c130ff15..15f9407fd8 100644
--- a/packages/playwright-test/src/util.ts
+++ b/packages/playwright-test/src/util.ts
@@ -25,7 +25,8 @@ import debug from 'debug';
import { calculateSha1, isRegExp } from 'playwright-core/lib/utils/utils';
import { isInternalFileName } from 'playwright-core/lib/utils/stackTrace';
import { currentTestInfo } from './globals';
-import { captureStackTrace as coreCaptureStackTrace, ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
+import type { ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
+import { captureStackTrace as coreCaptureStackTrace } from 'playwright-core/lib/utils/stackTrace';
export type { ParsedStackTrace };
diff --git a/packages/playwright-test/src/webServer.ts b/packages/playwright-test/src/webServer.ts
index bef4bd0c70..3127347bc1 100644
--- a/packages/playwright-test/src/webServer.ts
+++ b/packages/playwright-test/src/webServer.ts
@@ -19,9 +19,9 @@ import https from 'https';
import net from 'net';
import debug from 'debug';
import { raceAgainstTimeout } from 'playwright-core/lib/utils/async';
-import { WebServerConfig } from './types';
+import type { WebServerConfig } from './types';
import { launchProcess } from 'playwright-core/lib/utils/processLauncher';
-import { Reporter } from '../types/testReporter';
+import type { Reporter } from '../types/testReporter';
const DEFAULT_ENVIRONMENT_VARIABLES = {
'BROWSER': 'none', // Disable that create-react-app will open the page in the browser
diff --git a/packages/playwright-test/src/worker.ts b/packages/playwright-test/src/worker.ts
index 0f34a16075..16f10f7948 100644
--- a/packages/playwright-test/src/worker.ts
+++ b/packages/playwright-test/src/worker.ts
@@ -16,7 +16,7 @@
import { Console } from 'console';
import * as util from 'util';
-import { RunPayload, TeardownErrorsPayload, TestOutputPayload, WorkerInitParams } from './ipc';
+import type { RunPayload, TeardownErrorsPayload, TestOutputPayload, WorkerInitParams } from './ipc';
import { startProfiling, stopProfiling } from './profiler';
import { serializeError } from './util';
import { WorkerRunner } from './workerRunner';
diff --git a/packages/playwright-test/src/workerRunner.ts b/packages/playwright-test/src/workerRunner.ts
index ea2d57166b..c8db16c9c2 100644
--- a/packages/playwright-test/src/workerRunner.ts
+++ b/packages/playwright-test/src/workerRunner.ts
@@ -19,16 +19,17 @@ import rimraf from 'rimraf';
import util from 'util';
import { EventEmitter } from 'events';
import { relativeFilePath, serializeError } from './util';
-import { TestBeginPayload, TestEndPayload, RunPayload, DonePayload, WorkerInitParams, StepBeginPayload, StepEndPayload, TeardownErrorsPayload } from './ipc';
+import type { TestBeginPayload, TestEndPayload, RunPayload, DonePayload, WorkerInitParams, StepBeginPayload, StepEndPayload, TeardownErrorsPayload } from './ipc';
import { setCurrentTestInfo } from './globals';
import { Loader } from './loader';
-import { Suite, TestCase } from './test';
-import { Annotation, TestError, TestStepInternal } from './types';
-import { ProjectImpl } from './project';
+import type { Suite, TestCase } from './test';
+import type { Annotation, TestError, TestStepInternal } from './types';
+import type { ProjectImpl } from './project';
import { FixtureRunner } from './fixtures';
import { ManualPromise } from 'playwright-core/lib/utils/async';
import { TestInfoImpl } from './testInfo';
-import { TimeoutManager, TimeSlot } from './timeoutManager';
+import type { TimeSlot } from './timeoutManager';
+import { TimeoutManager } from './timeoutManager';
const removeFolderAsync = util.promisify(rimraf);
diff --git a/packages/trace-viewer/src/snapshotServer.ts b/packages/trace-viewer/src/snapshotServer.ts
index cd4c2f83f6..b4672518e3 100644
--- a/packages/trace-viewer/src/snapshotServer.ts
+++ b/packages/trace-viewer/src/snapshotServer.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { SnapshotStorage } from './snapshotStorage';
+import type { SnapshotStorage } from './snapshotStorage';
import type { Point } from '@playwright-core/common/types';
-import { URLSearchParams } from 'url';
-import { SnapshotRenderer } from './snapshotRenderer';
+import type { URLSearchParams } from 'url';
+import type { SnapshotRenderer } from './snapshotRenderer';
export class SnapshotServer {
private _snapshotStorage: SnapshotStorage;
diff --git a/packages/trace-viewer/src/traceModel.ts b/packages/trace-viewer/src/traceModel.ts
index 81a132abcc..1739d9abc9 100644
--- a/packages/trace-viewer/src/traceModel.ts
+++ b/packages/trace-viewer/src/traceModel.ts
@@ -19,7 +19,8 @@ import type * as trace from '@playwright-core/server/trace/common/traceEvents';
import type zip from '@zip.js/zip.js';
// @ts-ignore
import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js';
-import { ContextEntry, createEmptyContext, PageEntry } from './entries';
+import type { ContextEntry, PageEntry } from './entries';
+import { createEmptyContext } from './entries';
import { BaseSnapshotStorage } from './snapshotStorage';
const zipjs = zipImport as typeof zip;
diff --git a/packages/trace-viewer/src/ui/filmStrip.tsx b/packages/trace-viewer/src/ui/filmStrip.tsx
index 916350d2c7..f18a6d0f3d 100644
--- a/packages/trace-viewer/src/ui/filmStrip.tsx
+++ b/packages/trace-viewer/src/ui/filmStrip.tsx
@@ -15,12 +15,12 @@
*/
import './filmStrip.css';
-import { Boundaries, Size } from '../geometry';
+import type { Boundaries, Size } from '../geometry';
import * as React from 'react';
import { useMeasure } from './helpers';
import { upperBound } from '@web/uiUtils';
-import { PageEntry } from '../entries';
-import { MultiTraceModel } from './modelUtil';
+import type { PageEntry } from '../entries';
+import type { MultiTraceModel } from './modelUtil';
const tileSize = { width: 200, height: 45 };
diff --git a/packages/trace-viewer/src/ui/timeline.tsx b/packages/trace-viewer/src/ui/timeline.tsx
index 153f2013b3..c329555a0f 100644
--- a/packages/trace-viewer/src/ui/timeline.tsx
+++ b/packages/trace-viewer/src/ui/timeline.tsx
@@ -18,10 +18,10 @@
import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents';
import { msToString } from '@web/uiUtils';
import * as React from 'react';
-import { Boundaries } from '../geometry';
+import type { Boundaries } from '../geometry';
import { FilmStrip } from './filmStrip';
import { useMeasure } from './helpers';
-import { MultiTraceModel } from './modelUtil';
+import type { MultiTraceModel } from './modelUtil';
import './timeline.css';
type TimelineBar = {
diff --git a/packages/trace-viewer/src/ui/workbench.tsx b/packages/trace-viewer/src/ui/workbench.tsx
index 2f1b85054a..15fa64ed51 100644
--- a/packages/trace-viewer/src/ui/workbench.tsx
+++ b/packages/trace-viewer/src/ui/workbench.tsx
@@ -18,7 +18,7 @@ import type { ActionTraceEvent } from '@playwright-core/server/trace/common/trac
import { SplitView } from '@web/components/splitView';
import { msToString } from '@web/uiUtils';
import * as React from 'react';
-import { ContextEntry } from '../entries';
+import type { ContextEntry } from '../entries';
import { ActionList } from './actionList';
import { CallTab } from './callTab';
import { ConsoleTab } from './consoleTab';
diff --git a/packages/web/playwright.config.ts b/packages/web/playwright.config.ts
index e2a3cd5c4d..074632d9f7 100644
--- a/packages/web/playwright.config.ts
+++ b/packages/web/playwright.config.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { PlaywrightTestConfig, devices } from '@playwright/test';
+import type { PlaywrightTestConfig } from '@playwright/test';
+import { devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: 'src',
diff --git a/tests/android/androidTest.ts b/tests/android/androidTest.ts
index 802219c2c2..67f0b99e24 100644
--- a/tests/android/androidTest.ts
+++ b/tests/android/androidTest.ts
@@ -15,7 +15,7 @@
*/
import { baseTest } from '../config/baseTest';
-import { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
+import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
import type { AndroidDevice, BrowserContext } from 'playwright-core';
export { expect } from '@playwright/test';
diff --git a/tests/android/playwright.config.ts b/tests/android/playwright.config.ts
index 8aa5807bea..1aa3d12f33 100644
--- a/tests/android/playwright.config.ts
+++ b/tests/android/playwright.config.ts
@@ -19,7 +19,7 @@ loadEnv({ path: path.join(__dirname, '..', '..', '.env') });
import type { Config, PlaywrightTestOptions, PlaywrightWorkerOptions } from '@playwright/test';
import * as path from 'path';
-import { ServerWorkerOptions } from '../config/serverFixtures';
+import type { ServerWorkerOptions } from '../config/serverFixtures';
process.env.PWPAGE_IMPL = 'android';
diff --git a/tests/config/baseTest.ts b/tests/config/baseTest.ts
index 9d4bf8a857..96995f62ba 100644
--- a/tests/config/baseTest.ts
+++ b/tests/config/baseTest.ts
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-import { test, TestType, Fixtures } from '@playwright/test';
-import { commonFixtures, CommonFixtures } from './commonFixtures';
-import { serverFixtures, ServerFixtures, ServerWorkerOptions } from './serverFixtures';
+import type { TestType, Fixtures } from '@playwright/test';
+import { test } from '@playwright/test';
+import type { CommonFixtures } from './commonFixtures';
+import { commonFixtures } from './commonFixtures';
+import type { ServerFixtures, ServerWorkerOptions } from './serverFixtures';
+import { serverFixtures } from './serverFixtures';
import { coverageTest } from './coverageFixtures';
import { platformTest } from './platformFixtures';
import { testModeTest } from './testModeFixtures';
diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts
index 94d08d0fea..23c1f38907 100644
--- a/tests/config/browserTest.ts
+++ b/tests/config/browserTest.ts
@@ -16,12 +16,13 @@
import * as fs from 'fs';
import * as os from 'os';
-import { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
+import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
import * as path from 'path';
import type { BrowserContext, BrowserContextOptions, BrowserType, Page } from 'playwright-core';
import { removeFolders } from '../../packages/playwright-core/lib/utils/utils';
import { baseTest } from './baseTest';
-import { RemoteServer, RemoteServerOptions } from './remoteServer';
+import type { RemoteServerOptions } from './remoteServer';
+import { RemoteServer } from './remoteServer';
export type BrowserTestWorkerFixtures = PageWorkerFixtures & {
browserVersion: string;
diff --git a/tests/config/commonFixtures.ts b/tests/config/commonFixtures.ts
index 032ba0f498..e74a9cc6dd 100644
--- a/tests/config/commonFixtures.ts
+++ b/tests/config/commonFixtures.ts
@@ -15,7 +15,8 @@
*/
import type { Fixtures } from '@playwright/test';
-import { ChildProcess, execSync, spawn } from 'child_process';
+import type { ChildProcess } from 'child_process';
+import { execSync, spawn } from 'child_process';
import net from 'net';
type TestChildParams = {
diff --git a/tests/config/globalSetup.ts b/tests/config/globalSetup.ts
index cd5fbcaf7c..fec4194f31 100644
--- a/tests/config/globalSetup.ts
+++ b/tests/config/globalSetup.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { FullConfig } from '@playwright/test';
+import type { FullConfig } from '@playwright/test';
// We're dogfooding this, so the …/lib/… import is acceptable
import * as ci from '@playwright/test/lib/ci';
diff --git a/tests/config/proxy.ts b/tests/config/proxy.ts
index 3a445439c8..8f30aed985 100644
--- a/tests/config/proxy.ts
+++ b/tests/config/proxy.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { IncomingMessage, Server } from 'http';
-import { Socket } from 'net';
+import type { IncomingMessage, Server } from 'http';
+import type { Socket } from 'net';
import createProxy from 'proxy';
export class TestProxy {
diff --git a/tests/config/remoteServer.ts b/tests/config/remoteServer.ts
index 6890151db0..57b291e3b4 100644
--- a/tests/config/remoteServer.ts
+++ b/tests/config/remoteServer.ts
@@ -16,7 +16,7 @@
import path from 'path';
import type { BrowserType, Browser, LaunchOptions } from 'playwright-core';
-import { CommonFixtures, TestChildProcess } from './commonFixtures';
+import type { CommonFixtures, TestChildProcess } from './commonFixtures';
export type RemoteServerOptions = {
stallOnClose?: boolean;
diff --git a/tests/config/testMode.ts b/tests/config/testMode.ts
index 7a7462750d..ca05f48a82 100644
--- a/tests/config/testMode.ts
+++ b/tests/config/testMode.ts
@@ -16,7 +16,7 @@
import { GridClient } from '../../packages/playwright-core/lib/grid/gridClient';
import { start } from '../../packages/playwright-core/lib/outofprocess';
-import { Playwright } from '../../packages/playwright-core/lib/client/playwright';
+import type { Playwright } from '../../packages/playwright-core/lib/client/playwright';
export type TestModeName = 'default' | 'driver' | 'service' | 'service2';
diff --git a/tests/config/testModeFixtures.ts b/tests/config/testModeFixtures.ts
index 13dba65585..7ac6264443 100644
--- a/tests/config/testModeFixtures.ts
+++ b/tests/config/testModeFixtures.ts
@@ -15,7 +15,8 @@
*/
import { test } from '@playwright/test';
-import { DefaultTestMode, DriverTestMode, ServiceTestMode, TestModeName } from './testMode';
+import type { TestModeName } from './testMode';
+import { DefaultTestMode, DriverTestMode, ServiceTestMode } from './testMode';
export type TestModeWorkerOptions = {
mode: TestModeName;
diff --git a/tests/electron/electronTest.ts b/tests/electron/electronTest.ts
index b2d254fcf7..40cdb0edbd 100644
--- a/tests/electron/electronTest.ts
+++ b/tests/electron/electronTest.ts
@@ -16,9 +16,10 @@
import { baseTest } from '../config/baseTest';
import * as path from 'path';
-import { ElectronApplication, Page } from '@playwright/test';
-import { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
-import { traceViewerFixtures, TraceViewerFixtures } from '../config/traceViewerFixtures';
+import type { ElectronApplication, Page } from '@playwright/test';
+import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';
+import type { TraceViewerFixtures } from '../config/traceViewerFixtures';
+import { traceViewerFixtures } from '../config/traceViewerFixtures';
export { expect } from '@playwright/test';
type ElectronTestFixtures = PageTestFixtures & {
diff --git a/tests/electron/playwright.config.ts b/tests/electron/playwright.config.ts
index 59d8b827fb..b380043ff2 100644
--- a/tests/electron/playwright.config.ts
+++ b/tests/electron/playwright.config.ts
@@ -19,7 +19,7 @@ loadEnv({ path: path.join(__dirname, '..', '..', '.env') });
import type { Config, PlaywrightTestOptions, PlaywrightWorkerOptions } from '@playwright/test';
import * as path from 'path';
-import { CoverageWorkerOptions } from '../config/coverageFixtures';
+import type { CoverageWorkerOptions } from '../config/coverageFixtures';
process.env.PWPAGE_IMPL = 'electron';
diff --git a/tests/library/component-parser.spec.ts b/tests/library/component-parser.spec.ts
index 7a937b6437..201ed2d921 100644
--- a/tests/library/component-parser.spec.ts
+++ b/tests/library/component-parser.spec.ts
@@ -15,7 +15,8 @@
*/
import { playwrightTest as it, expect } from '../config/browserTest';
-import { ParsedComponentSelector, parseComponentSelector } from '../../packages/playwright-core/src/server/injected/componentUtils';
+import type { ParsedComponentSelector } from '../../packages/playwright-core/src/server/injected/componentUtils';
+import { parseComponentSelector } from '../../packages/playwright-core/src/server/injected/componentUtils';
const parse = (selector: string) => parseComponentSelector(selector, false);
const serialize = (parsed: ParsedComponentSelector) => {
diff --git a/tests/library/inspector/inspectorTest.ts b/tests/library/inspector/inspectorTest.ts
index 5b8c1625cf..9ec91f73ab 100644
--- a/tests/library/inspector/inspectorTest.ts
+++ b/tests/library/inspector/inspectorTest.ts
@@ -18,7 +18,7 @@ import { contextTest } from '../../config/browserTest';
import type { Page } from 'playwright-core';
import * as path from 'path';
import type { Source } from '../../../packages/playwright-core/src/server/supplements/recorder/recorderTypes';
-import { CommonFixtures, TestChildProcess } from '../../config/commonFixtures';
+import type { CommonFixtures, TestChildProcess } from '../../config/commonFixtures';
export { expect } from '@playwright/test';
type CLITestArgs = {
diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.ts
index 18de103fc2..d162c6fbd5 100644
--- a/tests/library/inspector/pause.spec.ts
+++ b/tests/library/inspector/pause.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Page } from 'playwright-core';
+import type { Page } from 'playwright-core';
import { test as it, expect } from './inspectorTest';
diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.ts
index 15bc3e307a..4010a1fa05 100644
--- a/tests/library/playwright.config.ts
+++ b/tests/library/playwright.config.ts
@@ -19,8 +19,8 @@ loadEnv({ path: path.join(__dirname, '..', '..', '.env') });
import type { Config, PlaywrightTestOptions, PlaywrightWorkerOptions } from '@playwright/test';
import * as path from 'path';
-import { TestModeWorkerOptions } from '../config/testModeFixtures';
-import { CoverageWorkerOptions } from '../config/coverageFixtures';
+import type { TestModeWorkerOptions } from '../config/testModeFixtures';
+import type { CoverageWorkerOptions } from '../config/coverageFixtures';
type BrowserName = 'chromium' | 'firefox' | 'webkit';
diff --git a/tests/library/port-forwarding-server.spec.ts b/tests/library/port-forwarding-server.spec.ts
index deda2af5a0..aef6d3082b 100644
--- a/tests/library/port-forwarding-server.spec.ts
+++ b/tests/library/port-forwarding-server.spec.ts
@@ -17,7 +17,7 @@
import childProcess from 'child_process';
import http from 'http';
import path from 'path';
-import net from 'net';
+import type net from 'net';
import { contextTest, expect } from '../config/browserTest';
import type { Page, Browser } from 'playwright-core';
diff --git a/tests/library/tap.spec.ts b/tests/library/tap.spec.ts
index 5831787a38..40be993139 100644
--- a/tests/library/tap.spec.ts
+++ b/tests/library/tap.spec.ts
@@ -15,7 +15,7 @@
*/
import { contextTest as it, expect } from '../config/browserTest';
-import { ElementHandle } from 'playwright-core';
+import type { ElementHandle } from 'playwright-core';
import type { ServerResponse } from 'http';
it.use({ hasTouch: true });
diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts
index 79376889e7..05df2f3201 100644
--- a/tests/library/trace-viewer.spec.ts
+++ b/tests/library/trace-viewer.spec.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { TraceViewerFixtures, traceViewerFixtures } from '../config/traceViewerFixtures';
+import type { TraceViewerFixtures } from '../config/traceViewerFixtures';
+import { traceViewerFixtures } from '../config/traceViewerFixtures';
import fs from 'fs';
import path from 'path';
import { expect, playwrightTest } from '../config/browserTest';
diff --git a/tests/page/locator-frame.spec.ts b/tests/page/locator-frame.spec.ts
index ad47b213ab..1e60849c2a 100644
--- a/tests/page/locator-frame.spec.ts
+++ b/tests/page/locator-frame.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Page } from 'playwright-core';
+import type { Page } from 'playwright-core';
import { test as it, expect } from './pageTest';
async function routeIframe(page: Page) {
diff --git a/tests/page/page-autowaiting-basic.spec.ts b/tests/page/page-autowaiting-basic.spec.ts
index 0190713b04..cd4924eed9 100644
--- a/tests/page/page-autowaiting-basic.spec.ts
+++ b/tests/page/page-autowaiting-basic.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { TestServer } from '../../utils/testserver';
+import type { TestServer } from '../../utils/testserver';
import { test as it, expect } from './pageTest';
function initServer(server: TestServer): string[] {
diff --git a/tests/page/page-network-idle.spec.ts b/tests/page/page-network-idle.spec.ts
index e711cd5f6e..a93d7ba3e9 100644
--- a/tests/page/page-network-idle.spec.ts
+++ b/tests/page/page-network-idle.spec.ts
@@ -17,7 +17,7 @@
import { test as it, expect } from './pageTest';
import type { Frame } from 'playwright-core';
-import { TestServer } from '../../utils/testserver';
+import type { TestServer } from '../../utils/testserver';
it('should navigate to empty page with networkidle', async ({ page, server }) => {
const response = await page.goto(server.EMPTY_PAGE, { waitUntil: 'networkidle' });
diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts
index 457b8a27d8..06804b2715 100644
--- a/tests/page/page-route.spec.ts
+++ b/tests/page/page-route.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Route } from 'playwright-core';
+import type { Route } from 'playwright-core';
import { test as it, expect } from './pageTest';
it('should intercept @smoke', async ({ page, server }) => {
diff --git a/tests/page/pageTest.ts b/tests/page/pageTest.ts
index 9c4c5d7ba3..d69b73f21e 100644
--- a/tests/page/pageTest.ts
+++ b/tests/page/pageTest.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import { TestType } from '@playwright/test';
-import { PlatformWorkerFixtures } from '../config/platformFixtures';
-import { TestModeWorkerFixtures, TestModeWorkerOptions } from '../config/testModeFixtures';
+import type { TestType } from '@playwright/test';
+import type { PlatformWorkerFixtures } from '../config/platformFixtures';
+import type { TestModeWorkerFixtures, TestModeWorkerOptions } from '../config/testModeFixtures';
import { androidTest } from '../android/androidTest';
import { browserTest } from '../config/browserTest';
import { electronTest } from '../electron/electronTest';
-import { PageTestFixtures, PageWorkerFixtures } from './pageTestApi';
-import { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures';
+import type { PageTestFixtures, PageWorkerFixtures } from './pageTestApi';
+import type { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures';
export { expect } from '@playwright/test';
let impl: TestType<PageTestFixtures & ServerFixtures, PageWorkerFixtures & PlatformWorkerFixtures & TestModeWorkerFixtures & TestModeWorkerOptions & ServerWorkerOptions> = browserTest;
diff --git a/tests/page/pageTestApi.ts b/tests/page/pageTestApi.ts
index e432a49b4f..d4050c1f3b 100644
--- a/tests/page/pageTestApi.ts
+++ b/tests/page/pageTestApi.ts
@@ -15,7 +15,7 @@
*/
import type { Page, ViewportSize } from 'playwright-core';
-import { VideoMode } from '@playwright/test';
+import type { VideoMode } from '@playwright/test';
export { expect } from '@playwright/test';
// Page test does not guarantee an isolated context, just a new page (because Android).
diff --git a/tests/page/selectors-frame.spec.ts b/tests/page/selectors-frame.spec.ts
index 9003e3e5e6..7c704e734a 100644
--- a/tests/page/selectors-frame.spec.ts
+++ b/tests/page/selectors-frame.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Page } from 'playwright-core';
+import type { Page } from 'playwright-core';
import { test as it, expect } from './pageTest';
async function routeIframe(page: Page) {
diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts
index 97aa9d5291..abf3df3de9 100644
--- a/tests/playwright-test/playwright-test-fixtures.ts
+++ b/tests/playwright-test/playwright-test-fixtures.ts
@@ -21,9 +21,12 @@ import * as path from 'path';
import { PNG } from 'pngjs';
import rimraf from 'rimraf';
import { promisify } from 'util';
-import { CommonFixtures, commonFixtures } from '../config/commonFixtures';
-import { serverFixtures, ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures';
-import { test as base, TestInfo } from './stable-test-runner';
+import type { CommonFixtures } from '../config/commonFixtures';
+import { commonFixtures } from '../config/commonFixtures';
+import type { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures';
+import { serverFixtures } from '../config/serverFixtures';
+import type { TestInfo } from './stable-test-runner';
+import { test as base } from './stable-test-runner';
const removeFolderAsync = promisify(rimraf);
diff --git a/tests/playwright-test/playwright.config.ts b/tests/playwright-test/playwright.config.ts
index 7007eed418..396bcc5ffc 100644
--- a/tests/playwright-test/playwright.config.ts
+++ b/tests/playwright-test/playwright.config.ts
@@ -17,7 +17,7 @@
import { config as loadEnv } from 'dotenv';
loadEnv({ path: path.join(__dirname, '..', '..', '.env') });
-import { Config } from './stable-test-runner';
+import type { Config } from './stable-test-runner';
import * as path from 'path';
const outputDir = path.join(__dirname, '..', '..', 'test-results');
diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts
index 4ebb782271..282f295cf4 100644
--- a/tests/playwright-test/reporter-html.spec.ts
+++ b/tests/playwright-test/reporter-html.spec.ts
@@ -16,7 +16,7 @@
import fs from 'fs';
import { test as baseTest, expect, createImage } from './playwright-test-fixtures';
-import { HttpServer } from '../../packages/playwright-core/lib/utils/httpServer';
+import type { HttpServer } from '../../packages/playwright-core/lib/utils/httpServer';
import { startHtmlReportServer } from '../../packages/playwright-test/lib/reporters/html';
import { spawnAsync } from 'playwright-core/lib/utils/utils';
diff --git a/utils/generate_channels.js b/utils/generate_channels.js
index 31e4c3edd7..667f23feb0 100755
--- a/utils/generate_channels.js
+++ b/utils/generate_channels.js
@@ -149,7 +149,8 @@ const validator_ts = [
// This file is generated by ${path.basename(__filename)}, do not edit manually.
-import { Validator, ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
+import type { Validator } from './validatorPrimitives';
+import { ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
export type { Validator } from './validatorPrimitives';
export { ValidationError } from './validatorPrimitives';