@@ -58,7 +58,42 @@ export interface LaunchArgs {
58
58
59
59
type NullableMiddlewareHook = ( ( message : unknown , data : unknown ) => void ) | null
60
60
61
- export type OnRequestEvent = ( eventName : string , data : any ) => void
61
+ export type KeyPressSupportedKeys = 'Tab'
62
+
63
+ interface CommandSignature < P = any , R = any > {
64
+ dataType : P
65
+ returnType : R
66
+ }
67
+
68
+ export interface KeyPressParams {
69
+ key : KeyPressSupportedKeys
70
+ }
71
+
72
+ export interface AutomationCommands {
73
+ 'take:screenshot' : CommandSignature
74
+ 'get:cookies' : CommandSignature
75
+ 'get:cookie' : CommandSignature
76
+ 'set:cookie' : CommandSignature
77
+ 'set:cookies' : CommandSignature
78
+ 'add:cookies' : CommandSignature
79
+ 'clear:cookies' : CommandSignature
80
+ 'clear:cookie' : CommandSignature
81
+ 'change:cookie' : CommandSignature
82
+ 'create:download' : CommandSignature
83
+ 'canceled:download' : CommandSignature
84
+ 'complete:download' : CommandSignature
85
+ 'get:heap:size:limit' : CommandSignature
86
+ 'collect:garbage' : CommandSignature
87
+ 'reset:browser:tabs:for:next:spec' : CommandSignature
88
+ 'reset:browser:state' : CommandSignature
89
+ 'focus:browser:window' : CommandSignature
90
+ 'is:automation:client:connected' : CommandSignature
91
+ 'remote:debugger:protocol' : CommandSignature
92
+ 'response:received' : CommandSignature
93
+ 'key:press' : CommandSignature < KeyPressParams , Promise < void > >
94
+ }
95
+
96
+ export type OnRequestEvent = < T extends keyof AutomationCommands > ( eventName : T , data : AutomationCommands [ T ] [ 'dataType' ] ) => void
62
97
63
98
export type OnServiceWorkerRegistrationUpdated = ( data : Protocol . ServiceWorker . WorkerRegistrationUpdatedEvent ) => void
64
99
0 commit comments