-
Notifications
You must be signed in to change notification settings - Fork 0
/
steps.d.ts
339 lines (305 loc) · 13.1 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
type ICodeceptCallback = (i: CodeceptJS.I, Todos02Page:CodeceptJS.Todos02Page, Todos03Page:CodeceptJS.Todos03Page, Todos04Page:CodeceptJS.Todos04Page, Todos05Page:CodeceptJS.Todos05Page, TodosPage:CodeceptJS.TodosPage, TodosBddPage:CodeceptJS.TodosBddPage, ...args: any) => 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
injectDependencies(dependencies: { [key: string]: any }): 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 interface IScenario {
Scenario(title: string, callback: ICodeceptCallback): ScenarioConfig;
Scenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
}
declare function xScenario(title: string, callback: ICodeceptCallback): ScenarioConfig;
declare function xScenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
declare interface IData {
Scenario(title: string, callback: ICodeceptCallback): ScenarioConfig;
Scenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig;
only: IScenario;
}
declare function Data(data: any): IData;
declare function xData(data: any): IData;
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 inject(): { [key: string]: any };
declare function locate(selector: LocatorOrString): Locator;
declare function within(selector: LocatorOrString, callback: Function): Promise<any>;
declare function session(selector: LocatorOrString, callback: Function): Promise<any>;
declare function session(selector: LocatorOrString, config: any, callback: Function): Promise<any>;
declare function pause(): void;
declare function secret(secret: any): string;
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,
handleDownloads(downloadPath?: string) : 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(locator: LocatorOrString, 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,
grabDataFromPerformanceTiming() : Promise<string>,
debug(msg: string) : void,
debugSection(section: string, msg: string) : void,
setRequestTimeout(newTimeout: string) : void,
sendGetRequest(url: string, headers?: string) : void,
sendPostRequest(url: string, payload?: string, headers?: string) : void,
sendPatchRequest(url: string, payload: string, headers?: string) : void,
sendPutRequest(url: string, payload?: string, headers?: string) : void,
sendDeleteRequest(url: string, headers?: string) : void,
assertThat(expr: string, msg: string) : void,
hover(selector: string) : void,
typeText(text: string) : void,
abortImages() : void,
say: () => any;
retryStep(opts: string) : void,
}
export interface Todos02Page {
goto() : void,
enterTodo(todo: string) : void,
seeNumberOfTodos(numberOfTodos: string) : void,
}
export interface Todos03Page {
goto() : void,
focusNewTodoField() : void,
typeTodoAndEnter(todo: string) : void,
enterTodo(todo: string) : void,
seeNumberOfTodos(numberOfTodos: string) : void,
seeEmptyTodoInput() : void,
seeNthTodoEquals(nthTodo: string, todo: string) : void,
seeFooter() : void,
}
export interface Todos04Page {
goto() : void,
enterTodo(todo: string) : void,
markNthAsCompleted() : void,
unmarkNthAsCompleted() : void,
markAllAsCompleted() : void,
clearCompleted() : void,
filterAll() : void,
filterActive() : void,
filterCompleted() : void,
seeNthTodoEquals() : void,
seeNumberOfTodos(numberOfTodos: string) : void,
seeEmptyTodoInput() : void,
seeFooter() : void,
}
export interface Todos05Page {
goto() : void,
enterTodo(todo: string) : void,
markNthAsCompleted() : void,
unmarkNthAsCompleted() : void,
markAllAsCompleted() : void,
clearCompleted() : void,
filterAll() : void,
filterActive() : void,
filterCompleted() : void,
editNthTodo(nthTodo: string, newTodoText: string) : void,
deleteNthTodo(nthTodo: string) : void,
seeNthTodoEquals() : void,
seeNumberOfTodos(numberOfTodos: string) : void,
seeEmptyTodoInput() : void,
seeFooter() : void,
}
export interface TodosPage {
goto() : void,
enterTodo(todo: string) : void,
enterTodos(todoItems: string) : void,
markNthAsCompleted() : void,
unmarkNthAsCompleted() : void,
markAllAsCompleted() : void,
clearCompleted() : void,
filterAll() : void,
filterActive() : void,
filterCompleted() : void,
editNthTodo(nthTodo: string, newTodoText: string) : void,
deleteNthTodo(nthTodo: string) : void,
refresh() : void,
seeNthTodoEquals() : void,
seeNumberOfTodos(numberOfTodos: string) : void,
seeEmptyTodoInput() : void,
seeFooter() : void,
}
export interface TodosBddPage {
}
}
declare module "codeceptjs" {
export = CodeceptJS;
}