codeceptjs 3.3.0-beta.4 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -1
- package/README.md +26 -0
- package/docs/api.md +45 -30
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +58 -43
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +99 -70
- package/docs/build/Playwright.js +187 -109
- package/docs/build/Protractor.js +70 -32
- package/docs/build/Puppeteer.js +141 -98
- package/docs/build/REST.js +4 -1
- package/docs/build/TestCafe.js +96 -65
- package/docs/build/WebDriver.js +183 -133
- package/docs/changelog.md +92 -0
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/email.md +5 -0
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +113 -15
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/MockRequest.md +8 -6
- package/docs/helpers/Nightmare.md +131 -29
- package/docs/helpers/Playwright.md +424 -215
- package/docs/helpers/Puppeteer.md +229 -92
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +166 -62
- package/docs/helpers/WebDriver.md +254 -103
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/videos.md +2 -2
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +7 -2
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +49 -13
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +6 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +4 -3
- package/typings/types.d.ts +598 -600
package/docs/helpers/TestCafe.md
CHANGED
|
@@ -107,6 +107,8 @@ I.amOnPage('/login'); // opens a login page
|
|
|
107
107
|
|
|
108
108
|
- `url` **[string][4]** url path or global url.
|
|
109
109
|
|
|
110
|
+
Returns **[Promise][5]<any>**
|
|
111
|
+
|
|
110
112
|
### appendField
|
|
111
113
|
|
|
112
114
|
Appends text to a input field or textarea.
|
|
@@ -118,9 +120,11 @@ I.appendField('#myTextField', 'appended');
|
|
|
118
120
|
|
|
119
121
|
#### Parameters
|
|
120
122
|
|
|
121
|
-
- `field` **([string][4] | [object][
|
|
123
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator
|
|
122
124
|
- `value` **[string][4]** text value to append.
|
|
123
125
|
|
|
126
|
+
Returns **[Promise][5]<any>**
|
|
127
|
+
|
|
124
128
|
### attachFile
|
|
125
129
|
|
|
126
130
|
Attaches a file to element located by label, name, CSS or XPath
|
|
@@ -136,7 +140,9 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
136
140
|
|
|
137
141
|
- `field`
|
|
138
142
|
- `pathToFile` **[string][4]** local file path relative to codecept.json config file.
|
|
139
|
-
- `locator` **([string][4] | [object][
|
|
143
|
+
- `locator` **([string][4] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
144
|
+
|
|
145
|
+
Returns **[Promise][5]<any>**
|
|
140
146
|
|
|
141
147
|
### checkOption
|
|
142
148
|
|
|
@@ -153,8 +159,10 @@ I.checkOption('agree', '//form');
|
|
|
153
159
|
|
|
154
160
|
#### Parameters
|
|
155
161
|
|
|
156
|
-
- `field` **([string][4] | [object][
|
|
157
|
-
- `context` **([string][4]? | [object][
|
|
162
|
+
- `field` **([string][4] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
163
|
+
- `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
164
|
+
|
|
165
|
+
Returns **[Promise][5]<any>**
|
|
158
166
|
|
|
159
167
|
### clearCookie
|
|
160
168
|
|
|
@@ -171,6 +179,8 @@ I.clearCookie('test');
|
|
|
171
179
|
- `cookieName`
|
|
172
180
|
- `cookie` **[string][4]?** (optional, `null` by default) cookie name
|
|
173
181
|
|
|
182
|
+
Returns **[Promise][5]<any>**
|
|
183
|
+
|
|
174
184
|
### clearField
|
|
175
185
|
|
|
176
186
|
Clears a `<textarea>` or text `<input>` element's value.
|
|
@@ -184,7 +194,9 @@ I.clearField('#email');
|
|
|
184
194
|
#### Parameters
|
|
185
195
|
|
|
186
196
|
- `field`
|
|
187
|
-
- `editable` **([string][4] | [object][
|
|
197
|
+
- `editable` **([string][4] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
198
|
+
|
|
199
|
+
Returns **[Promise][5]<any>**
|
|
188
200
|
|
|
189
201
|
### click
|
|
190
202
|
|
|
@@ -212,8 +224,10 @@ I.click({css: 'nav a.login'});
|
|
|
212
224
|
|
|
213
225
|
#### Parameters
|
|
214
226
|
|
|
215
|
-
- `locator` **([string][4] | [object][
|
|
216
|
-
- `context` **([string][4]? | [object][
|
|
227
|
+
- `locator` **([string][4] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
228
|
+
- `context` **([string][4]? | [object][6] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
229
|
+
|
|
230
|
+
Returns **[Promise][5]<any>**
|
|
217
231
|
|
|
218
232
|
### dontSee
|
|
219
233
|
|
|
@@ -228,7 +242,9 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
228
242
|
#### Parameters
|
|
229
243
|
|
|
230
244
|
- `text` **[string][4]** which is not present.
|
|
231
|
-
- `context` **([string][4] | [object][
|
|
245
|
+
- `context` **([string][4] | [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
246
|
+
|
|
247
|
+
Returns **[Promise][5]<any>**
|
|
232
248
|
|
|
233
249
|
### dontSeeCheckboxIsChecked
|
|
234
250
|
|
|
@@ -242,7 +258,9 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
242
258
|
|
|
243
259
|
#### Parameters
|
|
244
260
|
|
|
245
|
-
- `field` **([string][4] | [object][
|
|
261
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
262
|
+
|
|
263
|
+
Returns **[Promise][5]<any>**
|
|
246
264
|
|
|
247
265
|
### dontSeeCookie
|
|
248
266
|
|
|
@@ -256,6 +274,8 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
256
274
|
|
|
257
275
|
- `name` **[string][4]** cookie name.
|
|
258
276
|
|
|
277
|
+
Returns **[Promise][5]<any>**
|
|
278
|
+
|
|
259
279
|
### dontSeeCurrentUrlEquals
|
|
260
280
|
|
|
261
281
|
Checks that current url is not equal to provided one.
|
|
@@ -270,6 +290,8 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
270
290
|
|
|
271
291
|
- `url` **[string][4]** value to check.
|
|
272
292
|
|
|
293
|
+
Returns **[Promise][5]<any>**
|
|
294
|
+
|
|
273
295
|
### dontSeeElement
|
|
274
296
|
|
|
275
297
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
@@ -280,7 +302,9 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
280
302
|
|
|
281
303
|
#### Parameters
|
|
282
304
|
|
|
283
|
-
- `locator` **([string][4] | [object][
|
|
305
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|Strict locator.
|
|
306
|
+
|
|
307
|
+
Returns **[Promise][5]<any>**
|
|
284
308
|
|
|
285
309
|
### dontSeeElementInDOM
|
|
286
310
|
|
|
@@ -292,7 +316,9 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
292
316
|
|
|
293
317
|
#### Parameters
|
|
294
318
|
|
|
295
|
-
- `locator` **([string][4] | [object][
|
|
319
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|Strict locator.
|
|
320
|
+
|
|
321
|
+
Returns **[Promise][5]<any>**
|
|
296
322
|
|
|
297
323
|
### dontSeeInCurrentUrl
|
|
298
324
|
|
|
@@ -302,6 +328,8 @@ Checks that current url does not contain a provided fragment.
|
|
|
302
328
|
|
|
303
329
|
- `url` **[string][4]** value to check.
|
|
304
330
|
|
|
331
|
+
Returns **[Promise][5]<any>**
|
|
332
|
+
|
|
305
333
|
### dontSeeInField
|
|
306
334
|
|
|
307
335
|
Checks that value of input field or textarea doesn't equal to given value
|
|
@@ -314,9 +342,11 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
314
342
|
|
|
315
343
|
#### Parameters
|
|
316
344
|
|
|
317
|
-
- `field` **([string][4] | [object][
|
|
345
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
318
346
|
- `value` **[string][4]** value to check.
|
|
319
347
|
|
|
348
|
+
Returns **[Promise][5]<any>**
|
|
349
|
+
|
|
320
350
|
### dontSeeInSource
|
|
321
351
|
|
|
322
352
|
Checks that the current page does not contains the given string in its raw source code.
|
|
@@ -330,6 +360,8 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
330
360
|
- `text`
|
|
331
361
|
- `value` **[string][4]** to check.
|
|
332
362
|
|
|
363
|
+
Returns **[Promise][5]<any>**
|
|
364
|
+
|
|
333
365
|
### doubleClick
|
|
334
366
|
|
|
335
367
|
Performs a double-click on an element matched by link|button|label|CSS or XPath.
|
|
@@ -344,8 +376,10 @@ I.doubleClick('.btn.edit');
|
|
|
344
376
|
|
|
345
377
|
#### Parameters
|
|
346
378
|
|
|
347
|
-
- `locator` **([string][4] | [object][
|
|
348
|
-
- `context` **([string][4]? | [object][
|
|
379
|
+
- `locator` **([string][4] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
380
|
+
- `context` **([string][4]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
381
|
+
|
|
382
|
+
Returns **[Promise][5]<any>**
|
|
349
383
|
|
|
350
384
|
### executeScript
|
|
351
385
|
|
|
@@ -375,10 +409,10 @@ let date = await I.executeScript(function(el) {
|
|
|
375
409
|
|
|
376
410
|
#### Parameters
|
|
377
411
|
|
|
378
|
-
- `fn` **([string][4] | [function][
|
|
412
|
+
- `fn` **([string][4] | [function][7])** function to be executed in browser context.
|
|
379
413
|
- `args` **...any** to be passed to function.
|
|
380
414
|
|
|
381
|
-
Returns **[Promise][
|
|
415
|
+
Returns **[Promise][5]<any>** If a function returns a Promise It will wait for it resolution.
|
|
382
416
|
|
|
383
417
|
### fillField
|
|
384
418
|
|
|
@@ -398,8 +432,10 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
398
432
|
|
|
399
433
|
#### Parameters
|
|
400
434
|
|
|
401
|
-
- `field` **([string][4] | [object][
|
|
402
|
-
- `value` **([string][4] | [object][
|
|
435
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
436
|
+
- `value` **([string][4] | [object][6])** text value to fill.
|
|
437
|
+
|
|
438
|
+
Returns **[Promise][5]<any>**
|
|
403
439
|
|
|
404
440
|
### grabAttributeFrom
|
|
405
441
|
|
|
@@ -413,10 +449,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
413
449
|
|
|
414
450
|
#### Parameters
|
|
415
451
|
|
|
416
|
-
- `locator` **([string][4] | [object][
|
|
452
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
417
453
|
- `attr` **[string][4]** attribute name.
|
|
418
454
|
|
|
419
|
-
Returns **[Promise][
|
|
455
|
+
Returns **[Promise][5]<[string][4]>** attribute value
|
|
420
456
|
|
|
421
457
|
### grabAttributeFromAll
|
|
422
458
|
|
|
@@ -430,10 +466,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
430
466
|
|
|
431
467
|
#### Parameters
|
|
432
468
|
|
|
433
|
-
- `locator` **([string][4] | [object][
|
|
469
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
434
470
|
- `attr` **[string][4]** attribute name.
|
|
435
471
|
|
|
436
|
-
Returns **[Promise][
|
|
472
|
+
Returns **[Promise][5]<[string][4]>** attribute value
|
|
437
473
|
|
|
438
474
|
### grabBrowserLogs
|
|
439
475
|
|
|
@@ -459,7 +495,7 @@ assert(cookie.value, '123456');
|
|
|
459
495
|
|
|
460
496
|
- `name` **[string][4]?** cookie name.
|
|
461
497
|
|
|
462
|
-
Returns **([Promise][
|
|
498
|
+
Returns **([Promise][5]<[string][4]> | [Promise][5]<[Array][8]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
463
499
|
|
|
464
500
|
### grabCurrentUrl
|
|
465
501
|
|
|
@@ -471,7 +507,7 @@ let url = await I.grabCurrentUrl();
|
|
|
471
507
|
console.log(`Current URL is [${url}]`);
|
|
472
508
|
```
|
|
473
509
|
|
|
474
|
-
Returns **[Promise][
|
|
510
|
+
Returns **[Promise][5]<[string][4]>** current URL
|
|
475
511
|
|
|
476
512
|
### grabNumberOfVisibleElements
|
|
477
513
|
|
|
@@ -484,9 +520,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
484
520
|
|
|
485
521
|
#### Parameters
|
|
486
522
|
|
|
487
|
-
- `locator` **([string][4] | [object][
|
|
523
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|strict locator.
|
|
488
524
|
|
|
489
|
-
Returns **[Promise][
|
|
525
|
+
Returns **[Promise][5]<[number][9]>** number of visible elements
|
|
490
526
|
|
|
491
527
|
### grabPageScrollPosition
|
|
492
528
|
|
|
@@ -497,7 +533,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
497
533
|
let { x, y } = await I.grabPageScrollPosition();
|
|
498
534
|
```
|
|
499
535
|
|
|
500
|
-
Returns **[Promise][
|
|
536
|
+
Returns **[Promise][5]<PageScrollPosition>** scroll position
|
|
501
537
|
|
|
502
538
|
### grabSource
|
|
503
539
|
|
|
@@ -508,7 +544,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
508
544
|
let pageSource = await I.grabSource();
|
|
509
545
|
```
|
|
510
546
|
|
|
511
|
-
Returns **[Promise][
|
|
547
|
+
Returns **[Promise][5]<[string][4]>** source code
|
|
512
548
|
|
|
513
549
|
### grabTextFrom
|
|
514
550
|
|
|
@@ -523,9 +559,9 @@ If multiple elements found returns first element.
|
|
|
523
559
|
|
|
524
560
|
#### Parameters
|
|
525
561
|
|
|
526
|
-
- `locator` **([string][4] | [object][
|
|
562
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
527
563
|
|
|
528
|
-
Returns **[Promise][
|
|
564
|
+
Returns **[Promise][5]<[string][4]>** attribute value
|
|
529
565
|
|
|
530
566
|
### grabTextFromAll
|
|
531
567
|
|
|
@@ -538,9 +574,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
538
574
|
|
|
539
575
|
#### Parameters
|
|
540
576
|
|
|
541
|
-
- `locator` **([string][4] | [object][
|
|
577
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
542
578
|
|
|
543
|
-
Returns **[Promise][
|
|
579
|
+
Returns **[Promise][5]<[Array][8]<[string][4]>>** attribute value
|
|
544
580
|
|
|
545
581
|
### grabValueFrom
|
|
546
582
|
|
|
@@ -554,9 +590,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
554
590
|
|
|
555
591
|
#### Parameters
|
|
556
592
|
|
|
557
|
-
- `locator` **([string][4] | [object][
|
|
593
|
+
- `locator` **([string][4] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
558
594
|
|
|
559
|
-
Returns **[Promise][
|
|
595
|
+
Returns **[Promise][5]<[string][4]>** attribute value
|
|
560
596
|
|
|
561
597
|
### grabValueFromAll
|
|
562
598
|
|
|
@@ -569,9 +605,9 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
569
605
|
|
|
570
606
|
#### Parameters
|
|
571
607
|
|
|
572
|
-
- `locator` **([string][4] | [object][
|
|
608
|
+
- `locator` **([string][4] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
573
609
|
|
|
574
|
-
Returns **[Promise][
|
|
610
|
+
Returns **[Promise][5]<[Array][8]<[string][4]>>** attribute value
|
|
575
611
|
|
|
576
612
|
### moveCursorTo
|
|
577
613
|
|
|
@@ -585,10 +621,12 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
585
621
|
|
|
586
622
|
#### Parameters
|
|
587
623
|
|
|
588
|
-
- `locator` **([string][4] | [object][
|
|
624
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|strict locator.
|
|
589
625
|
- `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
|
|
590
626
|
- `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
|
|
591
627
|
|
|
628
|
+
Returns **[Promise][5]<any>**
|
|
629
|
+
|
|
592
630
|
### pressKey
|
|
593
631
|
|
|
594
632
|
Presses a key on a focused element.
|
|
@@ -605,6 +643,8 @@ I.pressKey(['Control','a']);
|
|
|
605
643
|
|
|
606
644
|
- `key` **([string][4] | [Array][8]<[string][4]>)** key or array of keys to press.
|
|
607
645
|
|
|
646
|
+
Returns **[Promise][5]<any>**
|
|
647
|
+
|
|
608
648
|
|
|
609
649
|
[Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
|
|
610
650
|
|
|
@@ -646,6 +686,8 @@ Reload the current page.
|
|
|
646
686
|
I.refreshPage();
|
|
647
687
|
```
|
|
648
688
|
|
|
689
|
+
Returns **[Promise][5]<any>**
|
|
690
|
+
|
|
649
691
|
### resizeWindow
|
|
650
692
|
|
|
651
693
|
Resize the current window to provided width and height.
|
|
@@ -656,6 +698,8 @@ First parameter can be set to `maximize`.
|
|
|
656
698
|
- `width` **[number][9]** width in pixels or `maximize`.
|
|
657
699
|
- `height` **[number][9]** height in pixels.
|
|
658
700
|
|
|
701
|
+
Returns **[Promise][5]<any>**
|
|
702
|
+
|
|
659
703
|
### rightClick
|
|
660
704
|
|
|
661
705
|
Performs right click on a clickable element matched by semantic locator, CSS or XPath.
|
|
@@ -671,8 +715,10 @@ I.rightClick('Click me', '.context');
|
|
|
671
715
|
|
|
672
716
|
#### Parameters
|
|
673
717
|
|
|
674
|
-
- `locator` **([string][4] | [object][
|
|
675
|
-
- `context` **([string][4]? | [object][
|
|
718
|
+
- `locator` **([string][4] | [object][6])** clickable element located by CSS|XPath|strict locator.
|
|
719
|
+
- `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
720
|
+
|
|
721
|
+
Returns **[Promise][5]<any>**
|
|
676
722
|
|
|
677
723
|
### saveElementScreenshot
|
|
678
724
|
|
|
@@ -685,9 +731,11 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
685
731
|
|
|
686
732
|
#### Parameters
|
|
687
733
|
|
|
688
|
-
- `locator` **([string][4] | [object][
|
|
734
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
689
735
|
- `fileName` **[string][4]** file name to save.
|
|
690
736
|
|
|
737
|
+
Returns **[Promise][5]<any>**
|
|
738
|
+
|
|
691
739
|
### saveScreenshot
|
|
692
740
|
|
|
693
741
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
@@ -704,6 +752,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
704
752
|
- `fileName` **[string][4]** file name to save.
|
|
705
753
|
- `fullPage` **[boolean][11]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
706
754
|
|
|
755
|
+
Returns **[Promise][5]<any>**
|
|
756
|
+
|
|
707
757
|
### scrollPageToBottom
|
|
708
758
|
|
|
709
759
|
Scroll page to the bottom.
|
|
@@ -712,6 +762,8 @@ Scroll page to the bottom.
|
|
|
712
762
|
I.scrollPageToBottom();
|
|
713
763
|
```
|
|
714
764
|
|
|
765
|
+
Returns **[Promise][5]<any>**
|
|
766
|
+
|
|
715
767
|
### scrollPageToTop
|
|
716
768
|
|
|
717
769
|
Scroll page to the top.
|
|
@@ -720,6 +772,8 @@ Scroll page to the top.
|
|
|
720
772
|
I.scrollPageToTop();
|
|
721
773
|
```
|
|
722
774
|
|
|
775
|
+
Returns **[Promise][5]<any>**
|
|
776
|
+
|
|
723
777
|
### scrollTo
|
|
724
778
|
|
|
725
779
|
Scrolls to element matched by locator.
|
|
@@ -732,10 +786,12 @@ I.scrollTo('#submit', 5, 5);
|
|
|
732
786
|
|
|
733
787
|
#### Parameters
|
|
734
788
|
|
|
735
|
-
- `locator` **([string][4] | [object][
|
|
789
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|strict locator.
|
|
736
790
|
- `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
|
|
737
791
|
- `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
|
|
738
792
|
|
|
793
|
+
Returns **[Promise][5]<any>**
|
|
794
|
+
|
|
739
795
|
### see
|
|
740
796
|
|
|
741
797
|
Checks that a page contains a visible text.
|
|
@@ -750,7 +806,9 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
750
806
|
#### Parameters
|
|
751
807
|
|
|
752
808
|
- `text` **[string][4]** expected on page.
|
|
753
|
-
- `context` **([string][4]? | [object][
|
|
809
|
+
- `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
810
|
+
|
|
811
|
+
Returns **[Promise][5]<any>**
|
|
754
812
|
|
|
755
813
|
### seeCheckboxIsChecked
|
|
756
814
|
|
|
@@ -764,7 +822,9 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
764
822
|
|
|
765
823
|
#### Parameters
|
|
766
824
|
|
|
767
|
-
- `field` **([string][4] | [object][
|
|
825
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
826
|
+
|
|
827
|
+
Returns **[Promise][5]<any>**
|
|
768
828
|
|
|
769
829
|
### seeCookie
|
|
770
830
|
|
|
@@ -778,6 +838,8 @@ I.seeCookie('Auth');
|
|
|
778
838
|
|
|
779
839
|
- `name` **[string][4]** cookie name.
|
|
780
840
|
|
|
841
|
+
Returns **[Promise][5]<any>**
|
|
842
|
+
|
|
781
843
|
### seeCurrentUrlEquals
|
|
782
844
|
|
|
783
845
|
Checks that current url is equal to provided one.
|
|
@@ -793,6 +855,8 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
793
855
|
|
|
794
856
|
- `url` **[string][4]** value to check.
|
|
795
857
|
|
|
858
|
+
Returns **[Promise][5]<any>**
|
|
859
|
+
|
|
796
860
|
### seeElement
|
|
797
861
|
|
|
798
862
|
Checks that a given Element is visible
|
|
@@ -804,7 +868,9 @@ I.seeElement('#modal');
|
|
|
804
868
|
|
|
805
869
|
#### Parameters
|
|
806
870
|
|
|
807
|
-
- `locator` **([string][4] | [object][
|
|
871
|
+
- `locator` **([string][4] | [object][6])** located by CSS|XPath|strict locator.
|
|
872
|
+
|
|
873
|
+
Returns **[Promise][5]<any>**
|
|
808
874
|
|
|
809
875
|
### seeElementInDOM
|
|
810
876
|
|
|
@@ -817,7 +883,9 @@ I.seeElementInDOM('#modal');
|
|
|
817
883
|
|
|
818
884
|
#### Parameters
|
|
819
885
|
|
|
820
|
-
- `locator` **([string][4] | [object][
|
|
886
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
887
|
+
|
|
888
|
+
Returns **[Promise][5]<any>**
|
|
821
889
|
|
|
822
890
|
### seeInCurrentUrl
|
|
823
891
|
|
|
@@ -831,6 +899,8 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
831
899
|
|
|
832
900
|
- `url` **[string][4]** a fragment to check
|
|
833
901
|
|
|
902
|
+
Returns **[Promise][5]<any>**
|
|
903
|
+
|
|
834
904
|
### seeInField
|
|
835
905
|
|
|
836
906
|
Checks that the given input field or textarea equals to given value.
|
|
@@ -845,9 +915,11 @@ I.seeInField('#searchform input','Search');
|
|
|
845
915
|
|
|
846
916
|
#### Parameters
|
|
847
917
|
|
|
848
|
-
- `field` **([string][4] | [object][
|
|
918
|
+
- `field` **([string][4] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
849
919
|
- `value` **[string][4]** value to check.
|
|
850
920
|
|
|
921
|
+
Returns **[Promise][5]<any>**
|
|
922
|
+
|
|
851
923
|
### seeInSource
|
|
852
924
|
|
|
853
925
|
Checks that the current page contains the given string in its raw source code.
|
|
@@ -860,6 +932,8 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
860
932
|
|
|
861
933
|
- `text` **[string][4]** value to check.
|
|
862
934
|
|
|
935
|
+
Returns **[Promise][5]<any>**
|
|
936
|
+
|
|
863
937
|
### seeNumberOfVisibleElements
|
|
864
938
|
|
|
865
939
|
Asserts that an element is visible a given number of times.
|
|
@@ -871,9 +945,11 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
871
945
|
|
|
872
946
|
#### Parameters
|
|
873
947
|
|
|
874
|
-
- `locator` **([string][4] | [object][
|
|
948
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
875
949
|
- `num` **[number][9]** number of elements.
|
|
876
950
|
|
|
951
|
+
Returns **[Promise][5]<any>**
|
|
952
|
+
|
|
877
953
|
### seeTextEquals
|
|
878
954
|
|
|
879
955
|
Checks that text is equal to provided one.
|
|
@@ -910,9 +986,11 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
910
986
|
|
|
911
987
|
#### Parameters
|
|
912
988
|
|
|
913
|
-
- `select` **([string][4] | [object][
|
|
989
|
+
- `select` **([string][4] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
914
990
|
- `option` **([string][4] | [Array][8]<any>)** visible text or value of option.
|
|
915
991
|
|
|
992
|
+
Returns **[Promise][5]<any>**
|
|
993
|
+
|
|
916
994
|
### setCookie
|
|
917
995
|
|
|
918
996
|
Sets cookie(s).
|
|
@@ -933,6 +1011,8 @@ I.setCookie([
|
|
|
933
1011
|
|
|
934
1012
|
- `cookie` **(Cookie | [Array][8]<Cookie>)** a cookie object or array of cookie objects.
|
|
935
1013
|
|
|
1014
|
+
Returns **[Promise][5]<any>**
|
|
1015
|
+
|
|
936
1016
|
### switchTo
|
|
937
1017
|
|
|
938
1018
|
Switches frame or in case of null locator reverts to parent.
|
|
@@ -944,7 +1024,9 @@ I.switchTo(); // switch back to main page
|
|
|
944
1024
|
|
|
945
1025
|
#### Parameters
|
|
946
1026
|
|
|
947
|
-
- `locator` **([string][4]? | [object][
|
|
1027
|
+
- `locator` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1028
|
+
|
|
1029
|
+
Returns **[Promise][5]<any>**
|
|
948
1030
|
|
|
949
1031
|
### uncheckOption
|
|
950
1032
|
|
|
@@ -961,8 +1043,10 @@ I.uncheckOption('agree', '//form');
|
|
|
961
1043
|
|
|
962
1044
|
#### Parameters
|
|
963
1045
|
|
|
964
|
-
- `field` **([string][4] | [object][
|
|
965
|
-
- `context` **([string][4]? | [object][
|
|
1046
|
+
- `field` **([string][4] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1047
|
+
- `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1048
|
+
|
|
1049
|
+
Returns **[Promise][5]<any>**
|
|
966
1050
|
|
|
967
1051
|
### useTestCafeTo
|
|
968
1052
|
|
|
@@ -982,7 +1066,7 @@ I.useTestCafeTo('handle browser dialog', async ({ t }) {
|
|
|
982
1066
|
#### Parameters
|
|
983
1067
|
|
|
984
1068
|
- `description` **[string][4]** used to show in logs.
|
|
985
|
-
- `fn` **[function][
|
|
1069
|
+
- `fn` **[function][7]** async functuion that executed with TestCafe helper as argument
|
|
986
1070
|
|
|
987
1071
|
### wait
|
|
988
1072
|
|
|
@@ -996,6 +1080,8 @@ I.wait(2); // wait 2 secs
|
|
|
996
1080
|
|
|
997
1081
|
- `sec` **[number][9]** number of second to wait.
|
|
998
1082
|
|
|
1083
|
+
Returns **[Promise][5]<any>**
|
|
1084
|
+
|
|
999
1085
|
### waitForElement
|
|
1000
1086
|
|
|
1001
1087
|
Waits for element to be present on page (by default waits for 1sec).
|
|
@@ -1008,9 +1094,11 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1008
1094
|
|
|
1009
1095
|
#### Parameters
|
|
1010
1096
|
|
|
1011
|
-
- `locator` **([string][4] | [object][
|
|
1097
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1012
1098
|
- `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
|
|
1013
1099
|
|
|
1100
|
+
Returns **[Promise][5]<any>**
|
|
1101
|
+
|
|
1014
1102
|
### waitForFunction
|
|
1015
1103
|
|
|
1016
1104
|
Waits for a function to return true (waits for 1 sec by default).
|
|
@@ -1028,10 +1116,12 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1028
1116
|
|
|
1029
1117
|
#### Parameters
|
|
1030
1118
|
|
|
1031
|
-
- `fn` **([string][4] | [function][
|
|
1119
|
+
- `fn` **([string][4] | [function][7])** to be executed in browser context.
|
|
1032
1120
|
- `argsOrSec` **([Array][8]<any> | [number][9])?** (optional, `1` by default) arguments for function or seconds.
|
|
1033
1121
|
- `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
|
|
1034
1122
|
|
|
1123
|
+
Returns **[Promise][5]<any>**
|
|
1124
|
+
|
|
1035
1125
|
### waitForInvisible
|
|
1036
1126
|
|
|
1037
1127
|
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
@@ -1043,9 +1133,11 @@ I.waitForInvisible('#popup');
|
|
|
1043
1133
|
|
|
1044
1134
|
#### Parameters
|
|
1045
1135
|
|
|
1046
|
-
- `locator` **([string][4] | [object][
|
|
1136
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1047
1137
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1048
1138
|
|
|
1139
|
+
Returns **[Promise][5]<any>**
|
|
1140
|
+
|
|
1049
1141
|
### waitForText
|
|
1050
1142
|
|
|
1051
1143
|
Waits for a text to appear (by default waits for 1sec).
|
|
@@ -1061,7 +1153,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1061
1153
|
|
|
1062
1154
|
- `text` **[string][4]** to wait for.
|
|
1063
1155
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1064
|
-
- `context` **([string][4] | [object][
|
|
1156
|
+
- `context` **([string][4] | [object][6])?** (optional) element located by CSS|XPath|strict locator.
|
|
1157
|
+
|
|
1158
|
+
Returns **[Promise][5]<any>**
|
|
1065
1159
|
|
|
1066
1160
|
### waitForVisible
|
|
1067
1161
|
|
|
@@ -1074,9 +1168,11 @@ I.waitForVisible('#popup');
|
|
|
1074
1168
|
|
|
1075
1169
|
#### Parameters
|
|
1076
1170
|
|
|
1077
|
-
- `locator` **([string][4] | [object][
|
|
1171
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1078
1172
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1079
1173
|
|
|
1174
|
+
Returns **[Promise][5]<any>**
|
|
1175
|
+
|
|
1080
1176
|
### waitInUrl
|
|
1081
1177
|
|
|
1082
1178
|
Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
@@ -1090,6 +1186,8 @@ I.waitInUrl('/info', 2);
|
|
|
1090
1186
|
- `urlPart` **[string][4]** value to check.
|
|
1091
1187
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1092
1188
|
|
|
1189
|
+
Returns **[Promise][5]<any>**
|
|
1190
|
+
|
|
1093
1191
|
### waitNumberOfVisibleElements
|
|
1094
1192
|
|
|
1095
1193
|
Waits for a specified number of elements on the page.
|
|
@@ -1100,10 +1198,12 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1100
1198
|
|
|
1101
1199
|
#### Parameters
|
|
1102
1200
|
|
|
1103
|
-
- `locator` **([string][4] | [object][
|
|
1201
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1104
1202
|
- `num` **[number][9]** number of elements.
|
|
1105
1203
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1106
1204
|
|
|
1205
|
+
Returns **[Promise][5]<any>**
|
|
1206
|
+
|
|
1107
1207
|
### waitToHide
|
|
1108
1208
|
|
|
1109
1209
|
Waits for an element to hide (by default waits for 1sec).
|
|
@@ -1115,9 +1215,11 @@ I.waitToHide('#popup');
|
|
|
1115
1215
|
|
|
1116
1216
|
#### Parameters
|
|
1117
1217
|
|
|
1118
|
-
- `locator` **([string][4] | [object][
|
|
1218
|
+
- `locator` **([string][4] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1119
1219
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1120
1220
|
|
|
1221
|
+
Returns **[Promise][5]<any>**
|
|
1222
|
+
|
|
1121
1223
|
### waitUrlEquals
|
|
1122
1224
|
|
|
1123
1225
|
Waits for the entire URL to match the expected
|
|
@@ -1132,6 +1234,8 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1132
1234
|
- `urlPart` **[string][4]** value to check.
|
|
1133
1235
|
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1134
1236
|
|
|
1237
|
+
Returns **[Promise][5]<any>**
|
|
1238
|
+
|
|
1135
1239
|
## getPageUrl
|
|
1136
1240
|
|
|
1137
1241
|
Client Functions
|
|
@@ -1148,11 +1252,11 @@ Client Functions
|
|
|
1148
1252
|
|
|
1149
1253
|
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1150
1254
|
|
|
1151
|
-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1255
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1152
1256
|
|
|
1153
|
-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1257
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1154
1258
|
|
|
1155
|
-
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1259
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1156
1260
|
|
|
1157
1261
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1158
1262
|
|