-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathactions.ts
111 lines (89 loc) · 2.71 KB
/
actions.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Cypress.on('uncaught:exception', (error, runnable, promise) => {
error // $ExpectType Error
runnable // $ExpectType Runnable
promise // $ExpectType Promise<any> | undefined
})
Cypress.on('window:confirm', (text) => {
text // $ExpectType string
})
Cypress.on('window:alert', (text) => {
text // $ExpectType string
})
Cypress.on('window:before:load', (win) => {
win // $ExpectType AUTWindow
})
Cypress.on('window:load', (win) => {
win // $ExpectType AUTWindow
})
Cypress.on('window:before:unload', (event) => {
event // $ExpectType BeforeUnloadEvent
})
Cypress.on('window:unload', (event) => {
event // $ExpectType Event
})
Cypress.on('url:changed', (url) => {
url // $ExpectType string
})
Cypress.on('fail', (error, mocha) => {
error // $ExpectType CypressError
mocha // $ExpectType Runnable
})
Cypress.on('viewport:changed', (viewport) => {
viewport // $ExpectType Viewport
})
Cypress.on('scrolled', ($el) => {
$el // $ExpectType JQuery<HTMLElement>
})
Cypress.on('command:enqueued', (command) => {
command // $ExpectType EnqueuedCommandAttributes
})
Cypress.on('command:start', (command) => {
command // $ExpectType CommandQueue
})
Cypress.on('command:end', (command) => {
command // $ExpectType CommandQueue
})
Cypress.on('command:retry', (command) => {
command // $ExpectType CommandQueue
})
Cypress.on('log:added', (attributes, log) => {
attributes // $ExpectType ObjectLike
log // $ExpectTyped any
})
Cypress.on('log:changed', (attributes, log) => {
attributes // $ExpectType ObjectLike
log // $ExpectTyped any
})
Cypress.on('test:before:run', (attributes , test) => {
attributes // $ExpectType ObjectLike
test // $ExpectType Test
})
Cypress.on('test:before:run:async', (attributes , test) => {
attributes // $ExpectType ObjectLike
test // $ExpectType Test
})
Cypress.on('test:after:run', (attributes , test) => {
attributes // $ExpectType ObjectLike
test // $ExpectType Test
})
namespace CypressActionCommandOptionTests {
cy.get('el').clear({scrollBehavior: 'top'})
cy.get('el').check({scrollBehavior: 'bottom'})
cy.get('el').type('hello', {scrollBehavior: 'center'})
cy.get('el').trigger('mousedown', {scrollBehavior: 'nearest'})
cy.get('el').click({scrollBehavior: false})
cy.get('el').click({scrollBehavior: true}) // $ExpectError
}
// https://github.com/cypress-io/cypress/pull/21286
// `waitFor` doesn't exist in Node EventEmitter
// and it confuses the users with `cy.wait`
namespace CyEventEmitterTests {
cy.waitFor() // $ExpectError
cy.on('random', () => {})
cy.removeAllListeners()
cy.removeListener('a', () => {})
Cypress.waitFor() // $ExpectError
Cypress.on('random', () => {})
Cypress.removeAllListeners()
Cypress.removeListener('a', () => {})
}