forked from screener-io/screener-storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
96 lines (86 loc) · 2.22 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/// <reference types='react' />
declare module 'screener-storybook/src/screener' {
export type Key =
| 'alt'
| 'control'
| 'enter'
| 'escape'
| 'return'
| 'shift'
| 'tab'
| 'leftArrow'
| 'upArrow'
| 'rightArrow'
| 'downArrow';
export const Keys: Record<Key, string>;
export interface SnapshotOpts {
cropTo: string
}
export interface SetValueOpts {
isPassword: boolean
}
export interface Locator {
type: 'css selector';
value: string;
}
export type StepType = 'url' |
'saveScreenshot' |
'cropScreenshot' |
'clickElement' |
'moveTo' |
'clickAndHoldElement' |
'releaseElement' |
'setElementText' |
'sendKeys' |
'executeScript' |
'ignoreElements' |
'pause' |
'waitForElementPresent' |
'waitForElementNotPresent' |
'cssAnimations';
export interface Step {
type: StepType;
locator?: Locator;
url?: string;
name?: string;
text?: string;
isPassword?: boolean;
keys?: string;
code?: string;
isAsync?: boolean;
waitTime?: number;
isEnabled?: boolean;
}
export class Steps {
url(url: string): Steps;
click(selector: string): Steps;
cssAnimations(enabled: boolean): Steps;
snapshot(name: string, options?: SnapshotOpts): Steps;
focus(selector: string): Steps;
hover(selector: string): Steps;
mouseDown(selector: string): Steps;
mouseUp(selector: string): Steps;
keys(selector: string, keys: string): Steps;
setValue(selector: string, value: string, options?: SetValueOpts): Steps;
executeScript(code: string, isAsync?: boolean): Steps;
ignore(selector: string): Steps;
wait(selector: string): Steps;
wait(ms: number): Steps;
waitForNotFound(selector: string): Steps;
rtl(): Steps;
ltr(): Steps;
end(): Step[];
}
export interface ScreenerProps {
/**
* Steps to run. Build using a `Steps` object and convert to an array using `.end()`.
* @example new Steps().hover('.foo').snapshot('hovered').end()
*/
steps?: Step[];
isScreenerComponent?: boolean;
}
export default class Screener extends React.Component<ScreenerProps> {
static Steps: typeof Steps;
static Keys: typeof Keys;
}
}