Skip to content

Commit

Permalink
chore: move protocol and trace types into the top-level packages (#17486
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pavelfeldman authored Sep 21, 2022
1 parent cd9a594 commit df14303
Show file tree
Hide file tree
Showing 146 changed files with 529 additions and 381 deletions.
2 changes: 1 addition & 1 deletion packages/html-reporter/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/headerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/imageDiffView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/loadedReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/reportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testCaseView.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } });

Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testCaseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testFileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testFilesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testResultView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
102 changes: 102 additions & 0 deletions packages/html-reporter/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<TestCaseSummary, 'results'> & {
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;
};
2 changes: 1 addition & 1 deletion packages/html-reporter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"],
Expand Down
1 change: 0 additions & 1 deletion packages/html-reporter/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default defineConfig({
resolve: {
alias: {
'@web': path.resolve(__dirname, '../web/src'),
'@playwright-core': path.resolve(__dirname, '../playwright-core/src'),
},
},
build: {
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/browserContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/browserType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/cdpSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/channelOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/consoleMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/elementHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/fileChooser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/jsHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit df14303

Please sign in to comment.