chore: cleanup code that is not used by cli anymore (#5005)
This commit is contained in:
parent
7ff86a848a
commit
e3ebba5573
|
|
@ -464,12 +464,6 @@ export class Frame extends ChannelOwner<channels.FrameChannel, channels.FrameIni
|
|||
return (await this._channel.title()).value;
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: remove once playwright-cli does not use this one anymore.
|
||||
async _extendInjectedScript<Arg>(source: string, arg?: Arg): Promise<JSHandle> {
|
||||
const result = await this._channel.extendInjectedScript({ source, arg: serializeArgument(arg) });
|
||||
return JSHandle.from(result.handle);
|
||||
}
|
||||
}
|
||||
|
||||
export function verifyLoadState(name: string, waitUntil: LifecycleEvent): LifecycleEvent {
|
||||
|
|
|
|||
|
|
@ -233,8 +233,4 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameInitializer
|
|||
async title(): Promise<channels.FrameTitleResult> {
|
||||
return { value: await this._frame.title() };
|
||||
}
|
||||
|
||||
async extendInjectedScript(params: channels.FrameExtendInjectedScriptParams): Promise<channels.FrameExtendInjectedScriptResult> {
|
||||
return { handle: createHandle(this._scope, await this._frame.extendInjectedScript(params.source, parseArgument(params.arg))) };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1209,7 +1209,6 @@ export interface FrameChannel extends Channel {
|
|||
uncheck(params: FrameUncheckParams, metadata?: Metadata): Promise<FrameUncheckResult>;
|
||||
waitForFunction(params: FrameWaitForFunctionParams, metadata?: Metadata): Promise<FrameWaitForFunctionResult>;
|
||||
waitForSelector(params: FrameWaitForSelectorParams, metadata?: Metadata): Promise<FrameWaitForSelectorResult>;
|
||||
extendInjectedScript(params: FrameExtendInjectedScriptParams, metadata?: Metadata): Promise<FrameExtendInjectedScriptResult>;
|
||||
}
|
||||
export type FrameLoadstateEvent = {
|
||||
add?: 'load' | 'domcontentloaded' | 'networkidle',
|
||||
|
|
@ -1669,16 +1668,6 @@ export type FrameWaitForSelectorOptions = {
|
|||
export type FrameWaitForSelectorResult = {
|
||||
element?: ElementHandleChannel,
|
||||
};
|
||||
export type FrameExtendInjectedScriptParams = {
|
||||
source: string,
|
||||
arg: SerializedArgument,
|
||||
};
|
||||
export type FrameExtendInjectedScriptOptions = {
|
||||
|
||||
};
|
||||
export type FrameExtendInjectedScriptResult = {
|
||||
handle: JSHandleChannel,
|
||||
};
|
||||
|
||||
// ----------- Worker -----------
|
||||
export type WorkerInitializer = {
|
||||
|
|
|
|||
|
|
@ -1396,14 +1396,6 @@ Frame:
|
|||
returns:
|
||||
element: ElementHandle?
|
||||
|
||||
extendInjectedScript:
|
||||
experimental: True
|
||||
parameters:
|
||||
source: string
|
||||
arg: SerializedArgument
|
||||
returns:
|
||||
handle: JSHandle
|
||||
|
||||
events:
|
||||
|
||||
loadstate:
|
||||
|
|
|
|||
|
|
@ -679,10 +679,6 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||
timeout: tOptional(tNumber),
|
||||
state: tOptional(tEnum(['attached', 'detached', 'visible', 'hidden'])),
|
||||
});
|
||||
scheme.FrameExtendInjectedScriptParams = tObject({
|
||||
source: tString,
|
||||
arg: tType('SerializedArgument'),
|
||||
});
|
||||
scheme.WorkerEvaluateExpressionParams = tObject({
|
||||
expression: tString,
|
||||
isFunction: tBoolean,
|
||||
|
|
|
|||
|
|
@ -34,18 +34,11 @@ export function ffmpegExecutable(): string | undefined {
|
|||
}
|
||||
|
||||
function pathToExecutable(relative: string[]): string | undefined {
|
||||
const defaultPath = path.join(__dirname, '..', '..', ...relative);
|
||||
const localPath = path.join(path.dirname(process.argv[0]), relative[relative.length - 1]);
|
||||
try {
|
||||
const defaultPath = path.join(__dirname, '..', '..', ...relative);
|
||||
if (fs.existsSync(defaultPath))
|
||||
return defaultPath;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (fs.existsSync(localPath))
|
||||
return localPath;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { it, expect } from './fixtures';
|
||||
import type * as trace from '../types/trace';
|
||||
import type * as trace from '../src/trace/traceTypes';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
|
|
|
|||
101
types/trace.d.ts
vendored
101
types/trace.d.ts
vendored
|
|
@ -1,101 +0,0 @@
|
|||
/**
|
||||
* 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 type ContextCreatedTraceEvent = {
|
||||
type: 'context-created',
|
||||
browserName: string,
|
||||
contextId: string,
|
||||
deviceScaleFactor: number,
|
||||
isMobile: boolean,
|
||||
viewportSize?: { width: number, height: number },
|
||||
};
|
||||
|
||||
export type ContextDestroyedTraceEvent = {
|
||||
type: 'context-destroyed',
|
||||
contextId: string,
|
||||
};
|
||||
|
||||
export type NetworkResourceTraceEvent = {
|
||||
type: 'resource',
|
||||
contextId: string,
|
||||
pageId: string,
|
||||
frameId: string,
|
||||
url: string,
|
||||
contentType: string,
|
||||
responseHeaders: { name: string, value: string }[],
|
||||
sha1: string,
|
||||
};
|
||||
|
||||
export type PageCreatedTraceEvent = {
|
||||
type: 'page-created',
|
||||
contextId: string,
|
||||
pageId: string,
|
||||
};
|
||||
|
||||
export type PageDestroyedTraceEvent = {
|
||||
type: 'page-destroyed',
|
||||
contextId: string,
|
||||
pageId: string,
|
||||
};
|
||||
|
||||
export type PageVideoTraceEvent = {
|
||||
type: 'page-video',
|
||||
contextId: string,
|
||||
pageId: string,
|
||||
fileName: string,
|
||||
};
|
||||
|
||||
export type ActionTraceEvent = {
|
||||
type: 'action',
|
||||
contextId: string,
|
||||
action: string,
|
||||
pageId?: string,
|
||||
selector?: string,
|
||||
label?: string,
|
||||
value?: string,
|
||||
startTime?: number,
|
||||
endTime?: number,
|
||||
logs?: string[],
|
||||
snapshot?: {
|
||||
sha1: string,
|
||||
duration: number,
|
||||
},
|
||||
stack?: string,
|
||||
error?: string,
|
||||
};
|
||||
|
||||
export type TraceEvent =
|
||||
ContextCreatedTraceEvent |
|
||||
ContextDestroyedTraceEvent |
|
||||
PageCreatedTraceEvent |
|
||||
PageDestroyedTraceEvent |
|
||||
PageVideoTraceEvent |
|
||||
NetworkResourceTraceEvent |
|
||||
ActionTraceEvent;
|
||||
|
||||
|
||||
export type FrameSnapshot = {
|
||||
frameId: string,
|
||||
url: string,
|
||||
html: string,
|
||||
resourceOverrides: { url: string, sha1: string }[],
|
||||
};
|
||||
|
||||
export type PageSnapshot = {
|
||||
viewportSize?: { width: number, height: number },
|
||||
// First frame is the main frame.
|
||||
frames: FrameSnapshot[],
|
||||
};
|
||||
|
|
@ -36,7 +36,6 @@ let hadChanges = false;
|
|||
if (!fs.existsSync(typesDir))
|
||||
fs.mkdirSync(typesDir)
|
||||
writeFile(path.join(typesDir, 'protocol.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'server', 'chromium', 'protocol.ts'), 'utf8'));
|
||||
writeFile(path.join(typesDir, 'trace.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'trace', 'traceTypes.ts'), 'utf8'));
|
||||
documentation = parseApi(path.join(PROJECT_DIR, 'docs', 'src', 'api'));
|
||||
documentation.filterForLanguage('js');
|
||||
documentation.copyDocsFromSuperclasses([]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue