-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypings.d.ts
96 lines (79 loc) · 2.23 KB
/
typings.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
import { Browser, Page, NavigationOptions } from 'puppeteer'
type GetWaitCondition = 'load' | 'domcontentloaded' | 'networkidle0'
type WaitConditions = 'LOAD' |
'NETWORK' |
'DOM' |
NavigationOptions
interface ConditionMap{
[key: string]: GetWaitCondition
}
type ScreenOnError = 'OFF' | 'CLOUD' | 'LOCAL'
interface InputPuppeteer{
resolution?: Resolution
url?: string
headless?: boolean
waitCondition?: WaitConditions
logFlag?: boolean
screenOnError?: ScreenOnError
}
interface Fn{
[key: string]: Function
}
type Attach = (page: Page) => AttachOutput
interface Selector{
index: number
selector: string
}
interface AttachOutput{
$$: (selector: string, fn: Function, args?: string[]) => Promise<any>
$: (selector: string, fn: Function, args?: string[]) => Promise<any>
click: (selector: string, index?: number|string) => Promise<boolean>
clickWithPartialText: (selector: string, text: string) => Promise<boolean>
clickWithText: (selector: string, text: string) => Promise<boolean>
count: (selector: string) => Promise<number>
exists: (selector: string) => Promise<boolean>
fill(selector: string, text: string): void
focus: (selector: string) => Promise<boolean>
onError: () => void
page: Page
url: () => Promise<string>
setInput: (selector: string, newValue: string) => Promise<boolean>
waitFor: (selector: string, count?: number) => Promise<boolean>
waitAndClick: (input: Selector) => Promise<boolean>
waitForSelectors: (selectors: string[]) => Promise<boolean>
}
interface OutputPuppeteer{
page: Page
browser: Browser
catchError: (e: any) => Promise<any>
}
interface PuppeteerInstance {
browser: Browser
page: Page
}
interface Resolution {
x: number
y: number
}
interface PuppeteerSettings{
args: Array<string>
handleSIGINT: false
headless: boolean
}
interface TypeSettings{
selector: string
text: string
}
type TypeModule = (input: ITypeModule) => Promise<Array<void>>
type ClickModule = (input: IClickModule) => Promise<void>
interface ITypeModule{
page: Page
text: string
selector: string
}
interface IClickModule{
page: Page
selector: string
}
type TypeFunction = (input: ITypeModule) => Promise<Array<void>>
type ClickFunction = (input: IClickModule) => Promise<void>