/
internal-types.d.ts
86 lines (75 loc) · 2.52 KB
/
internal-types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// NOTE: this is for internal Cypress types that we don't want exposed in the public API but want for development
// TODO: find a better place for this
/// <reference path="./internal-types-lite.d.ts" />
interface InternalWindowLoadDetails {
type: 'same:origin' | 'cross:origin' | 'cross:origin:failure'
error?: Error
window?: AUTWindow
}
declare namespace Cypress {
interface Cypress {
backend: (eventName: string, ...args: any[]) => Promise<any>
// TODO: how to pull this from proxy-logging.ts? can't import in a d.ts file...
ProxyLogging: any
// TODO: how to pull these from resolvers.ts? can't import in a d.ts file...
resolveWindowReference: any
resolveLocationReference: any
routes: {
[routeId: string]: any
}
sinon: sinon.SinonApi
utils: CypressUtils
state: State
events: Events
emit: (event: string, payload?: any) => void
primaryOriginCommunicator: import('../src/cross-origin/communicator').PrimaryOriginCommunicator
specBridgeCommunicator: import('../src/cross-origin/communicator').SpecBridgeCommunicator
mocha: $Mocha
configure: (config: Cypress.ObjectLike) => void
isCrossOriginSpecBridge: boolean
originalConfig: Cypress.ObjectLike
cy: $Cy
Location: {
create: (url: string) => ({ domain: string, superDomain: string })
}
}
interface CypressUtils {
throwErrByPath: (path: string, obj?: { args: object }) => void
warnByPath: (path: string, obj?: { args: object }) => void
warning: (message: string) => void
}
interface InternalConfig {
(k: keyof ResolvedConfigOptions, v?: any): any
}
interface ResolvedConfigOptions {
$autIframe: JQuery<HTMLIFrameElement>
document: Document
projectRoot?: string
}
interface Actions {
(action: 'set:cookie', fn: (cookie: AutomationCookie) => void)
(action: 'clear:cookie', fn: (name: string) => void)
(action: 'clear:cookies', fn: () => void)
(action: 'cross:origin:cookies', fn: (cookies: AutomationCookie[]) => void)
(action: 'before:stability:release', fn: () => void)
(action: 'paused', fn: (nextCommandName: string) => void)
}
interface Backend {
(task: 'cross:origin:cookies:received'): Promise<void>
}
}
type AliasedRequest = {
alias: string
request: any
}
// utility types
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
interface SpecWindow extends Window {
cy: $Cy
}
interface CypressRunnable extends Mocha.Runnable {
type: null | 'hook' | 'suite' | 'test'
hookId: any
id: any
err: any
}