-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.d.ts
78 lines (76 loc) · 2.92 KB
/
index.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
/// <reference types="cypress" />
declare global {
namespace Cypress {
interface Chainable<Subject> {
/**
* Enables you to work with the subject yielded from the previous command.
* Similar to `cy.then`, except the function can be re-evaluated if followed by
* a `.should` AND returns a value synchronously (no `cy` commands inside).
* In this instance, your function should not have any side effects and could be run
* many times per second.
*
* It can start a chain or continue a chain. If starting a chain, the subject
* will be the body elememnt
*
* ```ts
* const getChildren = $el => $el.children()
*
* cy.get('body')
* .pipe(getChildren)
* .should('have.length', 3)
*
* cy.pipe(getChildren) // $el will be body
* .should('have.length', 3)
* ```
*/
pipe<S>(
fn: (this: { [key: string]: any }, currentSubject: Subject) => Chainable<S> | Promise<S>,
options?: Partial<Timeoutable & Loggable>,
): Chainable<S>
/**
* Enables you to work with the subject yielded from the previous command.
* Similar to `cy.then`, except the function can be re-evaluated if followed by
* a `.should` AND returns a value synchronously (no `cy` commands inside).
* In this instance, your function should not have any side effects and could be run
* many times per second.
*
* It can start a chain or continue a chain. If starting a chain, the subject
* will be the body elememnt
*
* ```ts
* const getChildren = $el => $el.children()
*
* cy.get('body')
* .pipe(getChildren)
* .should('have.length', 3)
*
* cy.pipe(getChildren) // $el will be body
* .should('have.length', 3)
* ```
*/
pipe<S extends object | any[] | string | number | boolean | undefined | null>(
fn: (this: { [key: string]: any }, currentSubject: Subject) => S,
options?: Partial<Timeoutable & Loggable>,
): Chainable<S>
/**
* Starts a chain. The subject is the jQuery-wrapped body element is given to the function.
* Similar to `cy.then`, except the function can be re-evaluated if followed by
* a `.should` AND returns a value synchronously (no `cy` commands inside).
* In this instance, your function should not have any side effects and could be run
* many times per second.
*
* ```ts
* const getChildren = $el => $el.children()
*
* cy.pipe(getChildren)
* .should('have.length', 3)
* ```
*/
pipe<S extends object | any[] | string | number | boolean | undefined | null>(
fn: (this: { [key: string]: any }, currentSubject: JQuery) => S,
options?: Partial<Timeoutable & Loggable>,
): Chainable<S>
}
}
}
export { loggable } from './loggable'