diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts index c41b93f94a..5718cdc172 100644 --- a/packages/html-reporter/src/filter.ts +++ b/packages/html-reporter/src/filter.ts @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestCaseSummary } from '@playwright-test/reporters/html'; +import type { TestCaseSummary } from './types'; export class Filter { project: string[] = []; diff --git a/packages/html-reporter/src/headerView.tsx b/packages/html-reporter/src/headerView.tsx index d97901be70..d75c74d7cc 100644 --- a/packages/html-reporter/src/headerView.tsx +++ b/packages/html-reporter/src/headerView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { Stats } from '@playwright-test/reporters/html'; +import type { Stats } from './types'; import * as React from 'react'; import './colors.css'; import './common.css'; diff --git a/packages/html-reporter/src/imageDiffView.tsx b/packages/html-reporter/src/imageDiffView.tsx index 3496bab99c..21146e31de 100644 --- a/packages/html-reporter/src/imageDiffView.tsx +++ b/packages/html-reporter/src/imageDiffView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestAttachment } from '@playwright-test/reporters/html'; +import type { TestAttachment } from './types'; import * as React from 'react'; import { AttachmentLink } from './links'; import type { TabbedPaneTab } from './tabbedPane'; diff --git a/packages/html-reporter/src/index.tsx b/packages/html-reporter/src/index.tsx index e26a01592c..33f1ca3f50 100644 --- a/packages/html-reporter/src/index.tsx +++ b/packages/html-reporter/src/index.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { HTMLReport } from '@playwright-test/reporters/html'; +import type { HTMLReport } from './types'; import type zip from '@zip.js/zip.js'; // @ts-ignore import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'; diff --git a/packages/html-reporter/src/links.tsx b/packages/html-reporter/src/links.tsx index 8aaf8e56a3..e8cbe282a4 100644 --- a/packages/html-reporter/src/links.tsx +++ b/packages/html-reporter/src/links.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestAttachment } from '@playwright-test/reporters/html'; +import type { TestAttachment } from './types'; import * as React from 'react'; import * as icons from './icons'; import { TreeItem } from './treeItem'; diff --git a/packages/html-reporter/src/loadedReport.ts b/packages/html-reporter/src/loadedReport.ts index 80606bf3b6..c1ff2d7530 100644 --- a/packages/html-reporter/src/loadedReport.ts +++ b/packages/html-reporter/src/loadedReport.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { HTMLReport } from '@playwright-test/reporters/html'; +import type { HTMLReport } from './types'; export interface LoadedReport { json(): HTMLReport; diff --git a/packages/html-reporter/src/reportView.tsx b/packages/html-reporter/src/reportView.tsx index 4b0a858217..31daea4224 100644 --- a/packages/html-reporter/src/reportView.tsx +++ b/packages/html-reporter/src/reportView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestCase, TestFile } from '@playwright-test/reporters/html'; +import type { TestCase, TestFile } from './types'; import * as React from 'react'; import './colors.css'; import './common.css'; diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx index a40d0f13fc..3b9733ec33 100644 --- a/packages/html-reporter/src/testCaseView.spec.tsx +++ b/packages/html-reporter/src/testCaseView.spec.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { test, expect } from '@playwright/experimental-ct-react'; import { TestCaseView } from './testCaseView'; -import type { TestCase, TestResult } from '../../playwright-test/src/reporters/html'; +import type { TestCase, TestResult } from './types'; test.use({ viewport: { width: 800, height: 600 } }); diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index 29a87bfe8c..089f15a49c 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestCase } from '@playwright-test/reporters/html'; +import type { TestCase } from './types'; import * as React from 'react'; import { TabbedPane } from './tabbedPane'; import { AutoChip } from './chip'; diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsx index 6934a2b1bf..a382296b6d 100644 --- a/packages/html-reporter/src/testFileView.tsx +++ b/packages/html-reporter/src/testFileView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { HTMLReport, TestCaseSummary, TestFileSummary } from '@playwright-test/reporters/html'; +import type { HTMLReport, TestCaseSummary, TestFileSummary } from './types'; import * as React from 'react'; import { msToString } from './uiUtils'; import { Chip } from './chip'; diff --git a/packages/html-reporter/src/testFilesView.tsx b/packages/html-reporter/src/testFilesView.tsx index 4309d8358e..0dc1af4e93 100644 --- a/packages/html-reporter/src/testFilesView.tsx +++ b/packages/html-reporter/src/testFilesView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/html'; +import type { HTMLReport, TestFileSummary } from './types'; import * as React from 'react'; import type { Filter } from './filter'; import { TestFileView } from './testFileView'; diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx index e40c97d380..85d76b3c12 100644 --- a/packages/html-reporter/src/testResultView.tsx +++ b/packages/html-reporter/src/testResultView.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { TestAttachment, TestCase, TestResult, TestStep } from '@playwright-test/reporters/html'; +import type { TestAttachment, TestCase, TestResult, TestStep } from './types'; import ansi2html from 'ansi-to-html'; import * as React from 'react'; import { TreeItem } from './treeItem'; diff --git a/packages/html-reporter/src/types.ts b/packages/html-reporter/src/types.ts new file mode 100644 index 0000000000..ec6191bd12 --- /dev/null +++ b/packages/html-reporter/src/types.ts @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { Metadata } from '@protocol/channels'; + +export type Stats = { + total: number; + expected: number; + unexpected: number; + flaky: number; + skipped: number; + ok: boolean; + duration: number; +}; + +export type Location = { + file: string; + line: number; + column: number; +}; + +export type HTMLReport = { + metadata: Metadata; + files: TestFileSummary[]; + stats: Stats; + projectNames: string[]; +}; + +export type TestFile = { + fileId: string; + fileName: string; + tests: TestCase[]; +}; + +export type TestFileSummary = { + fileId: string; + fileName: string; + tests: TestCaseSummary[]; + stats: Stats; +}; + +export type TestCaseSummary = { + testId: string, + title: string; + path: string[]; + projectName: string; + location: Location; + annotations: { type: string, description?: string }[]; + outcome: 'skipped' | 'expected' | 'unexpected' | 'flaky'; + duration: number; + ok: boolean; + results: TestResultSummary[]; +}; + +export type TestResultSummary = { + attachments: { name: string, contentType: string, path?: string }[]; +}; + +export type TestCase = Omit & { + results: TestResult[]; +}; + +export type TestAttachment = { + name: string; + body?: string; + path?: string; + contentType: string; +}; + +export type TestResult = { + retry: number; + startTime: string; + duration: number; + steps: TestStep[]; + errors: string[]; + attachments: TestAttachment[]; + status: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted'; +}; + +export type TestStep = { + title: string; + startTime: string; + duration: number; + location?: Location; + snippet?: string; + error?: string; + steps: TestStep[]; + count: number; +}; diff --git a/packages/html-reporter/tsconfig.json b/packages/html-reporter/tsconfig.json index 31c2e167d1..71abcce236 100644 --- a/packages/html-reporter/tsconfig.json +++ b/packages/html-reporter/tsconfig.json @@ -17,8 +17,8 @@ "baseUrl": ".", "useUnknownInCatchVariables": false, "paths": { + "@protocol/*": ["../protocol/src/*"], "@web/*": ["../web/src/*"], - "@playwright-core/*": ["../playwright-core/src/*"], "@playwright-test/*": ["../playwright-test/src/*"], "playwright-core/lib/*": ["../playwright-core/src/*"], "playwright-test/lib/*": ["../playwright-test/src/*"], diff --git a/packages/html-reporter/vite.config.ts b/packages/html-reporter/vite.config.ts index cb57ca044d..e4701f8d04 100644 --- a/packages/html-reporter/vite.config.ts +++ b/packages/html-reporter/vite.config.ts @@ -28,7 +28,6 @@ export default defineConfig({ resolve: { alias: { '@web': path.resolve(__dirname, '../web/src'), - '@playwright-core': path.resolve(__dirname, '../playwright-core/src'), }, }, build: { diff --git a/packages/playwright-core/src/client/accessibility.ts b/packages/playwright-core/src/client/accessibility.ts index 6f14e1b295..a3390d8c58 100644 --- a/packages/playwright-core/src/client/accessibility.ts +++ b/packages/playwright-core/src/client/accessibility.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ElementHandle } from './elementHandle'; import type * as api from '../../types/types'; diff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.ts index e5512b2b05..d13bc30c3e 100644 --- a/packages/playwright-core/src/client/android.ts +++ b/packages/playwright-core/src/client/android.ts @@ -16,7 +16,7 @@ import fs from 'fs'; import { isString, isRegExp } from '../utils'; -import type * 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'; diff --git a/packages/playwright-core/src/client/artifact.ts b/packages/playwright-core/src/client/artifact.ts index 70ae9a66c0..90fb0895dd 100644 --- a/packages/playwright-core/src/client/artifact.ts +++ b/packages/playwright-core/src/client/artifact.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * 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/fileUtils'; diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.ts index b09e2a8324..19df307510 100644 --- a/packages/playwright-core/src/client/browser.ts +++ b/packages/playwright-core/src/client/browser.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { BrowserContext, prepareBrowserContextParams } from './browserContext'; import type { Page } from './page'; import { ChannelOwner } from './channelOwner'; diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts index 4fefccc5b4..1edb223957 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import fs from 'fs'; import { ChannelOwner } from './channelOwner'; import { evaluationScript } from './clientHelper'; diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts index 527a3b1bd7..526d99482e 100644 --- a/packages/playwright-core/src/client/browserType.ts +++ b/packages/playwright-core/src/client/browserType.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * 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'; diff --git a/packages/playwright-core/src/client/cdpSession.ts b/packages/playwright-core/src/client/cdpSession.ts index f5cb30b831..4c928793a5 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 type * 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 b37ea43017..d679595f0d 100644 --- a/packages/playwright-core/src/client/channelOwner.ts +++ b/packages/playwright-core/src/client/channelOwner.ts @@ -15,7 +15,7 @@ */ import { EventEmitter } from 'events'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { maybeFindValidator, ValidationError, type ValidatorContext } from '../protocol/validator'; import { debugLogger } from '../common/debugLogger'; import type { ParsedStackTrace } from '../utils/stackTrace'; diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.ts index 51e49b4b2f..72ec1c1db3 100644 --- a/packages/playwright-core/src/client/connection.ts +++ b/packages/playwright-core/src/client/connection.ts @@ -30,7 +30,7 @@ import { parseError } from '../protocol/serializers'; import { CDPSession } from './cdpSession'; import { Playwright } from './playwright'; import { Electron, ElectronApplication } from './electron'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Stream } from './stream'; import { WritableStream } from './writableStream'; import { debugLogger } from '../common/debugLogger'; diff --git a/packages/playwright-core/src/client/consoleMessage.ts b/packages/playwright-core/src/client/consoleMessage.ts index b70883d3e1..df11c23672 100644 --- a/packages/playwright-core/src/client/consoleMessage.ts +++ b/packages/playwright-core/src/client/consoleMessage.ts @@ -16,7 +16,7 @@ import * as util from 'util'; import { JSHandle } from './jsHandle'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import type * as api from '../../types/types'; diff --git a/packages/playwright-core/src/client/coverage.ts b/packages/playwright-core/src/client/coverage.ts index 33d7f9168e..c736d1fad0 100644 --- a/packages/playwright-core/src/client/coverage.ts +++ b/packages/playwright-core/src/client/coverage.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type * as api from '../../types/types'; export class Coverage implements api.Coverage { diff --git a/packages/playwright-core/src/client/dialog.ts b/packages/playwright-core/src/client/dialog.ts index 8fdf15e8ef..e302e8d8d1 100644 --- a/packages/playwright-core/src/client/dialog.ts +++ b/packages/playwright-core/src/client/dialog.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import type * as api from '../../types/types'; diff --git a/packages/playwright-core/src/client/electron.ts b/packages/playwright-core/src/client/electron.ts index ff69238fd2..106558f727 100644 --- a/packages/playwright-core/src/client/electron.ts +++ b/packages/playwright-core/src/client/electron.ts @@ -18,7 +18,7 @@ import type { BrowserWindow } from 'electron'; import type * as childProcess from 'child_process'; import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { TimeoutSettings } from '../common/timeoutSettings'; import { BrowserContext, prepareBrowserContextParams } from './browserContext'; import { ChannelOwner } from './channelOwner'; diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts index 6256f8f126..3cd6efaac9 100644 --- a/packages/playwright-core/src/client/elementHandle.ts +++ b/packages/playwright-core/src/client/elementHandle.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Frame } from './frame'; import type { Locator } from './locator'; import { JSHandle, serializeArgument, parseResult } from './jsHandle'; diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts index 185158a1a4..5bd399eabb 100644 --- a/packages/playwright-core/src/client/fetch.ts +++ b/packages/playwright-core/src/client/fetch.ts @@ -20,7 +20,7 @@ import * as util from 'util'; 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 type * as channels from '@protocol/channels'; import { kBrowserOrContextClosedError } from '../common/errors'; import { assert, headersObjectToArray, isFilePayload, isString, objectToArray } from '../utils'; import { mkdirIfNeeded } from '../utils/fileUtils'; diff --git a/packages/playwright-core/src/client/fileChooser.ts b/packages/playwright-core/src/client/fileChooser.ts index 24405f4c92..28274a0e61 100644 --- a/packages/playwright-core/src/client/fileChooser.ts +++ b/packages/playwright-core/src/client/fileChooser.ts @@ -17,7 +17,7 @@ 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 channels from '@protocol/channels'; import type * as api from '../../types/types'; export class FileChooser implements api.FileChooser { diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.ts index d9e8504cd0..1b254d6f2f 100644 --- a/packages/playwright-core/src/client/frame.ts +++ b/packages/playwright-core/src/client/frame.ts @@ -16,7 +16,7 @@ */ import { assert } from '../utils'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import { FrameLocator, Locator, type LocatorOptions } from './locator'; import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle'; diff --git a/packages/playwright-core/src/client/input.ts b/packages/playwright-core/src/client/input.ts index 59a0285f7f..e06b0e3e4a 100644 --- a/packages/playwright-core/src/client/input.ts +++ b/packages/playwright-core/src/client/input.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type * as api from '../../types/types'; import type { Page } from './page'; diff --git a/packages/playwright-core/src/client/jsHandle.ts b/packages/playwright-core/src/client/jsHandle.ts index 5975649ff5..596f2acba0 100644 --- a/packages/playwright-core/src/client/jsHandle.ts +++ b/packages/playwright-core/src/client/jsHandle.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import { parseSerializedValue, serializeValue } from '../protocol/serializers'; import type * as api from '../../types/types'; diff --git a/packages/playwright-core/src/client/jsonPipe.ts b/packages/playwright-core/src/client/jsonPipe.ts index 5c730efb4e..0c6b53502f 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; export class JsonPipe extends ChannelOwner { diff --git a/packages/playwright-core/src/client/localUtils.ts b/packages/playwright-core/src/client/localUtils.ts index a86c3aae06..3e1e627761 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; export class LocalUtils extends ChannelOwner { diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.ts index a77fd56f34..d50a9a8e9b 100644 --- a/packages/playwright-core/src/client/locator.ts +++ b/packages/playwright-core/src/client/locator.ts @@ -16,7 +16,7 @@ import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ParsedStackTrace } from '../utils/stackTrace'; import * as util from 'util'; import { isRegExp, monotonicTime } from '../utils'; diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts index 4cfe0c7afa..3d69720a56 100644 --- a/packages/playwright-core/src/client/network.ts +++ b/packages/playwright-core/src/client/network.ts @@ -15,7 +15,7 @@ */ import { URLSearchParams } from 'url'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import { Frame } from './frame'; import { Worker } from './worker'; diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts index 840aab711c..2319b7a514 100644 --- a/packages/playwright-core/src/client/page.ts +++ b/packages/playwright-core/src/client/page.ts @@ -22,7 +22,7 @@ import type * as api from '../../types/types'; import { isSafeCloseError } from '../common/errors'; import { urlMatches } from '../common/netUtils'; import { TimeoutSettings } from '../common/timeoutSettings'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { parseError, serializeError } from '../protocol/serializers'; import { assert, headersObjectToArray, isObject, isRegExp, isString } from '../utils'; import { mkdirIfNeeded } from '../utils/fileUtils'; diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts index 14191bb324..874eb1dbe2 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { TimeoutError } from '../common/errors'; import type * as socks from '../common/socksProxy'; import { Android } from './android'; diff --git a/packages/playwright-core/src/client/selectors.ts b/packages/playwright-core/src/client/selectors.ts index f4aeccc18c..68a562334b 100644 --- a/packages/playwright-core/src/client/selectors.ts +++ b/packages/playwright-core/src/client/selectors.ts @@ -15,7 +15,7 @@ */ import { evaluationScript } from './clientHelper'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import type { SelectorEngine } from './types'; import type * as api from '../../types/types'; diff --git a/packages/playwright-core/src/client/stream.ts b/packages/playwright-core/src/client/stream.ts index 897b33416d..483f0e82c7 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; export class Stream extends ChannelOwner { diff --git a/packages/playwright-core/src/client/tracing.ts b/packages/playwright-core/src/client/tracing.ts index 65dca291cb..9d26fe794e 100644 --- a/packages/playwright-core/src/client/tracing.ts +++ b/packages/playwright-core/src/client/tracing.ts @@ -15,7 +15,7 @@ */ import type * as api from '../../types/types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Artifact } from './artifact'; import { ChannelOwner } from './channelOwner'; diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts index c8215f7a79..ceada909b1 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 type * 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/waiter.ts b/packages/playwright-core/src/client/waiter.ts index 5d85a9c770..10f3e6d4b8 100644 --- a/packages/playwright-core/src/client/waiter.ts +++ b/packages/playwright-core/src/client/waiter.ts @@ -18,7 +18,7 @@ import type { EventEmitter } from 'events'; import { rewriteErrorMessage } from '../utils/stackTrace'; import { TimeoutError } from '../common/errors'; import { createGuid } from '../utils'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ChannelOwner } from './channelOwner'; export class Waiter { diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.ts index d6d1211ca8..fe86d18f06 100644 --- a/packages/playwright-core/src/client/worker.ts +++ b/packages/playwright-core/src/client/worker.ts @@ -15,7 +15,7 @@ */ import { Events } from './events'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; import { assertMaxArguments, JSHandle, parseResult, serializeArgument } from './jsHandle'; import type { Page } from './page'; diff --git a/packages/playwright-core/src/client/writableStream.ts b/packages/playwright-core/src/client/writableStream.ts index 1efad263d0..8ed799292c 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ChannelOwner } from './channelOwner'; export class WritableStream extends ChannelOwner { diff --git a/packages/playwright-core/src/protocol/debug.ts b/packages/playwright-core/src/protocol/debug.ts new file mode 100644 index 0000000000..5be3acabc4 --- /dev/null +++ b/packages/playwright-core/src/protocol/debug.ts @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is generated by generate_channels.js, do not edit manually. + +export const commandsWithTracingSnapshots = new Set([ + 'EventTarget.waitForEventInfo', + 'BrowserContext.waitForEventInfo', + 'Page.waitForEventInfo', + 'WebSocket.waitForEventInfo', + 'ElectronApplication.waitForEventInfo', + 'AndroidDevice.waitForEventInfo', + 'Page.goBack', + 'Page.goForward', + 'Page.reload', + 'Page.expectScreenshot', + 'Page.screenshot', + 'Page.setViewportSize', + 'Page.keyboardDown', + 'Page.keyboardUp', + 'Page.keyboardInsertText', + 'Page.keyboardType', + 'Page.keyboardPress', + 'Page.mouseMove', + 'Page.mouseDown', + 'Page.mouseUp', + 'Page.mouseClick', + 'Page.mouseWheel', + 'Page.touchscreenTap', + 'Frame.evalOnSelector', + 'Frame.evalOnSelectorAll', + 'Frame.addScriptTag', + 'Frame.addStyleTag', + 'Frame.check', + 'Frame.click', + 'Frame.dragAndDrop', + 'Frame.dblclick', + 'Frame.dispatchEvent', + 'Frame.evaluateExpression', + 'Frame.evaluateExpressionHandle', + 'Frame.fill', + 'Frame.focus', + 'Frame.getAttribute', + 'Frame.goto', + 'Frame.hover', + 'Frame.innerHTML', + 'Frame.innerText', + 'Frame.inputValue', + 'Frame.isChecked', + 'Frame.isDisabled', + 'Frame.isEnabled', + 'Frame.isHidden', + 'Frame.isVisible', + 'Frame.isEditable', + 'Frame.press', + 'Frame.selectOption', + 'Frame.setContent', + 'Frame.setInputFiles', + 'Frame.setInputFilePaths', + 'Frame.tap', + 'Frame.textContent', + 'Frame.type', + 'Frame.uncheck', + 'Frame.waitForTimeout', + 'Frame.waitForFunction', + 'Frame.waitForSelector', + 'Frame.expect', + 'JSHandle.evaluateExpression', + 'ElementHandle.evaluateExpression', + 'JSHandle.evaluateExpressionHandle', + 'ElementHandle.evaluateExpressionHandle', + 'ElementHandle.evalOnSelector', + 'ElementHandle.evalOnSelectorAll', + 'ElementHandle.check', + 'ElementHandle.click', + 'ElementHandle.dblclick', + 'ElementHandle.dispatchEvent', + 'ElementHandle.fill', + 'ElementHandle.hover', + 'ElementHandle.innerHTML', + 'ElementHandle.innerText', + 'ElementHandle.inputValue', + 'ElementHandle.isChecked', + 'ElementHandle.isDisabled', + 'ElementHandle.isEditable', + 'ElementHandle.isEnabled', + 'ElementHandle.isHidden', + 'ElementHandle.isVisible', + 'ElementHandle.press', + 'ElementHandle.screenshot', + 'ElementHandle.scrollIntoViewIfNeeded', + 'ElementHandle.selectOption', + 'ElementHandle.selectText', + 'ElementHandle.setInputFiles', + 'ElementHandle.setInputFilePaths', + 'ElementHandle.tap', + 'ElementHandle.textContent', + 'ElementHandle.type', + 'ElementHandle.uncheck', + 'ElementHandle.waitForElementState', + 'ElementHandle.waitForSelector' +]); + +export const pausesBeforeInputActions = new Set([ + 'Frame.check', + 'Frame.click', + 'Frame.dragAndDrop', + 'Frame.dblclick', + 'Frame.fill', + 'Frame.hover', + 'Frame.press', + 'Frame.selectOption', + 'Frame.setInputFiles', + 'Frame.setInputFilePaths', + 'Frame.tap', + 'Frame.type', + 'Frame.uncheck', + 'ElementHandle.check', + 'ElementHandle.click', + 'ElementHandle.dblclick', + 'ElementHandle.fill', + 'ElementHandle.hover', + 'ElementHandle.press', + 'ElementHandle.selectOption', + 'ElementHandle.setInputFiles', + 'ElementHandle.setInputFilePaths', + 'ElementHandle.tap', + 'ElementHandle.type', + 'ElementHandle.uncheck' +]); \ No newline at end of file diff --git a/packages/playwright-core/src/protocol/serializers.ts b/packages/playwright-core/src/protocol/serializers.ts index aa3eb07b51..667698c9ae 100644 --- a/packages/playwright-core/src/protocol/serializers.ts +++ b/packages/playwright-core/src/protocol/serializers.ts @@ -15,7 +15,7 @@ */ import { TimeoutError } from '../common/errors'; -import type { SerializedError, SerializedValue } from './channels'; +import type { SerializedError, SerializedValue } from '@protocol/channels'; export function serializeError(e: any): SerializedError { if (isError(e)) diff --git a/packages/playwright-core/src/server/accessibility.ts b/packages/playwright-core/src/server/accessibility.ts index a217b02b0d..b92c5411f5 100644 --- a/packages/playwright-core/src/server/accessibility.ts +++ b/packages/playwright-core/src/server/accessibility.ts @@ -16,7 +16,7 @@ */ import type * as dom from './dom'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; 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 3b22519a2e..72a826a275 100644 --- a/packages/playwright-core/src/server/android/android.ts +++ b/packages/playwright-core/src/server/android/android.ts @@ -33,7 +33,7 @@ import { PipeTransport } from '../../protocol/transport'; import { RecentLogsCollector } from '../../common/debugLogger'; import { gracefullyCloseSet } from '../../utils/processLauncher'; import { TimeoutSettings } from '../../common/timeoutSettings'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { SdkObject, serverSideCallMetadata } from '../instrumentation'; import { DEFAULT_ARGS } from '../chromium/chromium'; diff --git a/packages/playwright-core/src/server/android/backendAdb.ts b/packages/playwright-core/src/server/android/backendAdb.ts index 9874906791..ba0a4a40af 100644 --- a/packages/playwright-core/src/server/android/backendAdb.ts +++ b/packages/playwright-core/src/server/android/backendAdb.ts @@ -15,7 +15,7 @@ */ import { debug } from '../../utilsBundle'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import * as net from 'net'; import { EventEmitter } from 'events'; import type { Backend, DeviceBackend, SocketBackend } from './android'; diff --git a/packages/playwright-core/src/server/browser.ts b/packages/playwright-core/src/server/browser.ts index 42197006f5..2ed70add5a 100644 --- a/packages/playwright-core/src/server/browser.ts +++ b/packages/playwright-core/src/server/browser.ts @@ -15,7 +15,7 @@ */ import type * as types from './types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { BrowserContext, validateBrowserContextOptions } from './browserContext'; import { Page } from './page'; import { Download } from './download'; diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts index 6f8e849db7..38178350df 100644 --- a/packages/playwright-core/src/server/browserContext.ts +++ b/packages/playwright-core/src/server/browserContext.ts @@ -29,7 +29,7 @@ import { Page, PageBinding } from './page'; import type { Progress } from './progress'; import type { Selectors } from './selectors'; import type * as types from './types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import path from 'path'; import fs from 'fs'; import type { CallMetadata } from './instrumentation'; diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.ts index d98655be24..1ae07171be 100644 --- a/packages/playwright-core/src/server/browserType.ts +++ b/packages/playwright-core/src/server/browserType.ts @@ -30,7 +30,7 @@ import { PipeTransport } from './pipeTransport'; import type { Progress } from './progress'; import { ProgressController } from './progress'; import type * as types from './types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings'; import { debugMode } from '../utils'; import { existsAsync } from '../utils/fileUtils'; diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts index 3633eceab5..d57d70c60d 100644 --- a/packages/playwright-core/src/server/chromium/chromium.ts +++ b/packages/playwright-core/src/server/chromium/chromium.ts @@ -30,7 +30,7 @@ import { CRDevTools } from './crDevTools'; import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser'; import { Browser } from '../browser'; import type * as types from '../types'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { HTTPRequestParams } from '../../common/netUtils'; import { NET_DEFAULT_TIMEOUT } from '../../common/netUtils'; import { fetchData } from '../../common/netUtils'; diff --git a/packages/playwright-core/src/server/chromium/crAccessibility.ts b/packages/playwright-core/src/server/chromium/crAccessibility.ts index aeb5ebd724..30d02ee7bf 100644 --- a/packages/playwright-core/src/server/chromium/crAccessibility.ts +++ b/packages/playwright-core/src/server/chromium/crAccessibility.ts @@ -19,7 +19,7 @@ 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 channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; 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/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.ts index dc2801caae..ee95110832 100644 --- a/packages/playwright-core/src/server/chromium/crBrowser.ts +++ b/packages/playwright-core/src/server/chromium/crBrowser.ts @@ -26,7 +26,7 @@ import { Frame } from '../frames'; import type { Dialog } from '../dialog'; import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { CRSession } from './crConnection'; import { ConnectionEvents, CRConnection } from './crConnection'; import { CRPage } from './crPage'; diff --git a/packages/playwright-core/src/server/chromium/crCoverage.ts b/packages/playwright-core/src/server/chromium/crCoverage.ts index 793ca16bb7..ccb9b40ae0 100644 --- a/packages/playwright-core/src/server/chromium/crCoverage.ts +++ b/packages/playwright-core/src/server/chromium/crCoverage.ts @@ -19,7 +19,7 @@ import type { CRSession } from './crConnection'; import type { RegisteredListener } from '../../utils/eventsHelper'; import { eventsHelper } from '../../utils/eventsHelper'; import type { Protocol } from './protocol'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { assert } from '../../utils'; export class CRCoverage { diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts index 5da8b1c9f1..103d548107 100644 --- a/packages/playwright-core/src/server/chromium/crPage.ts +++ b/packages/playwright-core/src/server/chromium/crPage.ts @@ -30,7 +30,7 @@ import type { PageBinding, PageDelegate } from '../page'; import { Page, Worker } from '../page'; import type { Progress } from '../progress'; import type * as types from '../types'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { getAccessibilityTree } from './crAccessibility'; import { CRBrowserContext } from './crBrowser'; import type { CRSession } from './crConnection'; diff --git a/packages/playwright-core/src/server/chromium/crPdf.ts b/packages/playwright-core/src/server/chromium/crPdf.ts index 5873e1b99d..359a1c4571 100644 --- a/packages/playwright-core/src/server/chromium/crPdf.ts +++ b/packages/playwright-core/src/server/chromium/crPdf.ts @@ -16,7 +16,7 @@ */ import { assert } from '../../utils'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { CRSession } from './crConnection'; import { readProtocolStream } from './crProtocolHelper'; diff --git a/packages/playwright-core/src/server/cookieStore.ts b/packages/playwright-core/src/server/cookieStore.ts index 3be259b9bd..332a212cd2 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 type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; class Cookie { private _raw: channels.NetworkCookie; diff --git a/packages/playwright-core/src/server/debugger.ts b/packages/playwright-core/src/server/debugger.ts index 8bab8f780e..22a0a45466 100644 --- a/packages/playwright-core/src/server/debugger.ts +++ b/packages/playwright-core/src/server/debugger.ts @@ -18,7 +18,7 @@ import { EventEmitter } from 'events'; import { debugMode, isUnderTest, monotonicTime } from '../utils'; import { BrowserContext } from './browserContext'; import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation'; -import { commandsWithTracingSnapshots, pausesBeforeInputActions } from '../protocol/channels'; +import { commandsWithTracingSnapshots, pausesBeforeInputActions } from '../protocol/debug'; const symbol = Symbol('Debugger'); diff --git a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts index 5adb4bbf8e..0e1cc5315c 100644 --- a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts @@ -18,7 +18,7 @@ import type { RootDispatcher } from './dispatcher'; import { Dispatcher, existingDispatcher } from './dispatcher'; import type { Android, SocketBackend } from '../android/android'; import { AndroidDevice } from '../android/android'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { BrowserContextDispatcher } from './browserContextDispatcher'; import type { CallMetadata } from '../instrumentation'; diff --git a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts index a4bcff1164..0d3a3324eb 100644 --- a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import type { DispatcherScope } from './dispatcher'; import { StreamDispatcher } from './streamDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts index b8d6d26925..ca72fd11b5 100644 --- a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts @@ -19,7 +19,7 @@ import { Dispatcher, lookupDispatcher } from './dispatcher'; import type { DispatcherScope } from './dispatcher'; import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher'; import type { FrameDispatcher } from './frameDispatcher'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { RouteDispatcher, RequestDispatcher, ResponseDispatcher, APIRequestContextDispatcher } from './networkDispatchers'; import { CRBrowserContext } from '../chromium/crBrowser'; import { CDPSessionDispatcher } from './cdpSessionDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts index b1e5c84fff..a6bdbf9f9c 100644 --- a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts @@ -15,7 +15,7 @@ */ import { Browser } from '../browser'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { BrowserContextDispatcher } from './browserContextDispatcher'; import { CDPSessionDispatcher } from './cdpSessionDispatcher'; import { existingDispatcher } from './dispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts index f2cf3e51b9..fd210d29af 100644 --- a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts @@ -16,7 +16,7 @@ import type { BrowserType } from '../browserType'; import { BrowserDispatcher } from './browserDispatcher'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { RootDispatcher } from './dispatcher'; import { Dispatcher } from './dispatcher'; import { BrowserContextDispatcher } from './browserContextDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts index 4dd724f992..8d254531b1 100644 --- a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts @@ -16,7 +16,7 @@ import type { CRSession } from '../chromium/crConnection'; import { CRSessionEvents } from '../chromium/crConnection'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import type { BrowserDispatcher } from './browserDispatcher'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.ts index 37e8b4a63f..ae1d2124b9 100644 --- a/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.ts @@ -15,7 +15,7 @@ */ import type { ConsoleMessage } from '../console'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { PageDispatcher } from './pageDispatcher'; import { Dispatcher } from './dispatcher'; import { ElementHandleDispatcher } from './elementHandlerDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts index 694737f1c1..8ae74504f8 100644 --- a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts @@ -15,7 +15,7 @@ */ import type { Dialog } from '../dialog'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import type { PageDispatcher } from './pageDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.ts index dda9007423..d8ba8b7242 100644 --- a/packages/playwright-core/src/server/dispatchers/dispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts @@ -15,7 +15,7 @@ */ import { EventEmitter } from 'events'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { serializeError } from '../../protocol/serializers'; import { findValidator, ValidationError, createMetadataValidator, type ValidatorContext } from '../../protocol/validator'; import { assert, debugAssert, isUnderTest, monotonicTime } from '../../utils'; diff --git a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts index 0462bad356..12f6e91d90 100644 --- a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts @@ -18,7 +18,7 @@ import type { RootDispatcher } from './dispatcher'; import { Dispatcher } from './dispatcher'; import type { Electron } from '../electron/electron'; import { ElectronApplication } from '../electron/electron'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { BrowserContextDispatcher } from './browserContextDispatcher'; import type { PageDispatcher } from './pageDispatcher'; import { parseArgument, serializeResult } from './jsHandleDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts index 786c03c97c..49206cb18c 100644 --- a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts @@ -17,7 +17,7 @@ import type { ElementHandle } from '../dom'; import type { Frame } from '../frames'; import type * as js from '../javascript'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { existingDispatcher, lookupNullableDispatcher } from './dispatcher'; import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher'; import type { JSHandleDispatcherParentScope } from './jsHandleDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts index a1f984c312..903e8f9d0f 100644 --- a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts @@ -16,7 +16,7 @@ import type { NavigationEvent } from '../frames'; import { Frame } from '../frames'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher, lookupNullableDispatcher, existingDispatcher } from './dispatcher'; import { ElementHandleDispatcher } from './elementHandlerDispatcher'; import { parseArgument, serializeResult } from './jsHandleDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts index 78dbc40489..88b623bb7b 100644 --- a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts @@ -15,7 +15,7 @@ */ import type * as js from '../javascript'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import { ElementHandleDispatcher } from './elementHandlerDispatcher'; import { parseSerializedValue, serializeValue } from '../../protocol/serializers'; diff --git a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts index 4599728e6f..03fceb366d 100644 --- a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import { createGuid } from '../../utils'; import { serializeError } from '../../protocol/serializers'; diff --git a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts index 1489a787aa..3df4a864a3 100644 --- a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts @@ -17,14 +17,14 @@ import type EventEmitter from 'events'; import fs from 'fs'; import path from 'path'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ManualPromise } from '../../utils/manualPromise'; import { assert, createGuid } from '../../utils'; import type { RootDispatcher } from './dispatcher'; import { Dispatcher } from './dispatcher'; import { yazl, yauzl } from '../../zipBundle'; import { ZipFile } from '../../utils/zipFile'; -import type * as har from '../har/har'; +import type * as har from '@trace/har'; import type { HeadersArray } from '../types'; export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.LocalUtilsChannel, RootDispatcher> implements channels.LocalUtilsChannel { diff --git a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts index 2503410509..fd3eb2bd7f 100644 --- a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts +++ b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { APIRequestContext } from '../fetch'; import type { CallMetadata } from '../instrumentation'; import type { Request, Response, Route } from '../network'; diff --git a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts index 46def1a87f..20a390c351 100644 --- a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts @@ -17,7 +17,7 @@ import type { BrowserContext } from '../browserContext'; import type { Frame } from '../frames'; import { Page, Worker } from '../page'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher'; import { parseError, serializeError } from '../../protocol/serializers'; import { ConsoleMessageDispatcher } from './consoleMessageDispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts index 2e925589b6..75dc2920b1 100644 --- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { Browser } from '../browser'; import { GlobalAPIRequestContext } from '../fetch'; import type { Playwright } from '../playwright'; diff --git a/packages/playwright-core/src/server/dispatchers/reuseControllerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/reuseControllerDispatcher.ts index 138e9d8353..d1656f28eb 100644 --- a/packages/playwright-core/src/server/dispatchers/reuseControllerDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/reuseControllerDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ReuseController } from '../reuseController'; import type { DispatcherConnection, RootDispatcher } from './dispatcher'; import { Dispatcher } from './dispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts index b77892396c..eb9085dda8 100644 --- a/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts @@ -16,7 +16,7 @@ import type { RootDispatcher } from './dispatcher'; import { Dispatcher } from './dispatcher'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { Selectors } from '../selectors'; export class SelectorsDispatcher extends Dispatcher implements channels.SelectorsChannel { diff --git a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts index 9e2740540a..53f14fbfdd 100644 --- a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import type * as stream from 'stream'; import { createGuid } from '../../utils'; diff --git a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts index 84ab9786e2..fd6d752c8d 100644 --- a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { Tracing } from '../trace/recorder/tracing'; import { ArtifactDispatcher } from './artifactDispatcher'; import { Dispatcher, existingDispatcher } from './dispatcher'; diff --git a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts index 244c0b7a93..2c948efe80 100644 --- a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Dispatcher } from './dispatcher'; import type * as fs from 'fs'; import { createGuid } from '../../utils'; diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.ts index 2dd0b323b2..ac0c4758d1 100644 --- a/packages/playwright-core/src/server/dom.ts +++ b/packages/playwright-core/src/server/dom.ts @@ -16,7 +16,7 @@ import { mime } from '../utilsBundle'; import * as injectedScriptSource from '../generated/injectedScriptSource'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { isSessionClosedError } from './protocolError'; import type { ScreenshotOptions } from './screenshotter'; import type * as frames from './frames'; diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.ts index 79db714c0e..d1251e017b 100644 --- a/packages/playwright-core/src/server/electron/electron.ts +++ b/packages/playwright-core/src/server/electron/electron.ts @@ -40,7 +40,7 @@ import type * as childProcess from 'child_process'; import * as readline from 'readline'; import { RecentLogsCollector } from '../../common/debugLogger'; import { serverSideCallMetadata, SdkObject } from '../instrumentation'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; 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 6256dc94e4..4e129ec930 100644 --- a/packages/playwright-core/src/server/fetch.ts +++ b/packages/playwright-core/src/server/fetch.ts @@ -21,7 +21,7 @@ import { pipeline, Transform } from 'stream'; import url from 'url'; import zlib from 'zlib'; import type { HTTPCredentials } from '../../types/types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { TimeoutSettings } from '../common/timeoutSettings'; import { getUserAgent } from '../common/userAgent'; import { assert, createGuid, monotonicTime } from '../utils'; diff --git a/packages/playwright-core/src/server/firefox/ffAccessibility.ts b/packages/playwright-core/src/server/firefox/ffAccessibility.ts index eb7035bb53..9bf519c3bb 100644 --- a/packages/playwright-core/src/server/firefox/ffAccessibility.ts +++ b/packages/playwright-core/src/server/firefox/ffAccessibility.ts @@ -19,7 +19,7 @@ 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 channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; 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 ff91a0ca21..3d454ca935 100644 --- a/packages/playwright-core/src/server/firefox/ffBrowser.ts +++ b/packages/playwright-core/src/server/firefox/ffBrowser.ts @@ -24,7 +24,7 @@ import * as network from '../network'; import type { Page, PageBinding, PageDelegate } from '../page'; import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { ConnectionEvents, FFConnection } from './ffConnection'; import { FFPage } from './ffPage'; import type { Protocol } from './protocol'; diff --git a/packages/playwright-core/src/server/formData.ts b/packages/playwright-core/src/server/formData.ts index 2905d920d0..bc7f1e5bfe 100644 --- a/packages/playwright-core/src/server/formData.ts +++ b/packages/playwright-core/src/server/formData.ts @@ -15,7 +15,7 @@ */ import { mime } from '../utilsBundle'; -import type * 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 9340fd3e69..6760b3753f 100644 --- a/packages/playwright-core/src/server/frames.ts +++ b/packages/playwright-core/src/server/frames.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ConsoleMessage } from './console'; import * as dom from './dom'; import { helper } from './helper'; diff --git a/packages/playwright-core/src/server/har/harRecorder.ts b/packages/playwright-core/src/server/har/harRecorder.ts index 6f175c9243..c654a9dba7 100644 --- a/packages/playwright-core/src/server/har/harRecorder.ts +++ b/packages/playwright-core/src/server/har/harRecorder.ts @@ -18,9 +18,9 @@ import fs from 'fs'; import path from 'path'; import { Artifact } from '../artifact'; import type { BrowserContext } from '../browserContext'; -import type * as har from './har'; +import type * as har from '@trace/har'; import { HarTracer } from './harTracer'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { yazl } from '../../zipBundle'; import type { ZipFile } from '../../zipBundle'; import { ManualPromise } from '../../utils/manualPromise'; diff --git a/packages/playwright-core/src/server/har/harTracer.ts b/packages/playwright-core/src/server/har/harTracer.ts index ceab8fc4ea..2d442fc5a1 100644 --- a/packages/playwright-core/src/server/har/harTracer.ts +++ b/packages/playwright-core/src/server/har/harTracer.ts @@ -21,7 +21,7 @@ import { helper } from '../helper'; import * as network from '../network'; import type { Worker } from '../page'; import type { Page } from '../page'; -import type * as har from './har'; +import type * as har from '@trace/har'; import { assert, calculateSha1, monotonicTime } from '../../utils'; import type { RegisteredListener } from '../../utils/eventsHelper'; import { eventsHelper } from '../../utils/eventsHelper'; diff --git a/packages/playwright-core/src/server/injected/injectedScript.ts b/packages/playwright-core/src/server/injected/injectedScript.ts index 7b6eba3d9e..41231c394b 100644 --- a/packages/playwright-core/src/server/injected/injectedScript.ts +++ b/packages/playwright-core/src/server/injected/injectedScript.ts @@ -26,7 +26,7 @@ import { SelectorEvaluatorImpl } from './selectorEvaluator'; import { enclosingShadowRootOrDocument, isElementVisible, parentElementOrShadowHost } from './domUtils'; import type { CSSComplexSelectorList } from '../isomorphic/cssParser'; import { generateSelector } from './selectorGenerator'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import { Highlight } from './highlight'; import { getAriaDisabled, getAriaRole, getElementAccessibleName } from './roleUtils'; import { kLayoutSelectorNames, type LayoutSelectorName, layoutSelectorScore } from './layoutSelectorUtils'; diff --git a/packages/playwright-core/src/server/instrumentation.ts b/packages/playwright-core/src/server/instrumentation.ts index e464e8e336..39fdb63532 100644 --- a/packages/playwright-core/src/server/instrumentation.ts +++ b/packages/playwright-core/src/server/instrumentation.ts @@ -33,8 +33,8 @@ export type Attribution = { frame?: Frame; }; -import type { CallMetadata } from '../protocol/callMetadata'; -export type { CallMetadata } from '../protocol/callMetadata'; +import type { CallMetadata } from '@protocol/callMetadata'; +export type { CallMetadata } from '@protocol/callMetadata'; export const kTestSdkObjects = new WeakSet(); diff --git a/packages/playwright-core/src/server/network.ts b/packages/playwright-core/src/server/network.ts index 1294d6878e..494ebc15c7 100644 --- a/packages/playwright-core/src/server/network.ts +++ b/packages/playwright-core/src/server/network.ts @@ -18,7 +18,7 @@ import type * as contexts from './browserContext'; import type * as pages from './page'; import type * as frames from './frames'; import type * as types from './types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import { assert } from '../utils'; import { ManualPromise } from '../utils/manualPromise'; import { SdkObject } from './instrumentation'; diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.ts index c07e4aa117..06f098a8ac 100644 --- a/packages/playwright-core/src/server/page.ts +++ b/packages/playwright-core/src/server/page.ts @@ -20,7 +20,7 @@ import * as frames from './frames'; import * as input from './input'; import * as js from './javascript'; import * as network from './network'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ScreenshotOptions } from './screenshotter'; import { Screenshotter, validateScreenshotOptions } from './screenshotter'; import { TimeoutSettings } from '../common/timeoutSettings'; diff --git a/packages/playwright-core/src/server/recorder.ts b/packages/playwright-core/src/server/recorder.ts index 9b0e45980f..06b23af0bc 100644 --- a/packages/playwright-core/src/server/recorder.ts +++ b/packages/playwright-core/src/server/recorder.ts @@ -16,7 +16,7 @@ import * as fs from 'fs'; import type * as actions from './recorder/recorderActions'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { ActionInContext } from './recorder/codeGenerator'; import { CodeGenerator } from './recorder/codeGenerator'; import { toClickOptions, toModifiers } from './recorder/utils'; diff --git a/packages/playwright-core/src/server/trace/common/DEPS.list b/packages/playwright-core/src/server/trace/common/DEPS.list deleted file mode 100644 index db85b375ce..0000000000 --- a/packages/playwright-core/src/server/trace/common/DEPS.list +++ /dev/null @@ -1,3 +0,0 @@ -[*] -../../har/ - diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts index 8d874b451c..452166ae31 100644 --- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts +++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts @@ -23,7 +23,7 @@ import type { Frame } from '../../frames'; import type { SnapshotData } from './snapshotterInjected'; import { frameSnapshotStreamer } from './snapshotterInjected'; import { calculateSha1, createGuid, monotonicTime } from '../../../utils'; -import type { FrameSnapshot } from '../common/snapshotTypes'; +import type { FrameSnapshot } from '@trace/snapshot'; import type { ElementHandle } from '../../dom'; import { mime } from '../../../utilsBundle'; diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts b/packages/playwright-core/src/server/trace/recorder/snapshotterInjected.ts index cdfb7814a1..275c34cbd4 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 type { NodeSnapshot } from '../common/snapshotTypes'; +import type { NodeSnapshot } from '@trace/snapshot'; 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 7c9ffbc2d4..5b5273775f 100644 --- a/packages/playwright-core/src/server/trace/recorder/tracing.ts +++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts @@ -19,8 +19,8 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; -import type { TracingTracingStopChunkParams } from '../../../protocol/channels'; -import { commandsWithTracingSnapshots } from '../../../protocol/channels'; +import type { TracingTracingStopChunkParams } from '@protocol/channels'; +import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; @@ -33,16 +33,18 @@ import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; -import type * as har from '../../har/har'; +import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; -import type { FrameSnapshot } from '../common/snapshotTypes'; -import type * as trace from '../common/traceEvents'; -import { VERSION } from '../common/traceEvents'; +import type { FrameSnapshot } from '@trace/snapshot'; +import type * as trace from '@trace/trace'; +import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; +const version: VERSION = 3; + export type TracerOptions = { name?: string; snapshots?: boolean; @@ -92,7 +94,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps skipScripts: true, }); this._contextCreatedEvent = { - version: VERSION, + version, type: 'context-options', browserName: '', options: {}, diff --git a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts index efe6c4ecaa..07d20e48e8 100644 --- a/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts +++ b/packages/playwright-core/src/server/trace/test/inMemorySnapshotter.ts @@ -16,7 +16,7 @@ import type { BrowserContext } from '../../browserContext'; import type { Page } from '../../page'; -import type { FrameSnapshot } from '../common/snapshotTypes'; +import type { FrameSnapshot } from '@trace/snapshot'; import type { SnapshotRenderer } from '../../../../../trace-viewer/src/snapshotRenderer'; import { BaseSnapshotStorage } from '../../../../../trace-viewer/src/snapshotStorage'; import type { SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter'; @@ -24,7 +24,7 @@ import { Snapshotter } from '../recorder/snapshotter'; import type { ElementHandle } from '../../dom'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; -import type * as har from '../../har/har'; +import type * as har from '@trace/har'; export class InMemorySnapshotter extends BaseSnapshotStorage implements SnapshotterDelegate, HarTracerDelegate { private _blobs = new Map(); diff --git a/packages/playwright-core/src/server/types.ts b/packages/playwright-core/src/server/types.ts index 9f5f9c0dfe..661244a9c9 100644 --- a/packages/playwright-core/src/server/types.ts +++ b/packages/playwright-core/src/server/types.ts @@ -17,7 +17,7 @@ import type { Size, Point, TimeoutOptions, HeadersArray } from '../common/types'; export type { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } from '../common/types'; -import type * as channels from '../protocol/channels'; +import type * as channels from '@protocol/channels'; export type StrictOptions = { strict?: boolean, diff --git a/packages/playwright-core/src/server/webkit/wkAccessibility.ts b/packages/playwright-core/src/server/webkit/wkAccessibility.ts index 447347a08f..b6ec1308cc 100644 --- a/packages/playwright-core/src/server/webkit/wkAccessibility.ts +++ b/packages/playwright-core/src/server/webkit/wkAccessibility.ts @@ -17,7 +17,7 @@ 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 channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; 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 eae9be81fd..ee7dae1150 100644 --- a/packages/playwright-core/src/server/webkit/wkBrowser.ts +++ b/packages/playwright-core/src/server/webkit/wkBrowser.ts @@ -25,7 +25,7 @@ import * as network from '../network'; import type { Page, PageBinding, PageDelegate } from '../page'; import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; -import type * as channels from '../../protocol/channels'; +import type * as channels from '@protocol/channels'; import type { Protocol } from './protocol'; import type { PageProxyMessageReceivedPayload } from './wkConnection'; import { kPageProxyMessageReceived, WKConnection, WKSession } from './wkConnection'; diff --git a/packages/playwright-test/src/matchers/toMatchText.ts b/packages/playwright-test/src/matchers/toMatchText.ts index d14ec2077f..985407d996 100644 --- a/packages/playwright-test/src/matchers/toMatchText.ts +++ b/packages/playwright-test/src/matchers/toMatchText.ts @@ -15,7 +15,7 @@ */ -import type { ExpectedTextValue } from 'playwright-core/lib/protocol/channels'; +import type { ExpectedTextValue } from '@protocol/channels'; import { isRegExp, isString } from 'playwright-core/lib/utils'; import type { Expect } from '../types'; import type { ParsedStackTrace } from '../util'; diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts index 4fd9c75a14..d9933c4658 100644 --- a/packages/playwright-test/src/reporters/html.ts +++ b/packages/playwright-test/src/reporters/html.ts @@ -32,91 +32,7 @@ import type { FullConfigInternal, Metadata, ReporterInternal } from '../types'; import type { ZipFile } from 'playwright-core/lib/zipBundle'; import { yazl } from 'playwright-core/lib/zipBundle'; import { mime } from 'playwright-core/lib/utilsBundle'; - -export type Stats = { - total: number; - expected: number; - unexpected: number; - flaky: number; - skipped: number; - ok: boolean; - duration: number; -}; - -export type Location = { - file: string; - line: number; - column: number; -}; - -export type HTMLReport = { - metadata: Metadata; - files: TestFileSummary[]; - stats: Stats; - projectNames: string[]; -}; - -export type TestFile = { - fileId: string; - fileName: string; - tests: TestCase[]; -}; - -export type TestFileSummary = { - fileId: string; - fileName: string; - tests: TestCaseSummary[]; - stats: Stats; -}; - -export type TestCaseSummary = { - testId: string, - title: string; - path: string[]; - projectName: string; - location: Location; - annotations: { type: string, description?: string }[]; - outcome: 'skipped' | 'expected' | 'unexpected' | 'flaky'; - duration: number; - ok: boolean; - results: TestResultSummary[]; -}; - -export type TestResultSummary = { - attachments: { name: string, contentType: string, path?: string }[]; -}; - -export type TestCase = Omit & { - results: TestResult[]; -}; - -export type TestAttachment = { - name: string; - body?: string; - path?: string; - contentType: string; -}; - -export type TestResult = { - retry: number; - startTime: string; - duration: number; - steps: TestStep[]; - errors: string[]; - attachments: TestAttachment[]; - status: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted'; -}; - -export type TestStep = { - title: string; - startTime: string; - duration: number; - location?: Location; - snippet?: string; - error?: string; - steps: TestStep[]; - count: number; -}; +import type { HTMLReport, Stats, TestAttachment, TestCase, TestCaseSummary, TestFile, TestFileSummary, TestResult, TestStep } from '@html-reporter/types'; type TestEntry = { testCase: TestCase; diff --git a/packages/playwright-core/src/protocol/callMetadata.ts b/packages/protocol/src/callMetadata.ts similarity index 100% rename from packages/playwright-core/src/protocol/callMetadata.ts rename to packages/protocol/src/callMetadata.ts diff --git a/packages/playwright-core/src/protocol/channels.ts b/packages/protocol/src/channels.ts similarity index 97% rename from packages/playwright-core/src/protocol/channels.ts rename to packages/protocol/src/channels.ts index e0cc073532..bb0505623b 100644 --- a/packages/playwright-core/src/protocol/channels.ts +++ b/packages/protocol/src/channels.ts @@ -4484,129 +4484,3 @@ export interface JsonPipeEvents { 'message': JsonPipeMessageEvent; 'closed': JsonPipeClosedEvent; } - -export const commandsWithTracingSnapshots = new Set([ - 'EventTarget.waitForEventInfo', - 'BrowserContext.waitForEventInfo', - 'Page.waitForEventInfo', - 'WebSocket.waitForEventInfo', - 'ElectronApplication.waitForEventInfo', - 'AndroidDevice.waitForEventInfo', - 'Page.goBack', - 'Page.goForward', - 'Page.reload', - 'Page.expectScreenshot', - 'Page.screenshot', - 'Page.setViewportSize', - 'Page.keyboardDown', - 'Page.keyboardUp', - 'Page.keyboardInsertText', - 'Page.keyboardType', - 'Page.keyboardPress', - 'Page.mouseMove', - 'Page.mouseDown', - 'Page.mouseUp', - 'Page.mouseClick', - 'Page.mouseWheel', - 'Page.touchscreenTap', - 'Frame.evalOnSelector', - 'Frame.evalOnSelectorAll', - 'Frame.addScriptTag', - 'Frame.addStyleTag', - 'Frame.check', - 'Frame.click', - 'Frame.dragAndDrop', - 'Frame.dblclick', - 'Frame.dispatchEvent', - 'Frame.evaluateExpression', - 'Frame.evaluateExpressionHandle', - 'Frame.fill', - 'Frame.focus', - 'Frame.getAttribute', - 'Frame.goto', - 'Frame.hover', - 'Frame.innerHTML', - 'Frame.innerText', - 'Frame.inputValue', - 'Frame.isChecked', - 'Frame.isDisabled', - 'Frame.isEnabled', - 'Frame.isHidden', - 'Frame.isVisible', - 'Frame.isEditable', - 'Frame.press', - 'Frame.selectOption', - 'Frame.setContent', - 'Frame.setInputFiles', - 'Frame.setInputFilePaths', - 'Frame.tap', - 'Frame.textContent', - 'Frame.type', - 'Frame.uncheck', - 'Frame.waitForTimeout', - 'Frame.waitForFunction', - 'Frame.waitForSelector', - 'Frame.expect', - 'JSHandle.evaluateExpression', - 'ElementHandle.evaluateExpression', - 'JSHandle.evaluateExpressionHandle', - 'ElementHandle.evaluateExpressionHandle', - 'ElementHandle.evalOnSelector', - 'ElementHandle.evalOnSelectorAll', - 'ElementHandle.check', - 'ElementHandle.click', - 'ElementHandle.dblclick', - 'ElementHandle.dispatchEvent', - 'ElementHandle.fill', - 'ElementHandle.hover', - 'ElementHandle.innerHTML', - 'ElementHandle.innerText', - 'ElementHandle.inputValue', - 'ElementHandle.isChecked', - 'ElementHandle.isDisabled', - 'ElementHandle.isEditable', - 'ElementHandle.isEnabled', - 'ElementHandle.isHidden', - 'ElementHandle.isVisible', - 'ElementHandle.press', - 'ElementHandle.screenshot', - 'ElementHandle.scrollIntoViewIfNeeded', - 'ElementHandle.selectOption', - 'ElementHandle.selectText', - 'ElementHandle.setInputFiles', - 'ElementHandle.setInputFilePaths', - 'ElementHandle.tap', - 'ElementHandle.textContent', - 'ElementHandle.type', - 'ElementHandle.uncheck', - 'ElementHandle.waitForElementState', - 'ElementHandle.waitForSelector' -]); - -export const pausesBeforeInputActions = new Set([ - 'Frame.check', - 'Frame.click', - 'Frame.dragAndDrop', - 'Frame.dblclick', - 'Frame.fill', - 'Frame.hover', - 'Frame.press', - 'Frame.selectOption', - 'Frame.setInputFiles', - 'Frame.setInputFilePaths', - 'Frame.tap', - 'Frame.type', - 'Frame.uncheck', - 'ElementHandle.check', - 'ElementHandle.click', - 'ElementHandle.dblclick', - 'ElementHandle.fill', - 'ElementHandle.hover', - 'ElementHandle.press', - 'ElementHandle.selectOption', - 'ElementHandle.setInputFiles', - 'ElementHandle.setInputFilePaths', - 'ElementHandle.tap', - 'ElementHandle.type', - 'ElementHandle.uncheck' -]); \ No newline at end of file diff --git a/packages/playwright-core/src/protocol/protocol.yml b/packages/protocol/src/protocol.yml similarity index 100% rename from packages/playwright-core/src/protocol/protocol.yml rename to packages/protocol/src/protocol.yml diff --git a/packages/recorder/tsconfig.json b/packages/recorder/tsconfig.json index 53bc039f94..57873b3184 100644 --- a/packages/recorder/tsconfig.json +++ b/packages/recorder/tsconfig.json @@ -17,6 +17,7 @@ "baseUrl": ".", "useUnknownInCatchVariables": false, "paths": { + "@protocol/*": ["../protocol/src/*"], "@web/*": ["../web/src/*"], } }, diff --git a/packages/recorder/vite.config.ts b/packages/recorder/vite.config.ts index 019f44b435..95b7ab9d45 100644 --- a/packages/recorder/vite.config.ts +++ b/packages/recorder/vite.config.ts @@ -25,8 +25,8 @@ export default defineConfig({ ], resolve: { alias: { + '@protocol': path.resolve(__dirname, '../protocol/src'), '@web': path.resolve(__dirname, '../web/src'), - '@playwright-core': path.resolve(__dirname, '../playwright-core/src'), }, }, build: { diff --git a/packages/trace-viewer/src/DEPS.list b/packages/trace-viewer/src/DEPS.list index 7f22b2f03d..f69b330116 100644 --- a/packages/trace-viewer/src/DEPS.list +++ b/packages/trace-viewer/src/DEPS.list @@ -1,4 +1,4 @@ [*] -@playwright-core/utils/multimap.ts +@trace/** @web/** ui/ diff --git a/packages/trace-viewer/src/entries.ts b/packages/trace-viewer/src/entries.ts index 8a92c8c381..152e16f4d0 100644 --- a/packages/trace-viewer/src/entries.ts +++ b/packages/trace-viewer/src/entries.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { ResourceSnapshot } from '@playwright-core/server/trace/common/snapshotTypes'; -import type * as trace from '@playwright-core/server/trace/common/traceEvents'; +import type { ResourceSnapshot } from '@trace/snapshot'; +import type * as trace from '@trace/trace'; export type ContextEntry = { traceUrl: string; diff --git a/packages/trace-viewer/src/multimap.ts b/packages/trace-viewer/src/multimap.ts new file mode 100644 index 0000000000..18777d29e5 --- /dev/null +++ b/packages/trace-viewer/src/multimap.ts @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class MultiMap { + private _map: Map; + + constructor() { + this._map = new Map(); + } + + set(key: K, value: V) { + let values = this._map.get(key); + if (!values) { + values = []; + this._map.set(key, values); + } + values.push(value); + } + + get(key: K): V[] { + return this._map.get(key) || []; + } + + has(key: K): boolean { + return this._map.has(key); + } + + delete(key: K, value: V) { + const values = this._map.get(key); + if (!values) + return; + if (values.includes(value)) + this._map.set(key, values.filter(v => value !== v)); + } + + deleteAll(key: K) { + this._map.delete(key); + } + + hasValue(key: K, value: V): boolean { + const values = this._map.get(key); + if (!values) + return false; + return values.includes(value); + } + + get size(): number { + return this._map.size; + } + + [Symbol.iterator](): Iterator<[K, V[]]> { + return this._map[Symbol.iterator](); + } + + keys(): IterableIterator { + return this._map.keys(); + } + + values(): Iterable { + const result: V[] = []; + for (const key of this.keys()) + result.push(...this.get(key)); + return result; + } + + clear() { + this._map.clear(); + } +} diff --git a/packages/trace-viewer/src/snapshotRenderer.ts b/packages/trace-viewer/src/snapshotRenderer.ts index 280744008b..e1d0d3c071 100644 --- a/packages/trace-viewer/src/snapshotRenderer.ts +++ b/packages/trace-viewer/src/snapshotRenderer.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { FrameSnapshot, NodeSnapshot, RenderedFrameSnapshot, ResourceSnapshot } from '@playwright-core/server/trace/common/snapshotTypes'; +import type { FrameSnapshot, NodeSnapshot, RenderedFrameSnapshot, ResourceSnapshot } from '@trace/snapshot'; export class SnapshotRenderer { private _snapshots: FrameSnapshot[]; diff --git a/packages/trace-viewer/src/snapshotServer.ts b/packages/trace-viewer/src/snapshotServer.ts index b4672518e3..c32e1710fe 100644 --- a/packages/trace-viewer/src/snapshotServer.ts +++ b/packages/trace-viewer/src/snapshotServer.ts @@ -15,10 +15,11 @@ */ import type { SnapshotStorage } from './snapshotStorage'; -import type { Point } from '@playwright-core/common/types'; import type { URLSearchParams } from 'url'; import type { SnapshotRenderer } from './snapshotRenderer'; +type Point = { x: number, y: number }; + export class SnapshotServer { private _snapshotStorage: SnapshotStorage; private _snapshotIds = new Map(); diff --git a/packages/trace-viewer/src/snapshotStorage.ts b/packages/trace-viewer/src/snapshotStorage.ts index ef0e7b83ad..2997f4e4c2 100644 --- a/packages/trace-viewer/src/snapshotStorage.ts +++ b/packages/trace-viewer/src/snapshotStorage.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { FrameSnapshot, ResourceSnapshot } from '@playwright-core/server/trace/common/snapshotTypes'; +import type { FrameSnapshot, ResourceSnapshot } from '@trace/snapshot'; import { EventEmitter } from './events'; import { rewriteURLForCustomProtocol, SnapshotRenderer } from './snapshotRenderer'; diff --git a/packages/trace-viewer/src/sw.ts b/packages/trace-viewer/src/sw.ts index 2229ea5fb6..980f0fee9d 100644 --- a/packages/trace-viewer/src/sw.ts +++ b/packages/trace-viewer/src/sw.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { MultiMap } from '@playwright-core/utils/multimap'; +import { MultiMap } from './multimap'; import { SnapshotServer } from './snapshotServer'; import { TraceModel } from './traceModel'; diff --git a/packages/trace-viewer/src/traceModel.ts b/packages/trace-viewer/src/traceModel.ts index 1739d9abc9..24b313e813 100644 --- a/packages/trace-viewer/src/traceModel.ts +++ b/packages/trace-viewer/src/traceModel.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { CallMetadata } from '@playwright-core/protocol/callMetadata'; -import type * as trace from '@playwright-core/server/trace/common/traceEvents'; +import type { CallMetadata } from '@protocol/callMetadata'; +import type * as trace from '@trace/trace'; import type zip from '@zip.js/zip.js'; // @ts-ignore import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'; diff --git a/packages/trace-viewer/src/ui/actionList.tsx b/packages/trace-viewer/src/ui/actionList.tsx index a82af9c6c0..edf1c28c7c 100644 --- a/packages/trace-viewer/src/ui/actionList.tsx +++ b/packages/trace-viewer/src/ui/actionList.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; import { msToString } from '@web/uiUtils'; import * as React from 'react'; import './actionList.css'; diff --git a/packages/trace-viewer/src/ui/callTab.tsx b/packages/trace-viewer/src/ui/callTab.tsx index 3f11af0ac9..2bc669dcfa 100644 --- a/packages/trace-viewer/src/ui/callTab.tsx +++ b/packages/trace-viewer/src/ui/callTab.tsx @@ -14,9 +14,9 @@ * limitations under the License. */ -import type { CallMetadata } from '@playwright-core/protocol/callMetadata'; -import type { SerializedValue } from '@playwright-core/protocol/channels'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { CallMetadata } from '@protocol/callMetadata'; +import type { SerializedValue } from '@protocol/channels'; +import type { ActionTraceEvent } from '@trace/trace'; import { msToString } from '@web/uiUtils'; import * as React from 'react'; import './callTab.css'; diff --git a/packages/trace-viewer/src/ui/consoleTab.tsx b/packages/trace-viewer/src/ui/consoleTab.tsx index a13ef76206..5f7c0210f2 100644 --- a/packages/trace-viewer/src/ui/consoleTab.tsx +++ b/packages/trace-viewer/src/ui/consoleTab.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import type * as channels from '@playwright-core/protocol/channels'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type * as channels from '@protocol/channels'; +import type { ActionTraceEvent } from '@trace/trace'; import * as React from 'react'; import './consoleTab.css'; import * as modelUtil from './modelUtil'; diff --git a/packages/trace-viewer/src/ui/modelUtil.ts b/packages/trace-viewer/src/ui/modelUtil.ts index dae16e3bd8..f2c752d61b 100644 --- a/packages/trace-viewer/src/ui/modelUtil.ts +++ b/packages/trace-viewer/src/ui/modelUtil.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import type { ResourceSnapshot } from '@playwright-core/server/trace/common/snapshotTypes'; -import type * as trace from '@playwright-core/server/trace/common/traceEvents'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ResourceSnapshot } from '@trace/snapshot'; +import type * as trace from '@trace/trace'; +import type { ActionTraceEvent } from '@trace/trace'; import type { ContextEntry, PageEntry } from '../entries'; const contextSymbol = Symbol('context'); diff --git a/packages/trace-viewer/src/ui/networkResourceDetails.tsx b/packages/trace-viewer/src/ui/networkResourceDetails.tsx index fed5b23096..ea46cccc00 100644 --- a/packages/trace-viewer/src/ui/networkResourceDetails.tsx +++ b/packages/trace-viewer/src/ui/networkResourceDetails.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { ResourceSnapshot } from '@playwright-core/server/trace/common/snapshotTypes'; +import type { ResourceSnapshot } from '@trace/snapshot'; import { Expandable } from '@web/components/expandable'; import * as React from 'react'; import './networkResourceDetails.css'; diff --git a/packages/trace-viewer/src/ui/networkTab.tsx b/packages/trace-viewer/src/ui/networkTab.tsx index 4a6d32fa33..b89c1e66ba 100644 --- a/packages/trace-viewer/src/ui/networkTab.tsx +++ b/packages/trace-viewer/src/ui/networkTab.tsx @@ -15,7 +15,7 @@ */ import * as React from 'react'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; import * as modelUtil from './modelUtil'; import { NetworkResourceDetails } from './networkResourceDetails'; import './networkTab.css'; diff --git a/packages/trace-viewer/src/ui/snapshotTab.tsx b/packages/trace-viewer/src/ui/snapshotTab.tsx index 944ba61f8a..a660e4dc97 100644 --- a/packages/trace-viewer/src/ui/snapshotTab.tsx +++ b/packages/trace-viewer/src/ui/snapshotTab.tsx @@ -18,7 +18,7 @@ import './snapshotTab.css'; import './tabbedPane.css'; import * as React from 'react'; import { useMeasure } from './helpers'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; import { context } from './modelUtil'; export const SnapshotTab: React.FunctionComponent<{ diff --git a/packages/trace-viewer/src/ui/sourceTab.tsx b/packages/trace-viewer/src/ui/sourceTab.tsx index c75bf28fdb..70063b518b 100644 --- a/packages/trace-viewer/src/ui/sourceTab.tsx +++ b/packages/trace-viewer/src/ui/sourceTab.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { StackFrame } from '@playwright-core/protocol/channels'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { StackFrame } from '@protocol/channels'; +import type { ActionTraceEvent } from '@trace/trace'; import { Source as SourceView } from '@web/components/source'; import { SplitView } from '@web/components/splitView'; import '@web/third_party/highlightjs/highlightjs/tomorrow.css'; diff --git a/packages/trace-viewer/src/ui/stackTrace.tsx b/packages/trace-viewer/src/ui/stackTrace.tsx index ea650459f4..fbb2f80f3c 100644 --- a/packages/trace-viewer/src/ui/stackTrace.tsx +++ b/packages/trace-viewer/src/ui/stackTrace.tsx @@ -16,7 +16,7 @@ import * as React from 'react'; import './stackTrace.css'; -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; export const StackTraceView: React.FunctionComponent<{ action: ActionTraceEvent | undefined, diff --git a/packages/trace-viewer/src/ui/timeline.tsx b/packages/trace-viewer/src/ui/timeline.tsx index c329555a0f..f23b4e8445 100644 --- a/packages/trace-viewer/src/ui/timeline.tsx +++ b/packages/trace-viewer/src/ui/timeline.tsx @@ -15,7 +15,7 @@ limitations under the License. */ -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; import { msToString } from '@web/uiUtils'; import * as React from 'react'; import type { Boundaries } from '../geometry'; diff --git a/packages/trace-viewer/src/ui/workbench.tsx b/packages/trace-viewer/src/ui/workbench.tsx index 15fa64ed51..49292781f7 100644 --- a/packages/trace-viewer/src/ui/workbench.tsx +++ b/packages/trace-viewer/src/ui/workbench.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import type { ActionTraceEvent } from '@playwright-core/server/trace/common/traceEvents'; +import type { ActionTraceEvent } from '@trace/trace'; import { SplitView } from '@web/components/splitView'; import { msToString } from '@web/uiUtils'; import * as React from 'react'; diff --git a/packages/trace-viewer/tsconfig.json b/packages/trace-viewer/tsconfig.json index fe902f3205..499a59d5cb 100644 --- a/packages/trace-viewer/tsconfig.json +++ b/packages/trace-viewer/tsconfig.json @@ -16,9 +16,10 @@ "jsx": "react-jsx", "baseUrl": ".", "paths": { + "@protocol/*": ["../protocol/src/*"], "@recorder/*": ["../recorder/src/*"], + "@trace/*": ["../trace/src/*"], "@web/*": ["../web/src/*"], - "@playwright-core/*": ["../playwright-core/src/*"], }, "useUnknownInCatchVariables": false, }, diff --git a/packages/trace-viewer/vite.config.ts b/packages/trace-viewer/vite.config.ts index d8c4543873..b10a911b6b 100644 --- a/packages/trace-viewer/vite.config.ts +++ b/packages/trace-viewer/vite.config.ts @@ -28,8 +28,8 @@ export default defineConfig({ ], resolve: { alias: { + '@protocol': path.resolve(__dirname, '../protocol/src'), '@web': path.resolve(__dirname, '../web/src'), - '@playwright-core': path.resolve(__dirname, '../playwright-core/src'), }, }, build: { diff --git a/packages/playwright-core/src/server/har/har.ts b/packages/trace/src/har.ts similarity index 100% rename from packages/playwright-core/src/server/har/har.ts rename to packages/trace/src/har.ts diff --git a/packages/playwright-core/src/server/trace/common/snapshotTypes.ts b/packages/trace/src/snapshot.ts similarity index 96% rename from packages/playwright-core/src/server/trace/common/snapshotTypes.ts rename to packages/trace/src/snapshot.ts index bacd83b52b..b7cd892994 100644 --- a/packages/playwright-core/src/server/trace/common/snapshotTypes.ts +++ b/packages/trace/src/snapshot.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Entry as HAREntry } from '../../har/har'; +import type { Entry as HAREntry } from './har'; export type ResourceSnapshot = HAREntry; diff --git a/packages/playwright-core/src/server/trace/common/traceEvents.ts b/packages/trace/src/trace.ts similarity index 92% rename from packages/playwright-core/src/server/trace/common/traceEvents.ts rename to packages/trace/src/trace.ts index 2f4e5e3cb1..a9b5cf1e87 100644 --- a/packages/playwright-core/src/server/trace/common/traceEvents.ts +++ b/packages/trace/src/trace.ts @@ -14,12 +14,13 @@ * limitations under the License. */ -import type { Size } from '../../../common/types'; -import type { CallMetadata } from '../../instrumentation'; -import type { FrameSnapshot, ResourceSnapshot } from './snapshotTypes'; +import type { CallMetadata } from '@protocol/callMetadata'; +import type { FrameSnapshot, ResourceSnapshot } from './snapshot'; + +export type Size = { width: number, height: number }; // Make sure you add _modernize_N_to_N1(event: any) to traceModel.ts. -export const VERSION = 3; +export type VERSION = 3; export type BrowserContextEventOptions = { viewport?: Size, diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index d49d8bb26e..4cead198fa 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -23,7 +23,7 @@ import { removeFolders } from '../../packages/playwright-core/lib/utils/fileUtil import { baseTest } from './baseTest'; import type { RemoteServerOptions } from './remoteServer'; import { RemoteServer } from './remoteServer'; -import type { Log } from '../../packages/playwright-core/src/server/har/har'; +import type { Log } from '../../packages/trace/src/har'; import { parseHar } from '../config/utils'; export type BrowserTestWorkerFixtures = PageWorkerFixtures & { diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.ts index 74a2ce537b..183a152048 100644 --- a/tests/library/har.spec.ts +++ b/tests/library/har.spec.ts @@ -21,7 +21,7 @@ import fs from 'fs'; import http2 from 'http2'; import type { BrowserContext, BrowserContextOptions } from 'playwright-core'; import type { AddressInfo } from 'net'; -import type { Log } from '../../packages/playwright-core/src/server/har/har'; +import type { Log } from '../../packages/trace/src/har'; import { parseHar } from '../config/utils'; async function pageWithHar(contextFactory: (options?: BrowserContextOptions) => Promise, testInfo: any, options: { outputPath?: string, content?: 'embed' | 'attach' | 'omit', omitContent?: boolean } = {}) { diff --git a/tests/page/page-request-fulfill.spec.ts b/tests/page/page-request-fulfill.spec.ts index 227de84c61..682f208c76 100644 --- a/tests/page/page-request-fulfill.spec.ts +++ b/tests/page/page-request-fulfill.spec.ts @@ -17,7 +17,7 @@ import { test as base, expect } from './pageTest'; import fs from 'fs'; -import type * as har from 'playwright-core/lib/server/har/har'; +import type * as har from '../../packages/trace/src/har'; const it = base.extend<{ // We access test servers at 10.0.2.2 from inside the browser on Android, diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 826c915130..6e36239f7c 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -9,9 +9,12 @@ "strictBindCallApply": true, "allowSyntheticDefaultImports": true, "useUnknownInCatchVariables": false, - "baseUrl": ".", + "baseUrl": "..", "paths": { - "@playwright-core/*": ["../packages/playwright-core/src/*"], + "@protocol/*": ["packages/protocol/src/*"], + "@recorder/*": ["packages/recorder/src/*"], + "@trace/*": ["packages/trace/src/*"], + "@web/*": ["packages/web/src/*"], }, }, "include": ["**/*.spec.js", "**/*.ts", "index.d.ts"], diff --git a/tsconfig.json b/tsconfig.json index 3cd48faba8..4799c3cc89 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,13 @@ "paths": { /* The following two serve different purposes: - - @playwright-core is for importing types only, - - playwright-core/lib means require dependency + - @foo is for importing types only, + - foo/lib means require dependency */ - "@playwright-core/*": ["./packages/playwright-core/src/*"], + "@html-reporter/*": ["./packages/html-reporter/src/*"], + "@protocol/*": ["./packages/protocol/src/*"], "@recorder/*": ["./packages/recorder/src/*"], + "@trace/*": ["./packages/trace/src/*"], "playwright-core/lib/*": ["./packages/playwright-core/src/*"] }, "esModuleInterop": true, diff --git a/utils/generate_channels.js b/utils/generate_channels.js index a691fe3a89..029cd623e7 100755 --- a/utils/generate_channels.js +++ b/utils/generate_channels.js @@ -156,10 +156,30 @@ export type { Validator, ValidatorContext } from './validatorPrimitives'; export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator } from './validatorPrimitives'; `]; +const debug_ts = [ +`/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is generated by ${path.basename(__filename).split(path.sep).join(path.posix.sep)}, do not edit manually. +`]; + const tracingSnapshots = []; const pausesBeforeInputActions = []; -const yml = fs.readFileSync(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'protocol.yml'), 'utf-8'); +const yml = fs.readFileSync(path.join(__dirname, '..', 'packages', 'protocol', 'src', 'protocol.yml'), 'utf-8'); const protocol = yaml.parse(yml); function addScheme(name, s) { @@ -307,26 +327,30 @@ for (const [name, item] of Object.entries(protocol)) { } } -channels_ts.push(`export const commandsWithTracingSnapshots = new Set([ +debug_ts.push(`export const commandsWithTracingSnapshots = new Set([ '${tracingSnapshots.join(`',\n '`)}' ]);`); -channels_ts.push(''); -channels_ts.push(`export const pausesBeforeInputActions = new Set([ +debug_ts.push(''); +debug_ts.push(`export const pausesBeforeInputActions = new Set([ '${pausesBeforeInputActions.join(`',\n '`)}' ]);`); let hasChanges = false; function writeFile(filePath, content) { - const existing = fs.readFileSync(filePath, 'utf8'); - if (existing === content) - return; + try { + const existing = fs.readFileSync(filePath, 'utf8'); + if (existing === content) + return; + } catch (e) { + } hasChanges = true; const root = path.join(__dirname, '..'); console.log(`Writing //${path.relative(root, filePath)}`); fs.writeFileSync(filePath, content, 'utf8'); } -writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'channels.ts'), channels_ts.join('\n')); +writeFile(path.join(__dirname, '..', 'packages', 'protocol', 'src', 'channels.ts'), channels_ts.join('\n')); +writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'debug.ts'), debug_ts.join('\n')); writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'validator.ts'), validator_ts.join('\n')); process.exit(hasChanges ? 1 : 0); diff --git a/utils/generate_types/test/tsconfig.json b/utils/generate_types/test/tsconfig.json index f4caa29cf9..eb64864983 100644 --- a/utils/generate_types/test/tsconfig.json +++ b/utils/generate_types/test/tsconfig.json @@ -3,7 +3,7 @@ "strict": true, "target": "ES2019", "noEmit": true, - "moduleResolution": "node" + "moduleResolution": "node", }, "include": [ "test.ts"