codeceptjs 2.1.3 → 2.2.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 +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
package/lib/helper/Nightmare.js
CHANGED
|
@@ -81,6 +81,9 @@ class Nightmare extends Helper {
|
|
|
81
81
|
static _config() {
|
|
82
82
|
return [
|
|
83
83
|
{ name: 'url', message: 'Base url of site to be tested', default: 'http://localhost' },
|
|
84
|
+
{
|
|
85
|
+
name: 'show', message: 'Show browser window', default: true, type: 'confirm',
|
|
86
|
+
},
|
|
84
87
|
];
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -392,13 +395,9 @@ class Nightmare extends Helper {
|
|
|
392
395
|
}
|
|
393
396
|
|
|
394
397
|
/**
|
|
395
|
-
* {{>
|
|
396
|
-
*
|
|
397
|
-
* In a second argument a list of request headers can be passed:
|
|
398
|
+
* {{> amOnPage }}
|
|
399
|
+
* @param headers {object} list of request headers can be passed
|
|
398
400
|
*
|
|
399
|
-
* ```js
|
|
400
|
-
* I.amOnPage('/auth', { 'x-my-custom-header': 'some value' })
|
|
401
|
-
* ```
|
|
402
401
|
*/
|
|
403
402
|
async amOnPage(url, headers = null) {
|
|
404
403
|
if (!(/^\w+\:\/\//.test(url))) {
|
|
@@ -417,7 +416,7 @@ class Nightmare extends Helper {
|
|
|
417
416
|
}
|
|
418
417
|
|
|
419
418
|
/**
|
|
420
|
-
* {{>
|
|
419
|
+
* {{> seeInTitle }}
|
|
421
420
|
*/
|
|
422
421
|
async seeInTitle(text) {
|
|
423
422
|
const title = await this.browser.title();
|
|
@@ -425,7 +424,7 @@ class Nightmare extends Helper {
|
|
|
425
424
|
}
|
|
426
425
|
|
|
427
426
|
/**
|
|
428
|
-
* {{>
|
|
427
|
+
* {{> dontSeeInTitle }}
|
|
429
428
|
*/
|
|
430
429
|
async dontSeeInTitle(text) {
|
|
431
430
|
const title = await this.browser.title();
|
|
@@ -433,21 +432,21 @@ class Nightmare extends Helper {
|
|
|
433
432
|
}
|
|
434
433
|
|
|
435
434
|
/**
|
|
436
|
-
* {{>
|
|
435
|
+
* {{> grabTitle }}
|
|
437
436
|
*/
|
|
438
437
|
async grabTitle() {
|
|
439
438
|
return this.browser.title();
|
|
440
439
|
}
|
|
441
440
|
|
|
442
441
|
/**
|
|
443
|
-
* {{>
|
|
442
|
+
* {{> grabCurrentUrl }}
|
|
444
443
|
*/
|
|
445
444
|
async grabCurrentUrl() {
|
|
446
445
|
return this.browser.url();
|
|
447
446
|
}
|
|
448
447
|
|
|
449
448
|
/**
|
|
450
|
-
* {{>
|
|
449
|
+
* {{> seeInCurrentUrl }}
|
|
451
450
|
*/
|
|
452
451
|
async seeInCurrentUrl(url) {
|
|
453
452
|
const currentUrl = await this.browser.url();
|
|
@@ -455,7 +454,7 @@ class Nightmare extends Helper {
|
|
|
455
454
|
}
|
|
456
455
|
|
|
457
456
|
/**
|
|
458
|
-
* {{>
|
|
457
|
+
* {{> dontSeeInCurrentUrl }}
|
|
459
458
|
*/
|
|
460
459
|
async dontSeeInCurrentUrl(url) {
|
|
461
460
|
const currentUrl = await this.browser.url();
|
|
@@ -463,7 +462,7 @@ class Nightmare extends Helper {
|
|
|
463
462
|
}
|
|
464
463
|
|
|
465
464
|
/**
|
|
466
|
-
* {{>
|
|
465
|
+
* {{> seeCurrentUrlEquals }}
|
|
467
466
|
*/
|
|
468
467
|
async seeCurrentUrlEquals(url) {
|
|
469
468
|
const currentUrl = await this.browser.url();
|
|
@@ -471,7 +470,7 @@ class Nightmare extends Helper {
|
|
|
471
470
|
}
|
|
472
471
|
|
|
473
472
|
/**
|
|
474
|
-
* {{>
|
|
473
|
+
* {{> dontSeeCurrentUrlEquals }}
|
|
475
474
|
*/
|
|
476
475
|
async dontSeeCurrentUrlEquals(url) {
|
|
477
476
|
const currentUrl = await this.browser.url();
|
|
@@ -479,21 +478,21 @@ class Nightmare extends Helper {
|
|
|
479
478
|
}
|
|
480
479
|
|
|
481
480
|
/**
|
|
482
|
-
* {{>
|
|
481
|
+
* {{> see }}
|
|
483
482
|
*/
|
|
484
483
|
async see(text, context = null) {
|
|
485
484
|
return proceedSee.call(this, 'assert', text, context);
|
|
486
485
|
}
|
|
487
486
|
|
|
488
487
|
/**
|
|
489
|
-
* {{>
|
|
488
|
+
* {{> dontSee }}
|
|
490
489
|
*/
|
|
491
490
|
dontSee(text, context = null) {
|
|
492
491
|
return proceedSee.call(this, 'negate', text, context);
|
|
493
492
|
}
|
|
494
493
|
|
|
495
494
|
/**
|
|
496
|
-
* {{>
|
|
495
|
+
* {{> seeElement }}
|
|
497
496
|
*/
|
|
498
497
|
async seeElement(locator) {
|
|
499
498
|
locator = new Locator(locator, 'css');
|
|
@@ -504,7 +503,7 @@ class Nightmare extends Helper {
|
|
|
504
503
|
}
|
|
505
504
|
|
|
506
505
|
/**
|
|
507
|
-
* {{>
|
|
506
|
+
* {{> dontSeeElement }}
|
|
508
507
|
*/
|
|
509
508
|
async dontSeeElement(locator) {
|
|
510
509
|
locator = new Locator(locator, 'css');
|
|
@@ -516,7 +515,7 @@ class Nightmare extends Helper {
|
|
|
516
515
|
}
|
|
517
516
|
|
|
518
517
|
/**
|
|
519
|
-
* {{>
|
|
518
|
+
* {{> seeElementInDOM }}
|
|
520
519
|
*/
|
|
521
520
|
async seeElementInDOM(locator) {
|
|
522
521
|
locator = new Locator(locator, 'css');
|
|
@@ -525,7 +524,7 @@ class Nightmare extends Helper {
|
|
|
525
524
|
}
|
|
526
525
|
|
|
527
526
|
/**
|
|
528
|
-
* {{>
|
|
527
|
+
* {{> dontSeeElementInDOM }}
|
|
529
528
|
*/
|
|
530
529
|
async dontSeeElementInDOM(locator) {
|
|
531
530
|
locator = new Locator(locator, 'css');
|
|
@@ -534,7 +533,7 @@ class Nightmare extends Helper {
|
|
|
534
533
|
}
|
|
535
534
|
|
|
536
535
|
/**
|
|
537
|
-
* {{>
|
|
536
|
+
* {{> seeInSource }}
|
|
538
537
|
*/
|
|
539
538
|
async seeInSource(text) {
|
|
540
539
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -542,7 +541,7 @@ class Nightmare extends Helper {
|
|
|
542
541
|
}
|
|
543
542
|
|
|
544
543
|
/**
|
|
545
|
-
* {{>
|
|
544
|
+
* {{> dontSeeInSource }}
|
|
546
545
|
*/
|
|
547
546
|
async dontSeeInSource(text) {
|
|
548
547
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -550,20 +549,15 @@ class Nightmare extends Helper {
|
|
|
550
549
|
}
|
|
551
550
|
|
|
552
551
|
/**
|
|
553
|
-
*
|
|
554
|
-
* Element is located by label or name or CSS or XPath.
|
|
555
|
-
*
|
|
556
|
-
* ```js
|
|
557
|
-
* I.seeNumberOfElements('#submitBtn', 1);
|
|
558
|
-
* ```
|
|
552
|
+
* {{> seeNumberOfElements }}
|
|
559
553
|
*/
|
|
560
|
-
async seeNumberOfElements(
|
|
561
|
-
const elements = await this._locate(
|
|
562
|
-
return equals(`expected number of elements (${
|
|
554
|
+
async seeNumberOfElements(locator, num) {
|
|
555
|
+
const elements = await this._locate(locator);
|
|
556
|
+
return equals(`expected number of elements (${locator}) is ${num}, but found ${elements.length}`).assert(elements.length, num);
|
|
563
557
|
}
|
|
564
558
|
|
|
565
559
|
/**
|
|
566
|
-
* {{>
|
|
560
|
+
* {{> seeNumberOfVisibleElements }}
|
|
567
561
|
*/
|
|
568
562
|
async seeNumberOfVisibleElements(locator, num) {
|
|
569
563
|
const res = await this.grabNumberOfVisibleElements(locator);
|
|
@@ -571,7 +565,7 @@ class Nightmare extends Helper {
|
|
|
571
565
|
}
|
|
572
566
|
|
|
573
567
|
/**
|
|
574
|
-
* {{>
|
|
568
|
+
* {{> grabNumberOfVisibleElements }}
|
|
575
569
|
*/
|
|
576
570
|
async grabNumberOfVisibleElements(locator) {
|
|
577
571
|
locator = new Locator(locator, 'css');
|
|
@@ -585,7 +579,7 @@ class Nightmare extends Helper {
|
|
|
585
579
|
}
|
|
586
580
|
|
|
587
581
|
/**
|
|
588
|
-
* {{>
|
|
582
|
+
* {{> click }}
|
|
589
583
|
*/
|
|
590
584
|
async click(locator, context = null) {
|
|
591
585
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -595,7 +589,7 @@ class Nightmare extends Helper {
|
|
|
595
589
|
}
|
|
596
590
|
|
|
597
591
|
/**
|
|
598
|
-
* {{>
|
|
592
|
+
* {{> doubleClick }}
|
|
599
593
|
*/
|
|
600
594
|
async doubleClick(locator, context = null) {
|
|
601
595
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -606,7 +600,7 @@ class Nightmare extends Helper {
|
|
|
606
600
|
|
|
607
601
|
|
|
608
602
|
/**
|
|
609
|
-
* {{>
|
|
603
|
+
* {{> rightClick }}
|
|
610
604
|
*/
|
|
611
605
|
async rightClick(locator, context = null) {
|
|
612
606
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -617,7 +611,7 @@ class Nightmare extends Helper {
|
|
|
617
611
|
|
|
618
612
|
|
|
619
613
|
/**
|
|
620
|
-
* {{>
|
|
614
|
+
* {{> moveCursorTo }}
|
|
621
615
|
*/
|
|
622
616
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
623
617
|
locator = new Locator(locator, 'css');
|
|
@@ -629,7 +623,7 @@ class Nightmare extends Helper {
|
|
|
629
623
|
|
|
630
624
|
|
|
631
625
|
/**
|
|
632
|
-
* {{>
|
|
626
|
+
* {{> executeScript }}
|
|
633
627
|
*
|
|
634
628
|
* Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
|
|
635
629
|
*/
|
|
@@ -639,7 +633,7 @@ class Nightmare extends Helper {
|
|
|
639
633
|
}
|
|
640
634
|
|
|
641
635
|
/**
|
|
642
|
-
* {{>
|
|
636
|
+
* {{> executeAsyncScript }}
|
|
643
637
|
*
|
|
644
638
|
* Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
|
|
645
639
|
* Unlike NightmareJS implementation calling `done` will return its first argument.
|
|
@@ -650,7 +644,7 @@ class Nightmare extends Helper {
|
|
|
650
644
|
}
|
|
651
645
|
|
|
652
646
|
/**
|
|
653
|
-
* {{>
|
|
647
|
+
* {{> resizeWindow }}
|
|
654
648
|
*/
|
|
655
649
|
async resizeWindow(width, height) {
|
|
656
650
|
if (width === 'maximize') {
|
|
@@ -660,7 +654,7 @@ class Nightmare extends Helper {
|
|
|
660
654
|
}
|
|
661
655
|
|
|
662
656
|
/**
|
|
663
|
-
* {{>
|
|
657
|
+
* {{> checkOption }}
|
|
664
658
|
*/
|
|
665
659
|
async checkOption(field, context = null) {
|
|
666
660
|
const els = await findCheckable.call(this, field, context);
|
|
@@ -670,7 +664,17 @@ class Nightmare extends Helper {
|
|
|
670
664
|
}
|
|
671
665
|
|
|
672
666
|
/**
|
|
673
|
-
* {{>
|
|
667
|
+
* {{> uncheckOption }}
|
|
668
|
+
*/
|
|
669
|
+
async uncheckOption(field, context = null) {
|
|
670
|
+
const els = await findCheckable.call(this, field, context);
|
|
671
|
+
assertElementExists(els[0], field, 'Checkbox or radio');
|
|
672
|
+
return this.browser.evaluate(els => window.codeceptjs.unCheckEl(els[0]), els)
|
|
673
|
+
.wait(this.options.waitForAction);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* {{> fillField }}
|
|
674
678
|
*/
|
|
675
679
|
async fillField(field, value) {
|
|
676
680
|
const el = await findField.call(this, field);
|
|
@@ -680,14 +684,14 @@ class Nightmare extends Helper {
|
|
|
680
684
|
}
|
|
681
685
|
|
|
682
686
|
/**
|
|
683
|
-
* {{>
|
|
687
|
+
* {{> clearField }}
|
|
684
688
|
*/
|
|
685
689
|
async clearField(field) {
|
|
686
690
|
return this.fillField(field, '');
|
|
687
691
|
}
|
|
688
692
|
|
|
689
693
|
/**
|
|
690
|
-
* {{>
|
|
694
|
+
* {{> appendField }}
|
|
691
695
|
*/
|
|
692
696
|
async appendField(field, value) {
|
|
693
697
|
const el = await findField.call(this, field);
|
|
@@ -697,14 +701,14 @@ class Nightmare extends Helper {
|
|
|
697
701
|
}
|
|
698
702
|
|
|
699
703
|
/**
|
|
700
|
-
* {{>
|
|
704
|
+
* {{> seeInField }}
|
|
701
705
|
*/
|
|
702
706
|
async seeInField(field, value) {
|
|
703
707
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
704
708
|
}
|
|
705
709
|
|
|
706
710
|
/**
|
|
707
|
-
* {{>
|
|
711
|
+
* {{> dontSeeInField }}
|
|
708
712
|
*/
|
|
709
713
|
async dontSeeInField(field, value) {
|
|
710
714
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -739,26 +743,25 @@ class Nightmare extends Helper {
|
|
|
739
743
|
}
|
|
740
744
|
|
|
741
745
|
/**
|
|
742
|
-
* {{>
|
|
746
|
+
* {{> seeCheckboxIsChecked }}
|
|
743
747
|
*/
|
|
744
748
|
async seeCheckboxIsChecked(field) {
|
|
745
749
|
return proceedIsChecked.call(this, 'assert', field);
|
|
746
750
|
}
|
|
747
751
|
|
|
748
752
|
/**
|
|
749
|
-
* {{>
|
|
753
|
+
* {{> dontSeeCheckboxIsChecked }}
|
|
750
754
|
*/
|
|
751
755
|
async dontSeeCheckboxIsChecked(field) {
|
|
752
756
|
return proceedIsChecked.call(this, 'negate', field);
|
|
753
757
|
}
|
|
754
758
|
|
|
755
759
|
/**
|
|
756
|
-
* {{>
|
|
760
|
+
* {{> attachFile }}
|
|
757
761
|
*
|
|
758
|
-
*
|
|
762
|
+
* Doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more](https://github.com/rosshinkley/nightmare-upload#important-note-about-setting-file-upload-inputs))
|
|
759
763
|
*
|
|
760
|
-
*
|
|
761
|
-
* * doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more](https://github.com/rosshinkley/nightmare-upload#important-note-about-setting-file-upload-inputs))
|
|
764
|
+
* @param locator CSS locator (XPath not allowed)
|
|
762
765
|
*/
|
|
763
766
|
async attachFile(locator, pathToFile) {
|
|
764
767
|
const file = path.join(global.codecept_dir, pathToFile);
|
|
@@ -775,7 +778,7 @@ class Nightmare extends Helper {
|
|
|
775
778
|
}
|
|
776
779
|
|
|
777
780
|
/**
|
|
778
|
-
* {{>
|
|
781
|
+
* {{> grabTextFrom }}
|
|
779
782
|
*/
|
|
780
783
|
async grabTextFrom(locator) {
|
|
781
784
|
locator = new Locator(locator, 'css');
|
|
@@ -791,7 +794,7 @@ class Nightmare extends Helper {
|
|
|
791
794
|
}
|
|
792
795
|
|
|
793
796
|
/**
|
|
794
|
-
* {{>
|
|
797
|
+
* {{> grabValueFrom }}
|
|
795
798
|
*/
|
|
796
799
|
async grabValueFrom(locator) {
|
|
797
800
|
const el = await findField.call(this, locator);
|
|
@@ -800,7 +803,7 @@ class Nightmare extends Helper {
|
|
|
800
803
|
}
|
|
801
804
|
|
|
802
805
|
/**
|
|
803
|
-
* {{>
|
|
806
|
+
* {{> grabAttributeFrom }}
|
|
804
807
|
*/
|
|
805
808
|
async grabAttributeFrom(locator, attr) {
|
|
806
809
|
locator = new Locator(locator, 'css');
|
|
@@ -817,7 +820,7 @@ class Nightmare extends Helper {
|
|
|
817
820
|
}
|
|
818
821
|
|
|
819
822
|
/**
|
|
820
|
-
* {{>
|
|
823
|
+
* {{> grabHTMLFrom }}
|
|
821
824
|
*/
|
|
822
825
|
async grabHTMLFrom(locator) {
|
|
823
826
|
locator = new Locator(locator, 'css');
|
|
@@ -840,7 +843,7 @@ class Nightmare extends Helper {
|
|
|
840
843
|
}
|
|
841
844
|
|
|
842
845
|
/**
|
|
843
|
-
* {{>
|
|
846
|
+
* {{> selectOption }}
|
|
844
847
|
*/
|
|
845
848
|
async selectOption(select, option) {
|
|
846
849
|
const fetchAndCheckOption = function (el, locator) {
|
|
@@ -883,7 +886,7 @@ class Nightmare extends Helper {
|
|
|
883
886
|
}
|
|
884
887
|
|
|
885
888
|
/**
|
|
886
|
-
* {{>
|
|
889
|
+
* {{> setCookie }}
|
|
887
890
|
*
|
|
888
891
|
* Wrapper for `.cookies.set(cookie)`.
|
|
889
892
|
* [See more](https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie)
|
|
@@ -893,7 +896,7 @@ class Nightmare extends Helper {
|
|
|
893
896
|
}
|
|
894
897
|
|
|
895
898
|
/**
|
|
896
|
-
* {{>
|
|
899
|
+
* {{> seeCookie }}
|
|
897
900
|
*
|
|
898
901
|
*/
|
|
899
902
|
async seeCookie(name) {
|
|
@@ -902,7 +905,7 @@ class Nightmare extends Helper {
|
|
|
902
905
|
}
|
|
903
906
|
|
|
904
907
|
/**
|
|
905
|
-
* {{>
|
|
908
|
+
* {{> dontSeeCookie }}
|
|
906
909
|
*/
|
|
907
910
|
async dontSeeCookie(name) {
|
|
908
911
|
const res = await this.browser.cookies.get(name);
|
|
@@ -910,24 +913,18 @@ class Nightmare extends Helper {
|
|
|
910
913
|
}
|
|
911
914
|
|
|
912
915
|
/**
|
|
913
|
-
* {{>
|
|
916
|
+
* {{> grabCookie }}
|
|
914
917
|
*
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
* Multiple cookies can be received by passing query object:
|
|
918
|
-
*
|
|
919
|
-
* ```js
|
|
920
|
-
* I.grabCookie({ secure: true});
|
|
921
|
-
* ```
|
|
918
|
+
* @returns Promise<object> Cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
922
919
|
*
|
|
923
|
-
* If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
|
|
920
|
+
* Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
|
|
924
921
|
*/
|
|
925
922
|
async grabCookie(name) {
|
|
926
923
|
return this.browser.cookies.get(name);
|
|
927
924
|
}
|
|
928
925
|
|
|
929
926
|
/**
|
|
930
|
-
* {{>
|
|
927
|
+
* {{> clearCookie }}
|
|
931
928
|
*/
|
|
932
929
|
async clearCookie(cookie) {
|
|
933
930
|
if (!cookie) {
|
|
@@ -937,7 +934,7 @@ class Nightmare extends Helper {
|
|
|
937
934
|
}
|
|
938
935
|
|
|
939
936
|
/**
|
|
940
|
-
* {{>
|
|
937
|
+
* {{> waitForFunction }}
|
|
941
938
|
*/
|
|
942
939
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
943
940
|
let args = [];
|
|
@@ -953,7 +950,7 @@ class Nightmare extends Helper {
|
|
|
953
950
|
}
|
|
954
951
|
|
|
955
952
|
/**
|
|
956
|
-
* {{>
|
|
953
|
+
* {{> wait }}
|
|
957
954
|
*/
|
|
958
955
|
async wait(sec) {
|
|
959
956
|
return new Promise(((done) => {
|
|
@@ -962,7 +959,7 @@ class Nightmare extends Helper {
|
|
|
962
959
|
}
|
|
963
960
|
|
|
964
961
|
/**
|
|
965
|
-
* {{>
|
|
962
|
+
* {{> waitForText }}
|
|
966
963
|
*/
|
|
967
964
|
async waitForText(text, sec, context = null) {
|
|
968
965
|
if (!context) {
|
|
@@ -982,7 +979,7 @@ class Nightmare extends Helper {
|
|
|
982
979
|
}
|
|
983
980
|
|
|
984
981
|
/**
|
|
985
|
-
* {{>
|
|
982
|
+
* {{> waitForVisible }}
|
|
986
983
|
*/
|
|
987
984
|
waitForVisible(locator, sec) {
|
|
988
985
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1000,14 +997,14 @@ class Nightmare extends Helper {
|
|
|
1000
997
|
}
|
|
1001
998
|
|
|
1002
999
|
/**
|
|
1003
|
-
* {{>
|
|
1000
|
+
* {{> waitToHide }}
|
|
1004
1001
|
*/
|
|
1005
1002
|
async waitToHide(locator, sec = null) {
|
|
1006
1003
|
return this.waitForInvisible(locator, sec);
|
|
1007
1004
|
}
|
|
1008
1005
|
|
|
1009
1006
|
/**
|
|
1010
|
-
* {{>
|
|
1007
|
+
* {{> waitForInvisible }}
|
|
1011
1008
|
*/
|
|
1012
1009
|
waitForInvisible(locator, sec) {
|
|
1013
1010
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1025,7 +1022,7 @@ class Nightmare extends Helper {
|
|
|
1025
1022
|
}
|
|
1026
1023
|
|
|
1027
1024
|
/**
|
|
1028
|
-
* {{>
|
|
1025
|
+
* {{> waitForElement }}
|
|
1029
1026
|
*/
|
|
1030
1027
|
async waitForElement(locator, sec) {
|
|
1031
1028
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1046,7 +1043,7 @@ class Nightmare extends Helper {
|
|
|
1046
1043
|
}
|
|
1047
1044
|
|
|
1048
1045
|
/**
|
|
1049
|
-
* {{>
|
|
1046
|
+
* {{> waitForDetached }}
|
|
1050
1047
|
*/
|
|
1051
1048
|
async waitForDetached(locator, sec) {
|
|
1052
1049
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1061,7 +1058,7 @@ class Nightmare extends Helper {
|
|
|
1061
1058
|
}
|
|
1062
1059
|
|
|
1063
1060
|
/**
|
|
1064
|
-
* {{>
|
|
1061
|
+
* {{> refreshPage }}
|
|
1065
1062
|
*/
|
|
1066
1063
|
async refreshPage() {
|
|
1067
1064
|
return this.browser.refresh();
|
|
@@ -1076,7 +1073,7 @@ class Nightmare extends Helper {
|
|
|
1076
1073
|
}
|
|
1077
1074
|
|
|
1078
1075
|
/**
|
|
1079
|
-
* {{>
|
|
1076
|
+
* {{> saveScreenshot }}
|
|
1080
1077
|
*/
|
|
1081
1078
|
async saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) {
|
|
1082
1079
|
const outputFile = screenshotOutputFolder(fileName);
|
|
@@ -1099,7 +1096,7 @@ class Nightmare extends Helper {
|
|
|
1099
1096
|
}
|
|
1100
1097
|
|
|
1101
1098
|
/**
|
|
1102
|
-
* {{>
|
|
1099
|
+
* {{> scrollTo }}
|
|
1103
1100
|
*/
|
|
1104
1101
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1105
1102
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1121,14 +1118,14 @@ class Nightmare extends Helper {
|
|
|
1121
1118
|
}
|
|
1122
1119
|
|
|
1123
1120
|
/**
|
|
1124
|
-
* {{>
|
|
1121
|
+
* {{> scrollPageToTop }}
|
|
1125
1122
|
*/
|
|
1126
1123
|
async scrollPageToTop() {
|
|
1127
1124
|
return this.executeScript(() => window.scrollTo(0, 0));
|
|
1128
1125
|
}
|
|
1129
1126
|
|
|
1130
1127
|
/**
|
|
1131
|
-
* {{>
|
|
1128
|
+
* {{> scrollPageToBottom }}
|
|
1132
1129
|
*/
|
|
1133
1130
|
async scrollPageToBottom() {
|
|
1134
1131
|
/* eslint-disable prefer-arrow-callback, comma-dangle */
|
|
@@ -1144,7 +1141,7 @@ class Nightmare extends Helper {
|
|
|
1144
1141
|
}
|
|
1145
1142
|
|
|
1146
1143
|
/**
|
|
1147
|
-
* {{>
|
|
1144
|
+
* {{> grabPageScrollPosition }}
|
|
1148
1145
|
*/
|
|
1149
1146
|
async grabPageScrollPosition() {
|
|
1150
1147
|
/* eslint-disable comma-dangle */
|