-
Notifications
You must be signed in to change notification settings - Fork 25
/
plugin.spec.ts
88 lines (76 loc) · 2.69 KB
/
plugin.spec.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
/// <reference types="cypress" />
cy.waitUntil(() => true)
cy.waitUntil(() => Promise.resolve(true))
cy.waitUntil(() => true, {})
cy.waitUntil(() => Promise.resolve(true), {})
cy.waitUntil(() => true, { timeout: 500 })
cy.waitUntil(() => Promise.resolve(true), { timeout: 500 })
cy.waitUntil(() => true, { errorMsg: 'Custom error message' })
cy.waitUntil(() => Promise.resolve(true), { errorMsg: 'Custom error message' })
cy.waitUntil(() => true, { errorMsg: () => 'Custom error message' })
cy.waitUntil(() => Promise.resolve(true), {
errorMsg: () => 'Custom error message',
})
cy.waitUntil(() => Promise.resolve(true), {
errorMsg: () => 'Custom error message',
})
cy.waitUntil(() => true, {
errorMsg: (
_result: any,
{
timeout,
interval,
}: {
timeout: number
interval: number
}
) => 'Custom error message',
})
cy.waitUntil(() => true, { description: 'Custom description' })
cy.waitUntil(() => true, {
logger: ({ name, message, consoleProps }) => {
console.log({ name, message, consoleProps })
},
})
cy.waitUntil(() => true, { log: false })
cy.waitUntil(() => true, { customMessage: 'custom message' })
// below there are the same tests but leveraging the TS Generic
cy.waitUntil<boolean>(() => true)
cy.waitUntil<boolean>(() => Promise.resolve(true))
cy.waitUntil<boolean>(() => true, {})
cy.waitUntil<boolean>(() => Promise.resolve(true), {})
cy.waitUntil<boolean>(() => true, { timeout: 500 })
cy.waitUntil<boolean>(() => Promise.resolve(true), { timeout: 500 })
cy.waitUntil<boolean>(() => true, { errorMsg: 'Custom error message' })
cy.waitUntil<boolean>(() => Promise.resolve(true), { errorMsg: 'Custom error message' })
cy.waitUntil<boolean>(() => true, { errorMsg: () => 'Custom error message' })
cy.waitUntil<boolean>(() => Promise.resolve(true), {
errorMsg: () => 'Custom error message',
})
cy.waitUntil<boolean>(() => true, {
errorMsg: (
_result: boolean,
{
timeout,
interval,
}: {
timeout: number
interval: number
}
) => 'Custom error message',
})
cy.waitUntil<boolean>(() => true, { description: 'Custom description' })
cy.waitUntil<boolean>(() => true, {
logger: ({ name, message, consoleProps }) => {
console.log({ name, message, consoleProps })
},
})
cy.waitUntil<boolean>(() => true, { log: false })
cy.waitUntil<boolean>(() => true, { customMessage: 'custom message' })
cy.wrap('').waitUntil((subject) => subject.length)
cy.wrap('').waitUntil<boolean>((subject) => !!subject.length)
cy.wrap<string>('').waitUntil<boolean>((subject) => !!subject.length)
cy.wrap<string>('').waitUntil((subject) => subject.length)
cy.waitUntil(() => cy.task<number>('myTaskReturningANumber')).then((subject) => {
subject * subject
})