-
Notifications
You must be signed in to change notification settings - Fork 4
/
steps.d.ts
232 lines (214 loc) · 9.6 KB
/
steps.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
type ICodeceptCallback = (i: CodeceptJS.I) => void;
declare class FeatureConfig {
retry(times:number): FeatureConfig
timeout(seconds:number): FeatureConfig
config(config:object): FeatureConfig
config(helperName:string, config:object): FeatureConfig
}
declare class ScenarioConfig {
throws(err:any) : ScenarioConfig;
fails() : ScenarioConfig;
retry(times:number): ScenarioConfig
timeout(timeout:number): ScenarioConfig
inject(inject:object): ScenarioConfig
config(config:object): ScenarioConfig
config(helperName:string, config:object): ScenarioConfig
}
interface ILocator {
id?: string;
xpath?: string;
css?: string;
name?: string;
frame?: string;
android?: string;
ios?: string;
}
type LocatorOrString = string | ILocator | Locator;
declare class Helper {
/** Abstract method to provide required config options */
static _config(): any;
/** Abstract method to validate config */
_validateConfig<T>(config: T): T;
/** Sets config for current test */
_setConfig(opts: any): void;
/** Hook executed before all tests */
_init(): void
/** Hook executed before each test. */
_before(): void
/** Hook executed after each test */
_after(): void
/**
* Hook provides a test details
* Executed in the very beginning of a test
*/
_test(test: () => void): void
/** Hook executed after each passed test */
_passed(test: () => void): void
/** Hook executed after each failed test */
_failed(test: () => void): void
/** Hook executed before each step */
_beforeStep(step: () => void): void
/** Hook executed after each step */
_afterStep(step: () => void): void
/** Hook executed before each suite */
_beforeSuite(suite: () => void): void
/** Hook executed after each suite */
_afterSuite(suite: () => void): void
/** Hook executed after all tests are executed */
_finishTest(suite: () => void): void
/**Access another configured helper: this.helpers['AnotherHelper'] */
readonly helpers: any
/** Print debug message to console (outputs only in debug mode) */
debug(msg: string): void
debugSection(section: string, msg: string): void
}
declare class Locator {
constructor(locator: LocatorOrString, defaultType?: string);
or(locator: LocatorOrString): Locator;
find(locator: LocatorOrString): Locator;
withChild(locator: LocatorOrString): Locator;
withDescendant(locator: LocatorOrString): Locator;
at(position: number): Locator;
first(): Locator;
last(): Locator;
inside(locator: LocatorOrString): Locator;
before(locator: LocatorOrString): Locator;
after(locator: LocatorOrString): Locator;
withText(text: string): Locator;
withAttr(attrs: object): Locator;
as(output: string): Locator;
}
declare function actor(customSteps?: {
[action: string]: (this: CodeceptJS.I, ...args: any[]) => void
}): CodeceptJS.I;
declare function actor(customSteps?: {}): CodeceptJS.I;
declare function Feature(title: string, opts?: {}): FeatureConfig;
declare const Scenario: {
(title: string, callback: ICodeceptCallback): ScenarioConfig;
(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
only(title: string, callback: ICodeceptCallback): ScenarioConfig;
only(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
}
declare function xScenario(title: string, callback: ICodeceptCallback): ScenarioConfig;
declare function xScenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
declare function Data(data: any): any;
declare function xData(data: any): any;
declare function Before(callback: ICodeceptCallback): void;
declare function BeforeSuite(callback: ICodeceptCallback): void;
declare function After(callback: ICodeceptCallback): void;
declare function AfterSuite(callback: ICodeceptCallback): void;
declare function locate(selector: LocatorOrString): Locator;
declare function within(selector: LocatorOrString, callback: Function): Promise<any>;
declare function session(selector: string, callback: Function): Promise<any>;
declare function session(selector: string, config: any, callback: Function): Promise<any>;
declare function pause(): void;
declare const codeceptjs: any;
declare namespace CodeceptJS {
export interface I {
amAcceptingPopups() : void,
acceptPopup() : void,
amCancellingPopups() : void,
cancelPopup() : void,
seeInPopup(text: string) : void,
grabPopupText() : Promise<string>,
amOnPage(url: string) : void,
resizeWindow(width: number, height: number) : void,
haveRequestHeaders(customHeaders: string) : void,
moveCursorTo(locator: LocatorOrString, offsetX?: number, offsetY?: number) : void,
dragAndDrop(srcElement: string, destElement: string) : void,
refreshPage() : void,
scrollPageToTop() : void,
scrollPageToBottom() : void,
scrollTo(locator: LocatorOrString, offsetX?: number, offsetY?: number) : void,
seeInTitle(text: string) : void,
grabPageScrollPosition() : Promise<string>,
seeTitleEquals(text: string) : void,
dontSeeInTitle(text: string) : void,
grabTitle() : Promise<string>,
switchToNextTab(num?: number) : void,
switchToPreviousTab(num?: number) : void,
closeCurrentTab() : void,
closeOtherTabs() : void,
openNewTab() : void,
grabNumberOfOpenTabs() : Promise<string>,
seeElement(locator: LocatorOrString) : void,
dontSeeElement(locator: LocatorOrString) : void,
seeElementInDOM(locator: LocatorOrString) : void,
dontSeeElementInDOM(locator: LocatorOrString) : void,
click(locator: LocatorOrString, context?: LocatorOrString) : void,
clickLink(locator: LocatorOrString, context?: LocatorOrString) : void,
downloadFile(locator: LocatorOrString, customName: string) : void,
doubleClick(locator: LocatorOrString, context?: LocatorOrString) : void,
rightClick(locator: LocatorOrString, context?: LocatorOrString) : void,
checkOption(field: LocatorOrString, context?: LocatorOrString) : void,
uncheckOption(field: LocatorOrString, context?: LocatorOrString) : void,
seeCheckboxIsChecked(field: LocatorOrString) : void,
dontSeeCheckboxIsChecked(field: LocatorOrString) : void,
pressKey(key: string) : void,
fillField(field: LocatorOrString, value: string) : void,
clearField(field: LocatorOrString) : void,
appendField(field: LocatorOrString, value: string) : void,
seeInField(field: LocatorOrString, value: string) : void,
dontSeeInField(field: LocatorOrString, value: string) : void,
attachFile(locator: LocatorOrString, pathToFile: string) : void,
selectOption(select: LocatorOrString, option: string) : void,
grabNumberOfVisibleElements(locator: LocatorOrString) : Promise<string>,
seeInCurrentUrl(url: string) : void,
dontSeeInCurrentUrl(url: string) : void,
seeCurrentUrlEquals(url: string) : void,
dontSeeCurrentUrlEquals(url: string) : void,
see(text: string, context?: LocatorOrString) : void,
seeTextEquals(text: string, context?: LocatorOrString) : void,
dontSee(text: string, context?: LocatorOrString) : void,
grabSource() : Promise<string>,
grabBrowserLogs() : Promise<string>,
grabCurrentUrl() : Promise<string>,
seeInSource(text: string) : void,
dontSeeInSource(text: string) : void,
seeNumberOfElements(selector: string, num: number) : void,
seeNumberOfVisibleElements(locator: LocatorOrString, num: number) : void,
setCookie(cookie: string) : void,
seeCookie(name: string) : void,
dontSeeCookie(name: string) : void,
grabCookie(name: string) : Promise<string>,
clearCookie(name: string) : void,
executeScript(fn: Function) : void,
executeAsyncScript(fn: Function) : void,
grabTextFrom(locator: LocatorOrString) : Promise<string>,
grabValueFrom(locator: LocatorOrString) : Promise<string>,
grabHTMLFrom(locator: LocatorOrString) : Promise<string>,
grabCssPropertyFrom(locator: LocatorOrString, cssProperty: string) : Promise<string>,
seeCssPropertiesOnElements(locator: LocatorOrString, cssProperties: string) : void,
seeAttributesOnElements(locator: LocatorOrString, attributes: string) : void,
dragSlider(locator: LocatorOrString, offsetX?: number) : void,
grabAttributeFrom(locator: LocatorOrString, attr: string) : Promise<string>,
saveScreenshot(fileName: string, fullPage: string) : void,
wait(sec: number) : void,
waitForEnabled(locator: LocatorOrString, sec: number) : void,
waitForValue(field: LocatorOrString, value: string, sec: number) : void,
waitNumberOfVisibleElements(locator: LocatorOrString, num: number, sec: number) : void,
waitForElement(locator: LocatorOrString, sec: number) : void,
waitForVisible(locator: LocatorOrString, sec: number) : void,
waitForInvisible(locator: LocatorOrString, sec: number) : void,
waitToHide(locator: LocatorOrString, sec: number) : void,
waitInUrl(urlPart: string, sec?: number) : void,
waitUrlEquals(urlPart: string, sec?: number) : void,
waitForText(text: string, sec?: number, context?: LocatorOrString) : void,
waitForRequest(urlOrPredicate: string, sec?: number) : void,
waitForResponse(urlOrPredicate: string, sec?: number) : void,
switchTo(locator: LocatorOrString) : void,
waitForFunction(fn: Function, argsOrSec?: string, sec?: number) : void,
waitForNavigation(opts?: string) : void,
waitUntil(fn: Function, sec?: number) : void,
waitUntilExists(locator: LocatorOrString, sec: number) : void,
waitForDetached(locator: LocatorOrString, sec: number) : void,
debug(msg: string) : void,
debugSection(section: string, msg: string) : void,
say: () => any;
retryStep(opts: string) : void,
}
}
declare function inject(): { I: CodeceptJS.I, [key: string]: any; };
declare module "codeceptjs" {
export = CodeceptJS;
}