codeceptjs 3.3.0 → 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 +39 -1
- package/README.md +26 -0
- package/docs/api.md +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +26 -11
- 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 +52 -23
- package/docs/build/Playwright.js +126 -48
- package/docs/build/Protractor.js +70 -32
- package/docs/build/Puppeteer.js +78 -35
- package/docs/build/REST.js +4 -1
- package/docs/build/TestCafe.js +53 -22
- package/docs/build/WebDriver.js +115 -65
- package/docs/changelog.md +39 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- 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/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/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 +3 -3
- package/typings/types.d.ts +558 -607
|
@@ -279,6 +279,8 @@ I.amOnPage('/login'); // opens a login page
|
|
|
279
279
|
|
|
280
280
|
- `url` **[string][8]** url path or global url.
|
|
281
281
|
|
|
282
|
+
Returns **[Promise][9]<any>**
|
|
283
|
+
|
|
282
284
|
### appendField
|
|
283
285
|
|
|
284
286
|
Appends text to a input field or textarea.
|
|
@@ -293,6 +295,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
293
295
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator
|
|
294
296
|
- `value` **[string][8]** text value to append.
|
|
295
297
|
|
|
298
|
+
Returns **[Promise][9]<any>**
|
|
299
|
+
|
|
296
300
|
|
|
297
301
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
298
302
|
|
|
@@ -311,7 +315,9 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
311
315
|
#### Parameters
|
|
312
316
|
|
|
313
317
|
- `locator` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
314
|
-
- `pathToFile` **[string][8]** local file path relative to codecept.json config file
|
|
318
|
+
- `pathToFile` **[string][8]** local file path relative to codecept.json config file.
|
|
319
|
+
|
|
320
|
+
Returns **[Promise][9]<any>** > ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1][10], downgrade to 2.0.0 if you face it.
|
|
315
321
|
|
|
316
322
|
### cancelPopup
|
|
317
323
|
|
|
@@ -335,6 +341,8 @@ I.checkOption('agree', '//form');
|
|
|
335
341
|
- `field` **([string][8] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
336
342
|
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
337
343
|
|
|
344
|
+
Returns **[Promise][9]<any>**
|
|
345
|
+
|
|
338
346
|
### clearCookie
|
|
339
347
|
|
|
340
348
|
Clears a cookie by name,
|
|
@@ -350,6 +358,8 @@ I.clearCookie('test');
|
|
|
350
358
|
- `name`
|
|
351
359
|
- `cookie` **[string][8]?** (optional, `null` by default) cookie name
|
|
352
360
|
|
|
361
|
+
Returns **[Promise][9]<any>**
|
|
362
|
+
|
|
353
363
|
### clearField
|
|
354
364
|
|
|
355
365
|
Clears a `<textarea>` or text `<input>` element's value.
|
|
@@ -365,6 +375,8 @@ I.clearField('#email');
|
|
|
365
375
|
- `field`
|
|
366
376
|
- `editable` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
367
377
|
|
|
378
|
+
Returns **[Promise][9]<any>**
|
|
379
|
+
|
|
368
380
|
### click
|
|
369
381
|
|
|
370
382
|
Perform a click on a link or a button, given by a locator.
|
|
@@ -392,11 +404,13 @@ I.click({css: 'nav a.login'});
|
|
|
392
404
|
#### Parameters
|
|
393
405
|
|
|
394
406
|
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
395
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
407
|
+
- `context` **([string][8]? | [object][6] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
408
|
+
|
|
409
|
+
Returns **[Promise][9]<any>**
|
|
396
410
|
|
|
397
411
|
|
|
398
412
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
399
|
-
|
|
413
|
+
|
|
400
414
|
|
|
401
415
|
### clickLink
|
|
402
416
|
|
|
@@ -409,11 +423,13 @@ I.clickLink('Logout', '#nav');
|
|
|
409
423
|
#### Parameters
|
|
410
424
|
|
|
411
425
|
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
412
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
426
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
427
|
+
|
|
428
|
+
Returns **[Promise][9]<any>**
|
|
413
429
|
|
|
414
430
|
|
|
415
431
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
416
|
-
|
|
432
|
+
|
|
417
433
|
|
|
418
434
|
### closeCurrentTab
|
|
419
435
|
|
|
@@ -444,11 +460,13 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
444
460
|
#### Parameters
|
|
445
461
|
|
|
446
462
|
- `text` **[string][8]** which is not present.
|
|
447
|
-
- `context` **([string][8] | [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
463
|
+
- `context` **([string][8] | [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
464
|
+
|
|
465
|
+
Returns **[Promise][9]<any>**
|
|
448
466
|
|
|
449
467
|
|
|
450
468
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
451
|
-
|
|
469
|
+
|
|
452
470
|
|
|
453
471
|
### dontSeeCheckboxIsChecked
|
|
454
472
|
|
|
@@ -464,6 +482,8 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
464
482
|
|
|
465
483
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
466
484
|
|
|
485
|
+
Returns **[Promise][9]<any>**
|
|
486
|
+
|
|
467
487
|
### dontSeeCookie
|
|
468
488
|
|
|
469
489
|
Checks that cookie with given name does not exist.
|
|
@@ -476,6 +496,8 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
476
496
|
|
|
477
497
|
- `name` **[string][8]** cookie name.
|
|
478
498
|
|
|
499
|
+
Returns **[Promise][9]<any>**
|
|
500
|
+
|
|
479
501
|
### dontSeeCurrentUrlEquals
|
|
480
502
|
|
|
481
503
|
Checks that current url is not equal to provided one.
|
|
@@ -490,6 +512,8 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
490
512
|
|
|
491
513
|
- `url` **[string][8]** value to check.
|
|
492
514
|
|
|
515
|
+
Returns **[Promise][9]<any>**
|
|
516
|
+
|
|
493
517
|
### dontSeeElement
|
|
494
518
|
|
|
495
519
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
@@ -501,7 +525,8 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
501
525
|
#### Parameters
|
|
502
526
|
|
|
503
527
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|Strict locator.
|
|
504
|
-
|
|
528
|
+
|
|
529
|
+
Returns **[Promise][9]<any>**
|
|
505
530
|
|
|
506
531
|
|
|
507
532
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -519,6 +544,8 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
519
544
|
|
|
520
545
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|Strict locator.
|
|
521
546
|
|
|
547
|
+
Returns **[Promise][9]<any>**
|
|
548
|
+
|
|
522
549
|
### dontSeeInCurrentUrl
|
|
523
550
|
|
|
524
551
|
Checks that current url does not contain a provided fragment.
|
|
@@ -527,6 +554,8 @@ Checks that current url does not contain a provided fragment.
|
|
|
527
554
|
|
|
528
555
|
- `url` **[string][8]** value to check.
|
|
529
556
|
|
|
557
|
+
Returns **[Promise][9]<any>**
|
|
558
|
+
|
|
530
559
|
### dontSeeInField
|
|
531
560
|
|
|
532
561
|
Checks that value of input field or textarea doesn't equal to given value
|
|
@@ -542,6 +571,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
542
571
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
543
572
|
- `value` **[string][8]** value to check.
|
|
544
573
|
|
|
574
|
+
Returns **[Promise][9]<any>**
|
|
575
|
+
|
|
545
576
|
### dontSeeInSource
|
|
546
577
|
|
|
547
578
|
Checks that the current page does not contains the given string in its raw source code.
|
|
@@ -555,6 +586,8 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
555
586
|
- `text`
|
|
556
587
|
- `value` **[string][8]** to check.
|
|
557
588
|
|
|
589
|
+
Returns **[Promise][9]<any>**
|
|
590
|
+
|
|
558
591
|
### dontSeeInTitle
|
|
559
592
|
|
|
560
593
|
Checks that title does not contain text.
|
|
@@ -567,6 +600,8 @@ I.dontSeeInTitle('Error');
|
|
|
567
600
|
|
|
568
601
|
- `text` **[string][8]** value to check.
|
|
569
602
|
|
|
603
|
+
Returns **[Promise][9]<any>**
|
|
604
|
+
|
|
570
605
|
### doubleClick
|
|
571
606
|
|
|
572
607
|
Performs a double-click on an element matched by link|button|label|CSS or XPath.
|
|
@@ -582,11 +617,13 @@ I.doubleClick('.btn.edit');
|
|
|
582
617
|
#### Parameters
|
|
583
618
|
|
|
584
619
|
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
585
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
620
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
621
|
+
|
|
622
|
+
Returns **[Promise][9]<any>**
|
|
586
623
|
|
|
587
624
|
|
|
588
625
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
589
|
-
|
|
626
|
+
|
|
590
627
|
|
|
591
628
|
### downloadFile
|
|
592
629
|
|
|
@@ -612,6 +649,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
612
649
|
- `srcElement` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
613
650
|
- `destElement` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
614
651
|
|
|
652
|
+
Returns **[Promise][9]<any>**
|
|
653
|
+
|
|
615
654
|
### dragSlider
|
|
616
655
|
|
|
617
656
|
Drag the scrubber of a slider to a given position
|
|
@@ -625,19 +664,20 @@ I.dragSlider('#slider', -70);
|
|
|
625
664
|
#### Parameters
|
|
626
665
|
|
|
627
666
|
- `locator` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
628
|
-
- `offsetX` **[number][
|
|
629
|
-
|
|
667
|
+
- `offsetX` **[number][11]** position to drag.
|
|
668
|
+
|
|
669
|
+
Returns **[Promise][9]<any>**
|
|
630
670
|
|
|
631
671
|
|
|
632
672
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
633
|
-
|
|
673
|
+
|
|
634
674
|
|
|
635
675
|
### executeAsyncScript
|
|
636
676
|
|
|
637
677
|
Executes async script on page.
|
|
638
678
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
639
679
|
|
|
640
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
680
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][12].
|
|
641
681
|
|
|
642
682
|
```js
|
|
643
683
|
I.executeAsyncScript(function(done) {
|
|
@@ -658,9 +698,9 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
658
698
|
#### Parameters
|
|
659
699
|
|
|
660
700
|
- `args` **...any** to be passed to function.
|
|
661
|
-
- `fn` **([string][8] | [function][
|
|
701
|
+
- `fn` **([string][8] | [function][13])** function to be executed in browser context.
|
|
662
702
|
|
|
663
|
-
Returns **[Promise][
|
|
703
|
+
Returns **[Promise][9]<any>** Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
664
704
|
|
|
665
705
|
### executeScript
|
|
666
706
|
|
|
@@ -691,9 +731,9 @@ let date = await I.executeScript(function(el) {
|
|
|
691
731
|
#### Parameters
|
|
692
732
|
|
|
693
733
|
- `args` **...any** to be passed to function.
|
|
694
|
-
- `fn` **([string][8] | [function][
|
|
734
|
+
- `fn` **([string][8] | [function][13])** function to be executed in browser context.
|
|
695
735
|
|
|
696
|
-
Returns **[Promise][
|
|
736
|
+
Returns **[Promise][9]<any>** If a function returns a Promise It will wait for it resolution.
|
|
697
737
|
|
|
698
738
|
### fillField
|
|
699
739
|
|
|
@@ -716,6 +756,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
716
756
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
717
757
|
- `value` **([string][8] | [object][6])** text value to fill.
|
|
718
758
|
|
|
759
|
+
Returns **[Promise][9]<any>**
|
|
760
|
+
|
|
719
761
|
|
|
720
762
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
721
763
|
|
|
@@ -750,11 +792,13 @@ I.forceClick({css: 'nav a.login'});
|
|
|
750
792
|
#### Parameters
|
|
751
793
|
|
|
752
794
|
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
753
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
795
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
796
|
+
|
|
797
|
+
Returns **[Promise][9]<any>**
|
|
754
798
|
|
|
755
799
|
|
|
756
800
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
757
|
-
|
|
801
|
+
|
|
758
802
|
|
|
759
803
|
### grabAttributeFrom
|
|
760
804
|
|
|
@@ -771,7 +815,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
771
815
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
772
816
|
- `attr` **[string][8]** attribute name.
|
|
773
817
|
|
|
774
|
-
Returns **[Promise][
|
|
818
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
775
819
|
|
|
776
820
|
|
|
777
821
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -791,7 +835,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
791
835
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
792
836
|
- `attr` **[string][8]** attribute name.
|
|
793
837
|
|
|
794
|
-
Returns **[Promise][
|
|
838
|
+
Returns **[Promise][9]<[Array][14]<[string][8]>>** attribute value
|
|
795
839
|
|
|
796
840
|
|
|
797
841
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -806,7 +850,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
806
850
|
console.log(JSON.stringify(logs))
|
|
807
851
|
```
|
|
808
852
|
|
|
809
|
-
Returns **[Promise][
|
|
853
|
+
Returns **[Promise][9]<[Array][14]<any>>**
|
|
810
854
|
|
|
811
855
|
### grabCookie
|
|
812
856
|
|
|
@@ -823,7 +867,7 @@ assert(cookie.value, '123456');
|
|
|
823
867
|
|
|
824
868
|
- `name` **[string][8]?** cookie name.
|
|
825
869
|
|
|
826
|
-
Returns **([Promise][
|
|
870
|
+
Returns **([Promise][9]<[string][8]> | [Promise][9]<[Array][14]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
827
871
|
|
|
828
872
|
### grabCssPropertyFrom
|
|
829
873
|
|
|
@@ -840,7 +884,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
840
884
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
841
885
|
- `cssProperty` **[string][8]** CSS property name.
|
|
842
886
|
|
|
843
|
-
Returns **[Promise][
|
|
887
|
+
Returns **[Promise][9]<[string][8]>** CSS value
|
|
844
888
|
|
|
845
889
|
|
|
846
890
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -860,7 +904,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
860
904
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
861
905
|
- `cssProperty` **[string][8]** CSS property name.
|
|
862
906
|
|
|
863
|
-
Returns **[Promise][
|
|
907
|
+
Returns **[Promise][9]<[Array][14]<[string][8]>>** CSS value
|
|
864
908
|
|
|
865
909
|
|
|
866
910
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -876,7 +920,7 @@ let url = await I.grabCurrentUrl();
|
|
|
876
920
|
console.log(`Current URL is [${url}]`);
|
|
877
921
|
```
|
|
878
922
|
|
|
879
|
-
Returns **[Promise][
|
|
923
|
+
Returns **[Promise][9]<[string][8]>** current URL
|
|
880
924
|
|
|
881
925
|
### grabDataFromPerformanceTiming
|
|
882
926
|
|
|
@@ -901,6 +945,8 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
901
945
|
}
|
|
902
946
|
```
|
|
903
947
|
|
|
948
|
+
Returns **[Promise][9]<any>**
|
|
949
|
+
|
|
904
950
|
### grabElementBoundingRect
|
|
905
951
|
|
|
906
952
|
Grab the width, height, location of given locator.
|
|
@@ -927,7 +973,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
927
973
|
- `prop`
|
|
928
974
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
929
975
|
|
|
930
|
-
Returns **([Promise][
|
|
976
|
+
Returns **([Promise][9]<DOMRect> | [Promise][9]<[number][11]>)** Element bounding rectangle
|
|
931
977
|
|
|
932
978
|
### grabHTMLFrom
|
|
933
979
|
|
|
@@ -944,7 +990,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
944
990
|
- `locator`
|
|
945
991
|
- `element` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
946
992
|
|
|
947
|
-
Returns **[Promise][
|
|
993
|
+
Returns **[Promise][9]<[string][8]>** HTML code for an element
|
|
948
994
|
|
|
949
995
|
### grabHTMLFromAll
|
|
950
996
|
|
|
@@ -960,7 +1006,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
960
1006
|
- `locator`
|
|
961
1007
|
- `element` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
962
1008
|
|
|
963
|
-
Returns **[Promise][
|
|
1009
|
+
Returns **[Promise][9]<[Array][14]<[string][8]>>** HTML code for an element
|
|
964
1010
|
|
|
965
1011
|
### grabNumberOfOpenTabs
|
|
966
1012
|
|
|
@@ -971,7 +1017,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
971
1017
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
972
1018
|
```
|
|
973
1019
|
|
|
974
|
-
Returns **[Promise][
|
|
1020
|
+
Returns **[Promise][9]<[number][11]>** number of open tabs
|
|
975
1021
|
|
|
976
1022
|
### grabNumberOfVisibleElements
|
|
977
1023
|
|
|
@@ -986,7 +1032,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
986
1032
|
|
|
987
1033
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
988
1034
|
|
|
989
|
-
Returns **[Promise][
|
|
1035
|
+
Returns **[Promise][9]<[number][11]>** number of visible elements
|
|
990
1036
|
|
|
991
1037
|
|
|
992
1038
|
|
|
@@ -1002,7 +1048,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1002
1048
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1003
1049
|
```
|
|
1004
1050
|
|
|
1005
|
-
Returns **[Promise][
|
|
1051
|
+
Returns **[Promise][9]<PageScrollPosition>** scroll position
|
|
1006
1052
|
|
|
1007
1053
|
### grabPopupText
|
|
1008
1054
|
|
|
@@ -1012,7 +1058,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1012
1058
|
await I.grabPopupText();
|
|
1013
1059
|
```
|
|
1014
1060
|
|
|
1015
|
-
Returns **[Promise][
|
|
1061
|
+
Returns **[Promise][9]<([string][8] | null)>**
|
|
1016
1062
|
|
|
1017
1063
|
### grabSource
|
|
1018
1064
|
|
|
@@ -1023,7 +1069,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1023
1069
|
let pageSource = await I.grabSource();
|
|
1024
1070
|
```
|
|
1025
1071
|
|
|
1026
|
-
Returns **[Promise][
|
|
1072
|
+
Returns **[Promise][9]<[string][8]>** source code
|
|
1027
1073
|
|
|
1028
1074
|
### grabTextFrom
|
|
1029
1075
|
|
|
@@ -1040,7 +1086,7 @@ If multiple elements found returns first element.
|
|
|
1040
1086
|
|
|
1041
1087
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1042
1088
|
|
|
1043
|
-
Returns **[Promise][
|
|
1089
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
1044
1090
|
|
|
1045
1091
|
|
|
1046
1092
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1059,7 +1105,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1059
1105
|
|
|
1060
1106
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1061
1107
|
|
|
1062
|
-
Returns **[Promise][
|
|
1108
|
+
Returns **[Promise][9]<[Array][14]<[string][8]>>** attribute value
|
|
1063
1109
|
|
|
1064
1110
|
|
|
1065
1111
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1074,7 +1120,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1074
1120
|
let title = await I.grabTitle();
|
|
1075
1121
|
```
|
|
1076
1122
|
|
|
1077
|
-
Returns **[Promise][
|
|
1123
|
+
Returns **[Promise][9]<[string][8]>** title
|
|
1078
1124
|
|
|
1079
1125
|
### grabValueFrom
|
|
1080
1126
|
|
|
@@ -1090,7 +1136,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1090
1136
|
|
|
1091
1137
|
- `locator` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1092
1138
|
|
|
1093
|
-
Returns **[Promise][
|
|
1139
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
1094
1140
|
|
|
1095
1141
|
### grabValueFromAll
|
|
1096
1142
|
|
|
@@ -1105,7 +1151,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1105
1151
|
|
|
1106
1152
|
- `locator` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1107
1153
|
|
|
1108
|
-
Returns **[Promise][
|
|
1154
|
+
Returns **[Promise][9]<[Array][14]<[string][8]>>** attribute value
|
|
1109
1155
|
|
|
1110
1156
|
### handleDownloads
|
|
1111
1157
|
|
|
@@ -1153,12 +1199,14 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1153
1199
|
#### Parameters
|
|
1154
1200
|
|
|
1155
1201
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1156
|
-
- `offsetX` **[number][
|
|
1157
|
-
- `offsetY` **[number][
|
|
1202
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1203
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1204
|
+
|
|
1205
|
+
Returns **[Promise][9]<any>**
|
|
1158
1206
|
|
|
1159
1207
|
|
|
1160
1208
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
1161
|
-
|
|
1209
|
+
|
|
1162
1210
|
|
|
1163
1211
|
### openNewTab
|
|
1164
1212
|
|
|
@@ -1231,7 +1279,9 @@ Some of the supported key names are:
|
|
|
1231
1279
|
|
|
1232
1280
|
#### Parameters
|
|
1233
1281
|
|
|
1234
|
-
- `key` **([string][8] | [Array][14]<[string][8]>)** key or array of keys to press.
|
|
1282
|
+
- `key` **([string][8] | [Array][14]<[string][8]>)** key or array of keys to press.
|
|
1283
|
+
|
|
1284
|
+
Returns **[Promise][9]<any>** _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313][17]).
|
|
1235
1285
|
|
|
1236
1286
|
### pressKeyDown
|
|
1237
1287
|
|
|
@@ -1249,6 +1299,8 @@ I.pressKeyUp('Control');
|
|
|
1249
1299
|
|
|
1250
1300
|
- `key` **[string][8]** name of key to press down.
|
|
1251
1301
|
|
|
1302
|
+
Returns **[Promise][9]<any>**
|
|
1303
|
+
|
|
1252
1304
|
### pressKeyUp
|
|
1253
1305
|
|
|
1254
1306
|
Releases a key in the browser which was previously set to a down state.
|
|
@@ -1265,6 +1317,8 @@ I.pressKeyUp('Control');
|
|
|
1265
1317
|
|
|
1266
1318
|
- `key` **[string][8]** name of key to release.
|
|
1267
1319
|
|
|
1320
|
+
Returns **[Promise][9]<any>**
|
|
1321
|
+
|
|
1268
1322
|
### refreshPage
|
|
1269
1323
|
|
|
1270
1324
|
Reload the current page.
|
|
@@ -1273,6 +1327,8 @@ Reload the current page.
|
|
|
1273
1327
|
I.refreshPage();
|
|
1274
1328
|
```
|
|
1275
1329
|
|
|
1330
|
+
Returns **[Promise][9]<any>**
|
|
1331
|
+
|
|
1276
1332
|
### resizeWindow
|
|
1277
1333
|
|
|
1278
1334
|
Resize the current window to provided width and height.
|
|
@@ -1280,10 +1336,12 @@ First parameter can be set to `maximize`.
|
|
|
1280
1336
|
|
|
1281
1337
|
#### Parameters
|
|
1282
1338
|
|
|
1283
|
-
- `width` **[number][
|
|
1284
|
-
- `height` **[number][
|
|
1285
|
-
|
|
1286
|
-
|
|
1339
|
+
- `width` **[number][11]** width in pixels or `maximize`.
|
|
1340
|
+
- `height` **[number][11]** height in pixels.
|
|
1341
|
+
|
|
1342
|
+
Returns **[Promise][9]<any>** Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
1343
|
+
Puppeteer does not control the window of a browser so it can't adjust its real size.
|
|
1344
|
+
It also can't maximize a window.
|
|
1287
1345
|
|
|
1288
1346
|
### rightClick
|
|
1289
1347
|
|
|
@@ -1301,11 +1359,13 @@ I.rightClick('Click me', '.context');
|
|
|
1301
1359
|
#### Parameters
|
|
1302
1360
|
|
|
1303
1361
|
- `locator` **([string][8] | [object][6])** clickable element located by CSS|XPath|strict locator.
|
|
1304
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1362
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1363
|
+
|
|
1364
|
+
Returns **[Promise][9]<any>**
|
|
1305
1365
|
|
|
1306
1366
|
|
|
1307
1367
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
1308
|
-
|
|
1368
|
+
|
|
1309
1369
|
|
|
1310
1370
|
### saveElementScreenshot
|
|
1311
1371
|
|
|
@@ -1321,6 +1381,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1321
1381
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1322
1382
|
- `fileName` **[string][8]** file name to save.
|
|
1323
1383
|
|
|
1384
|
+
Returns **[Promise][9]<any>**
|
|
1385
|
+
|
|
1324
1386
|
### saveScreenshot
|
|
1325
1387
|
|
|
1326
1388
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
@@ -1337,6 +1399,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1337
1399
|
- `fileName` **[string][8]** file name to save.
|
|
1338
1400
|
- `fullPage` **[boolean][19]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1339
1401
|
|
|
1402
|
+
Returns **[Promise][9]<any>**
|
|
1403
|
+
|
|
1340
1404
|
### scrollPageToBottom
|
|
1341
1405
|
|
|
1342
1406
|
Scroll page to the bottom.
|
|
@@ -1345,6 +1409,8 @@ Scroll page to the bottom.
|
|
|
1345
1409
|
I.scrollPageToBottom();
|
|
1346
1410
|
```
|
|
1347
1411
|
|
|
1412
|
+
Returns **[Promise][9]<any>**
|
|
1413
|
+
|
|
1348
1414
|
### scrollPageToTop
|
|
1349
1415
|
|
|
1350
1416
|
Scroll page to the top.
|
|
@@ -1353,6 +1419,8 @@ Scroll page to the top.
|
|
|
1353
1419
|
I.scrollPageToTop();
|
|
1354
1420
|
```
|
|
1355
1421
|
|
|
1422
|
+
Returns **[Promise][9]<any>**
|
|
1423
|
+
|
|
1356
1424
|
### scrollTo
|
|
1357
1425
|
|
|
1358
1426
|
Scrolls to element matched by locator.
|
|
@@ -1366,8 +1434,10 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1366
1434
|
#### Parameters
|
|
1367
1435
|
|
|
1368
1436
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1369
|
-
- `offsetX` **[number][
|
|
1370
|
-
- `offsetY` **[number][
|
|
1437
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1438
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1439
|
+
|
|
1440
|
+
Returns **[Promise][9]<any>**
|
|
1371
1441
|
|
|
1372
1442
|
### see
|
|
1373
1443
|
|
|
@@ -1383,11 +1453,13 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1383
1453
|
#### Parameters
|
|
1384
1454
|
|
|
1385
1455
|
- `text` **[string][8]** expected on page.
|
|
1386
|
-
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1456
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1457
|
+
|
|
1458
|
+
Returns **[Promise][9]<any>**
|
|
1387
1459
|
|
|
1388
1460
|
|
|
1389
1461
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
1390
|
-
|
|
1462
|
+
|
|
1391
1463
|
|
|
1392
1464
|
### seeAttributesOnElements
|
|
1393
1465
|
|
|
@@ -1401,7 +1473,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1401
1473
|
|
|
1402
1474
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1403
1475
|
- `attributes` **[object][6]** attributes and their values to check.
|
|
1404
|
-
|
|
1476
|
+
|
|
1477
|
+
Returns **[Promise][9]<any>**
|
|
1405
1478
|
|
|
1406
1479
|
|
|
1407
1480
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1421,6 +1494,8 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1421
1494
|
|
|
1422
1495
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1423
1496
|
|
|
1497
|
+
Returns **[Promise][9]<any>**
|
|
1498
|
+
|
|
1424
1499
|
### seeCookie
|
|
1425
1500
|
|
|
1426
1501
|
Checks that cookie with given name exists.
|
|
@@ -1433,6 +1508,8 @@ I.seeCookie('Auth');
|
|
|
1433
1508
|
|
|
1434
1509
|
- `name` **[string][8]** cookie name.
|
|
1435
1510
|
|
|
1511
|
+
Returns **[Promise][9]<any>**
|
|
1512
|
+
|
|
1436
1513
|
### seeCssPropertiesOnElements
|
|
1437
1514
|
|
|
1438
1515
|
Checks that all elements with given locator have given CSS properties.
|
|
@@ -1445,7 +1522,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1445
1522
|
|
|
1446
1523
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1447
1524
|
- `cssProperties` **[object][6]** object with CSS properties and their values to check.
|
|
1448
|
-
|
|
1525
|
+
|
|
1526
|
+
Returns **[Promise][9]<any>**
|
|
1449
1527
|
|
|
1450
1528
|
|
|
1451
1529
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1466,6 +1544,8 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1466
1544
|
|
|
1467
1545
|
- `url` **[string][8]** value to check.
|
|
1468
1546
|
|
|
1547
|
+
Returns **[Promise][9]<any>**
|
|
1548
|
+
|
|
1469
1549
|
### seeElement
|
|
1470
1550
|
|
|
1471
1551
|
Checks that a given Element is visible
|
|
@@ -1478,7 +1558,8 @@ I.seeElement('#modal');
|
|
|
1478
1558
|
#### Parameters
|
|
1479
1559
|
|
|
1480
1560
|
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1481
|
-
|
|
1561
|
+
|
|
1562
|
+
Returns **[Promise][9]<any>**
|
|
1482
1563
|
|
|
1483
1564
|
|
|
1484
1565
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1497,6 +1578,8 @@ I.seeElementInDOM('#modal');
|
|
|
1497
1578
|
|
|
1498
1579
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1499
1580
|
|
|
1581
|
+
Returns **[Promise][9]<any>**
|
|
1582
|
+
|
|
1500
1583
|
### seeInCurrentUrl
|
|
1501
1584
|
|
|
1502
1585
|
Checks that current url contains a provided fragment.
|
|
@@ -1509,6 +1592,8 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1509
1592
|
|
|
1510
1593
|
- `url` **[string][8]** a fragment to check
|
|
1511
1594
|
|
|
1595
|
+
Returns **[Promise][9]<any>**
|
|
1596
|
+
|
|
1512
1597
|
### seeInField
|
|
1513
1598
|
|
|
1514
1599
|
Checks that the given input field or textarea equals to given value.
|
|
@@ -1526,6 +1611,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1526
1611
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1527
1612
|
- `value` **[string][8]** value to check.
|
|
1528
1613
|
|
|
1614
|
+
Returns **[Promise][9]<any>**
|
|
1615
|
+
|
|
1529
1616
|
### seeInPopup
|
|
1530
1617
|
|
|
1531
1618
|
Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the
|
|
@@ -1539,6 +1626,8 @@ I.seeInPopup('Popup text');
|
|
|
1539
1626
|
|
|
1540
1627
|
- `text` **[string][8]** value to check.
|
|
1541
1628
|
|
|
1629
|
+
Returns **[Promise][9]<any>**
|
|
1630
|
+
|
|
1542
1631
|
### seeInSource
|
|
1543
1632
|
|
|
1544
1633
|
Checks that the current page contains the given string in its raw source code.
|
|
@@ -1551,6 +1640,8 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1551
1640
|
|
|
1552
1641
|
- `text` **[string][8]** value to check.
|
|
1553
1642
|
|
|
1643
|
+
Returns **[Promise][9]<any>**
|
|
1644
|
+
|
|
1554
1645
|
### seeInTitle
|
|
1555
1646
|
|
|
1556
1647
|
Checks that title contains text.
|
|
@@ -1563,6 +1654,8 @@ I.seeInTitle('Home Page');
|
|
|
1563
1654
|
|
|
1564
1655
|
- `text` **[string][8]** text value to check.
|
|
1565
1656
|
|
|
1657
|
+
Returns **[Promise][9]<any>**
|
|
1658
|
+
|
|
1566
1659
|
### seeNumberOfElements
|
|
1567
1660
|
|
|
1568
1661
|
Asserts that an element appears a given number of times in the DOM.
|
|
@@ -1575,7 +1668,9 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1575
1668
|
#### Parameters
|
|
1576
1669
|
|
|
1577
1670
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1578
|
-
- `num` **[number][
|
|
1671
|
+
- `num` **[number][11]** number of elements.
|
|
1672
|
+
|
|
1673
|
+
Returns **[Promise][9]<any>**
|
|
1579
1674
|
|
|
1580
1675
|
|
|
1581
1676
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1593,7 +1688,9 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1593
1688
|
#### Parameters
|
|
1594
1689
|
|
|
1595
1690
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1596
|
-
- `num` **[number][
|
|
1691
|
+
- `num` **[number][11]** number of elements.
|
|
1692
|
+
|
|
1693
|
+
Returns **[Promise][9]<any>**
|
|
1597
1694
|
|
|
1598
1695
|
|
|
1599
1696
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1612,6 +1709,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1612
1709
|
- `text` **[string][8]** element value to check.
|
|
1613
1710
|
- `context` **([string][8] | [object][6])?** element located by CSS|XPath|strict locator.
|
|
1614
1711
|
|
|
1712
|
+
Returns **[Promise][9]<any>**
|
|
1713
|
+
|
|
1615
1714
|
### seeTitleEquals
|
|
1616
1715
|
|
|
1617
1716
|
Checks that title is equal to provided one.
|
|
@@ -1624,6 +1723,8 @@ I.seeTitleEquals('Test title.');
|
|
|
1624
1723
|
|
|
1625
1724
|
- `text` **[string][8]** value to check.
|
|
1626
1725
|
|
|
1726
|
+
Returns **[Promise][9]<any>**
|
|
1727
|
+
|
|
1627
1728
|
### selectOption
|
|
1628
1729
|
|
|
1629
1730
|
Selects an option in a drop-down select.
|
|
@@ -1650,6 +1751,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1650
1751
|
- `select` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1651
1752
|
- `option` **([string][8] | [Array][14]<any>)** visible text or value of option.
|
|
1652
1753
|
|
|
1754
|
+
Returns **[Promise][9]<any>**
|
|
1755
|
+
|
|
1653
1756
|
### setCookie
|
|
1654
1757
|
|
|
1655
1758
|
Sets cookie(s).
|
|
@@ -1670,6 +1773,8 @@ I.setCookie([
|
|
|
1670
1773
|
|
|
1671
1774
|
- `cookie` **(Cookie | [Array][14]<Cookie>)** a cookie object or array of cookie objects.
|
|
1672
1775
|
|
|
1776
|
+
Returns **[Promise][9]<any>**
|
|
1777
|
+
|
|
1673
1778
|
### switchTo
|
|
1674
1779
|
|
|
1675
1780
|
Switches frame or in case of null locator reverts to parent.
|
|
@@ -1683,6 +1788,8 @@ I.switchTo(); // switch back to main page
|
|
|
1683
1788
|
|
|
1684
1789
|
- `locator` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1685
1790
|
|
|
1791
|
+
Returns **[Promise][9]<any>**
|
|
1792
|
+
|
|
1686
1793
|
### switchToNextTab
|
|
1687
1794
|
|
|
1688
1795
|
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
@@ -1694,7 +1801,7 @@ I.switchToNextTab(2);
|
|
|
1694
1801
|
|
|
1695
1802
|
#### Parameters
|
|
1696
1803
|
|
|
1697
|
-
- `num` **[number][
|
|
1804
|
+
- `num` **[number][11]**
|
|
1698
1805
|
|
|
1699
1806
|
### switchToPreviousTab
|
|
1700
1807
|
|
|
@@ -1707,7 +1814,7 @@ I.switchToPreviousTab(2);
|
|
|
1707
1814
|
|
|
1708
1815
|
#### Parameters
|
|
1709
1816
|
|
|
1710
|
-
- `num` **[number][
|
|
1817
|
+
- `num` **[number][11]**
|
|
1711
1818
|
|
|
1712
1819
|
### type
|
|
1713
1820
|
|
|
@@ -1729,9 +1836,11 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1729
1836
|
#### Parameters
|
|
1730
1837
|
|
|
1731
1838
|
- `keys`
|
|
1732
|
-
- `delay` **[number][
|
|
1839
|
+
- `delay` **[number][11]?** (optional) delay in ms between key presses
|
|
1733
1840
|
- `key` **([string][8] | [Array][14]<[string][8]>)** or array of keys to type.
|
|
1734
1841
|
|
|
1842
|
+
Returns **[Promise][9]<any>**
|
|
1843
|
+
|
|
1735
1844
|
### uncheckOption
|
|
1736
1845
|
|
|
1737
1846
|
Unselects a checkbox or radio button.
|
|
@@ -1750,6 +1859,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1750
1859
|
- `field` **([string][8] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1751
1860
|
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1752
1861
|
|
|
1862
|
+
Returns **[Promise][9]<any>**
|
|
1863
|
+
|
|
1753
1864
|
### usePuppeteerTo
|
|
1754
1865
|
|
|
1755
1866
|
Use Puppeteer API inside a test.
|
|
@@ -1768,7 +1879,7 @@ I.usePuppeteerTo('emulate offline mode', async ({ page }) {
|
|
|
1768
1879
|
#### Parameters
|
|
1769
1880
|
|
|
1770
1881
|
- `description` **[string][8]** used to show in logs.
|
|
1771
|
-
- `fn` **[function][
|
|
1882
|
+
- `fn` **[function][13]** async function that is executed with Puppeteer as argument
|
|
1772
1883
|
|
|
1773
1884
|
### wait
|
|
1774
1885
|
|
|
@@ -1780,7 +1891,9 @@ I.wait(2); // wait 2 secs
|
|
|
1780
1891
|
|
|
1781
1892
|
#### Parameters
|
|
1782
1893
|
|
|
1783
|
-
- `sec` **[number][
|
|
1894
|
+
- `sec` **[number][11]** number of second to wait.
|
|
1895
|
+
|
|
1896
|
+
Returns **[Promise][9]<any>**
|
|
1784
1897
|
|
|
1785
1898
|
### waitForClickable
|
|
1786
1899
|
|
|
@@ -1796,7 +1909,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1796
1909
|
|
|
1797
1910
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1798
1911
|
- `waitTimeout`
|
|
1799
|
-
- `sec` **[number][
|
|
1912
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1913
|
+
|
|
1914
|
+
Returns **[Promise][9]<any>**
|
|
1800
1915
|
|
|
1801
1916
|
### waitForDetached
|
|
1802
1917
|
|
|
@@ -1810,7 +1925,9 @@ I.waitForDetached('#popup');
|
|
|
1810
1925
|
#### Parameters
|
|
1811
1926
|
|
|
1812
1927
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1813
|
-
- `sec` **[number][
|
|
1928
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1929
|
+
|
|
1930
|
+
Returns **[Promise][9]<any>**
|
|
1814
1931
|
|
|
1815
1932
|
### waitForElement
|
|
1816
1933
|
|
|
@@ -1825,8 +1942,9 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1825
1942
|
#### Parameters
|
|
1826
1943
|
|
|
1827
1944
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1828
|
-
- `sec` **[number][
|
|
1829
|
-
|
|
1945
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1946
|
+
|
|
1947
|
+
Returns **[Promise][9]<any>**
|
|
1830
1948
|
|
|
1831
1949
|
|
|
1832
1950
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1840,7 +1958,9 @@ Element can be located by CSS or XPath.
|
|
|
1840
1958
|
#### Parameters
|
|
1841
1959
|
|
|
1842
1960
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1843
|
-
- `sec` **[number][
|
|
1961
|
+
- `sec` **[number][11]** (optional) time in seconds to wait, 1 by default.
|
|
1962
|
+
|
|
1963
|
+
Returns **[Promise][9]<any>**
|
|
1844
1964
|
|
|
1845
1965
|
### waitForFunction
|
|
1846
1966
|
|
|
@@ -1859,9 +1979,11 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1859
1979
|
|
|
1860
1980
|
#### Parameters
|
|
1861
1981
|
|
|
1862
|
-
- `fn` **([string][8] | [function][
|
|
1863
|
-
- `argsOrSec` **([Array][14]<any> | [number][
|
|
1864
|
-
- `sec` **[number][
|
|
1982
|
+
- `fn` **([string][8] | [function][13])** to be executed in browser context.
|
|
1983
|
+
- `argsOrSec` **([Array][14]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
1984
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1985
|
+
|
|
1986
|
+
Returns **[Promise][9]<any>**
|
|
1865
1987
|
|
|
1866
1988
|
### waitForInvisible
|
|
1867
1989
|
|
|
@@ -1875,7 +1997,9 @@ I.waitForInvisible('#popup');
|
|
|
1875
1997
|
#### Parameters
|
|
1876
1998
|
|
|
1877
1999
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1878
|
-
- `sec` **[number][
|
|
2000
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2001
|
+
|
|
2002
|
+
Returns **[Promise][9]<any>**
|
|
1879
2003
|
|
|
1880
2004
|
### waitForNavigation
|
|
1881
2005
|
|
|
@@ -1898,8 +2022,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1898
2022
|
|
|
1899
2023
|
#### Parameters
|
|
1900
2024
|
|
|
1901
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
1902
|
-
- `sec` **[number][
|
|
2025
|
+
- `urlOrPredicate` **([string][8] | [function][13])**
|
|
2026
|
+
- `sec` **[number][11]?** seconds to wait
|
|
1903
2027
|
|
|
1904
2028
|
### waitForResponse
|
|
1905
2029
|
|
|
@@ -1912,8 +2036,8 @@ I.waitForResponse(response => response.url() === 'http://example.com' && respons
|
|
|
1912
2036
|
|
|
1913
2037
|
#### Parameters
|
|
1914
2038
|
|
|
1915
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
1916
|
-
- `sec` **[number][
|
|
2039
|
+
- `urlOrPredicate` **([string][8] | [function][13])**
|
|
2040
|
+
- `sec` **[number][11]?** number of seconds to wait
|
|
1917
2041
|
|
|
1918
2042
|
### waitForText
|
|
1919
2043
|
|
|
@@ -1929,9 +2053,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1929
2053
|
#### Parameters
|
|
1930
2054
|
|
|
1931
2055
|
- `text` **[string][8]** to wait for.
|
|
1932
|
-
- `sec` **[number][
|
|
2056
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1933
2057
|
- `context` **([string][8] | [object][6])?** (optional) element located by CSS|XPath|strict locator.
|
|
1934
2058
|
|
|
2059
|
+
Returns **[Promise][9]<any>**
|
|
2060
|
+
|
|
1935
2061
|
### waitForValue
|
|
1936
2062
|
|
|
1937
2063
|
Waits for the specified value to be in value attribute.
|
|
@@ -1944,7 +2070,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1944
2070
|
|
|
1945
2071
|
- `field` **([string][8] | [object][6])** input field.
|
|
1946
2072
|
- `value` **[string][8]** expected value.
|
|
1947
|
-
- `sec` **[number][
|
|
2073
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2074
|
+
|
|
2075
|
+
Returns **[Promise][9]<any>**
|
|
1948
2076
|
|
|
1949
2077
|
### waitForVisible
|
|
1950
2078
|
|
|
@@ -1958,7 +2086,9 @@ I.waitForVisible('#popup');
|
|
|
1958
2086
|
#### Parameters
|
|
1959
2087
|
|
|
1960
2088
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1961
|
-
- `sec` **[number][
|
|
2089
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2090
|
+
|
|
2091
|
+
Returns **[Promise][9]<any>** This method accepts [React selectors][22].
|
|
1962
2092
|
|
|
1963
2093
|
### waitInUrl
|
|
1964
2094
|
|
|
@@ -1971,7 +2101,9 @@ I.waitInUrl('/info', 2);
|
|
|
1971
2101
|
#### Parameters
|
|
1972
2102
|
|
|
1973
2103
|
- `urlPart` **[string][8]** value to check.
|
|
1974
|
-
- `sec` **[number][
|
|
2104
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2105
|
+
|
|
2106
|
+
Returns **[Promise][9]<any>**
|
|
1975
2107
|
|
|
1976
2108
|
### waitNumberOfVisibleElements
|
|
1977
2109
|
|
|
@@ -1984,13 +2116,14 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1984
2116
|
#### Parameters
|
|
1985
2117
|
|
|
1986
2118
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1987
|
-
- `num` **[number][
|
|
1988
|
-
- `sec` **[number][
|
|
1989
|
-
|
|
2119
|
+
- `num` **[number][11]** number of elements.
|
|
2120
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2121
|
+
|
|
2122
|
+
Returns **[Promise][9]<any>**
|
|
1990
2123
|
|
|
1991
2124
|
|
|
1992
2125
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
1993
|
-
|
|
2126
|
+
|
|
1994
2127
|
|
|
1995
2128
|
### waitToHide
|
|
1996
2129
|
|
|
@@ -2004,7 +2137,9 @@ I.waitToHide('#popup');
|
|
|
2004
2137
|
#### Parameters
|
|
2005
2138
|
|
|
2006
2139
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2007
|
-
- `sec` **[number][
|
|
2140
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2141
|
+
|
|
2142
|
+
Returns **[Promise][9]<any>**
|
|
2008
2143
|
|
|
2009
2144
|
### waitUrlEquals
|
|
2010
2145
|
|
|
@@ -2018,7 +2153,9 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2018
2153
|
#### Parameters
|
|
2019
2154
|
|
|
2020
2155
|
- `urlPart` **[string][8]** value to check.
|
|
2021
|
-
- `sec` **[number][
|
|
2156
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2157
|
+
|
|
2158
|
+
Returns **[Promise][9]<any>**
|
|
2022
2159
|
|
|
2023
2160
|
[1]: https://github.com/GoogleChrome/puppeteer
|
|
2024
2161
|
|
|
@@ -2036,15 +2173,15 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2036
2173
|
|
|
2037
2174
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2038
2175
|
|
|
2039
|
-
[9]: https://
|
|
2176
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2040
2177
|
|
|
2041
|
-
[10]: https://
|
|
2178
|
+
[10]: https://github.com/puppeteer/puppeteer/issues/5420
|
|
2042
2179
|
|
|
2043
|
-
[11]: https://
|
|
2180
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2044
2181
|
|
|
2045
|
-
[12]: https://
|
|
2182
|
+
[12]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
2046
2183
|
|
|
2047
|
-
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2184
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2048
2185
|
|
|
2049
2186
|
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2050
2187
|
|