2020-08-28 10:51:55 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2022-09-20 18:41:51 -07:00
|
|
|
import type { CallMetadata } from '@protocol/callMetadata';
|
2022-10-18 22:23:40 -04:00
|
|
|
import type { Language } from '../../playwright-core/src/server/isomorphic/locatorGenerators';
|
2022-09-20 18:41:51 -07:00
|
|
|
import type { FrameSnapshot, ResourceSnapshot } from './snapshot';
|
|
|
|
|
|
|
|
export type Size = { width: number, height: number };
|
2021-10-12 13:42:50 -08:00
|
|
|
|
2022-03-25 13:12:00 -08:00
|
|
|
// Make sure you add _modernize_N_to_N1(event: any) to traceModel.ts.
|
2022-09-20 18:41:51 -07:00
|
|
|
export type VERSION = 3;
|
2021-10-12 13:42:50 -08:00
|
|
|
|
|
|
|
export type BrowserContextEventOptions = {
|
|
|
|
viewport?: Size,
|
|
|
|
deviceScaleFactor?: number,
|
|
|
|
isMobile?: boolean,
|
2021-11-09 22:13:51 -08:00
|
|
|
userAgent?: string,
|
2021-10-12 13:42:50 -08:00
|
|
|
};
|
2021-01-29 06:57:57 -08:00
|
|
|
|
2020-08-28 10:51:55 -07:00
|
|
|
export type ContextCreatedTraceEvent = {
|
2021-07-02 14:33:38 -07:00
|
|
|
version: number,
|
2021-05-13 22:36:34 -07:00
|
|
|
type: 'context-options',
|
2020-08-28 10:51:55 -07:00
|
|
|
browserName: string,
|
2021-11-09 22:13:51 -08:00
|
|
|
platform: string,
|
|
|
|
wallTime: number,
|
2021-11-01 20:23:35 -08:00
|
|
|
title?: string,
|
2022-10-18 22:23:40 -04:00
|
|
|
options: BrowserContextEventOptions,
|
|
|
|
sdkLanguage?: Language,
|
2020-09-11 11:34:53 -07:00
|
|
|
};
|
|
|
|
|
2021-04-08 05:32:12 +08:00
|
|
|
export type ScreencastFrameTraceEvent = {
|
2021-04-24 20:39:48 -07:00
|
|
|
type: 'screencast-frame',
|
2021-04-08 05:32:12 +08:00
|
|
|
pageId: string,
|
2021-04-08 22:59:05 +08:00
|
|
|
sha1: string,
|
|
|
|
width: number,
|
|
|
|
height: number,
|
2021-05-13 22:36:34 -07:00
|
|
|
timestamp: number,
|
2021-04-08 05:32:12 +08:00
|
|
|
};
|
|
|
|
|
2020-09-10 21:42:09 -07:00
|
|
|
export type ActionTraceEvent = {
|
2021-04-23 09:28:18 -07:00
|
|
|
type: 'action' | 'event',
|
2021-03-10 11:43:26 -08:00
|
|
|
metadata: CallMetadata,
|
2020-08-28 10:51:55 -07:00
|
|
|
};
|
2020-09-18 11:54:00 -07:00
|
|
|
|
2021-04-23 20:39:09 -07:00
|
|
|
export type ResourceSnapshotTraceEvent = {
|
|
|
|
type: 'resource-snapshot',
|
|
|
|
snapshot: ResourceSnapshot,
|
|
|
|
};
|
|
|
|
|
|
|
|
export type FrameSnapshotTraceEvent = {
|
|
|
|
type: 'frame-snapshot',
|
|
|
|
snapshot: FrameSnapshot,
|
|
|
|
};
|
|
|
|
|
2020-09-18 11:54:00 -07:00
|
|
|
export type TraceEvent =
|
|
|
|
ContextCreatedTraceEvent |
|
2021-04-08 05:32:12 +08:00
|
|
|
ScreencastFrameTraceEvent |
|
2021-01-15 18:30:55 -08:00
|
|
|
ActionTraceEvent |
|
2021-04-23 20:39:09 -07:00
|
|
|
ResourceSnapshotTraceEvent |
|
2021-08-23 16:08:09 -07:00
|
|
|
FrameSnapshotTraceEvent;
|