| 
									
										
										
										
											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. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  | import type { Point, SerializedError, StackFrame } from '@protocol/channels'; | 
					
						
							| 
									
										
										
										
											2023-03-06 18:49:14 -08:00
										 |  |  | import type { Language } from '../../playwright-core/src/utils/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.
 | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  | export type VERSION = 4; | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							| 
									
										
										
										
											2023-02-17 11:19:53 -08:00
										 |  |  |   testIdAttributeName?: string, | 
					
						
							| 
									
										
										
										
											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
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-15 22:33:40 -07:00
										 |  |  | export type BeforeActionTraceEvent = { | 
					
						
							|  |  |  |   type: 'before', | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  |   callId: string; | 
					
						
							|  |  |  |   startTime: number; | 
					
						
							|  |  |  |   apiName: string; | 
					
						
							|  |  |  |   class: string; | 
					
						
							|  |  |  |   method: string; | 
					
						
							|  |  |  |   params: any; | 
					
						
							|  |  |  |   wallTime: number; | 
					
						
							| 
									
										
										
										
											2023-03-15 22:33:40 -07:00
										 |  |  |   beforeSnapshot?: string; | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  |   stack?: StackFrame[]; | 
					
						
							| 
									
										
										
										
											2023-03-15 22:33:40 -07:00
										 |  |  |   pageId?: string; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export type InputActionTraceEvent = { | 
					
						
							|  |  |  |   type: 'input', | 
					
						
							|  |  |  |   callId: string; | 
					
						
							|  |  |  |   inputSnapshot?: string; | 
					
						
							|  |  |  |   point?: Point; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export type AfterActionTraceEvent = { | 
					
						
							|  |  |  |   type: 'after', | 
					
						
							|  |  |  |   callId: string; | 
					
						
							|  |  |  |   endTime: number; | 
					
						
							|  |  |  |   afterSnapshot?: string; | 
					
						
							|  |  |  |   log: string[]; | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  |   error?: SerializedError['error']; | 
					
						
							| 
									
										
										
										
											2023-04-25 17:38:12 -07:00
										 |  |  |   attachments?: { | 
					
						
							|  |  |  |     name: string; | 
					
						
							|  |  |  |     contentType: string; | 
					
						
							|  |  |  |     path?: string; | 
					
						
							|  |  |  |     sha1?: string; | 
					
						
							|  |  |  |     body?: string;  // base64
 | 
					
						
							|  |  |  |   }[]; | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  |   result?: any; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export type EventTraceEvent = { | 
					
						
							|  |  |  |   type: 'event', | 
					
						
							|  |  |  |   time: number; | 
					
						
							|  |  |  |   class: string; | 
					
						
							|  |  |  |   method: string; | 
					
						
							|  |  |  |   params: any; | 
					
						
							|  |  |  |   pageId?: string; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export type ObjectTraceEvent = { | 
					
						
							|  |  |  |   type: 'object'; | 
					
						
							|  |  |  |   class: string; | 
					
						
							|  |  |  |   initializer: any; | 
					
						
							|  |  |  |   guid: string; | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-15 22:33:40 -07:00
										 |  |  | export type ActionTraceEvent = { | 
					
						
							|  |  |  |   type: 'action', | 
					
						
							|  |  |  | } & Omit<BeforeActionTraceEvent, 'type'> | 
					
						
							|  |  |  |   & Omit<AfterActionTraceEvent, 'type'> | 
					
						
							|  |  |  |   & Omit<InputActionTraceEvent, 'type'>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 | | 
					
						
							| 
									
										
										
										
											2023-03-15 22:33:40 -07:00
										 |  |  |     BeforeActionTraceEvent | | 
					
						
							|  |  |  |     InputActionTraceEvent | | 
					
						
							|  |  |  |     AfterActionTraceEvent | | 
					
						
							| 
									
										
										
										
											2023-02-27 15:29:20 -08:00
										 |  |  |     EventTraceEvent | | 
					
						
							|  |  |  |     ObjectTraceEvent | | 
					
						
							| 
									
										
										
										
											2021-04-23 20:39:09 -07:00
										 |  |  |     ResourceSnapshotTraceEvent | | 
					
						
							| 
									
										
										
										
											2021-08-23 16:08:09 -07:00
										 |  |  |     FrameSnapshotTraceEvent; |