codeceptjs 3.3.1 → 3.3.4
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 +49 -0
- package/README.md +4 -25
- package/docs/api.md +4 -0
- package/docs/basics.md +2 -0
- package/docs/build/Appium.js +18 -28
- package/docs/build/JSONResponse.js +44 -3
- package/docs/build/Nightmare.js +53 -53
- package/docs/build/Playwright.js +95 -103
- package/docs/build/Protractor.js +66 -66
- package/docs/build/Puppeteer.js +74 -74
- package/docs/build/REST.js +8 -4
- package/docs/build/TestCafe.js +53 -53
- package/docs/build/WebDriver.js +84 -86
- package/docs/changelog.md +49 -0
- package/docs/helpers/Appium.md +212 -268
- package/docs/helpers/JSONResponse.md +24 -0
- package/docs/helpers/Nightmare.md +92 -141
- package/docs/helpers/Playwright.md +302 -413
- package/docs/helpers/Puppeteer.md +171 -231
- package/docs/helpers/REST.md +2 -0
- package/docs/helpers/TestCafe.md +125 -174
- package/docs/helpers/WebDriver.md +184 -247
- package/docs/plugins.md +41 -1
- package/docs/secrets.md +30 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +1 -1
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- 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 +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/cli.js +1 -1
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +1 -1
- package/lib/command/workers/runTests.js +15 -0
- package/lib/helper/Appium.js +0 -10
- package/lib/helper/JSONResponse.js +44 -3
- package/lib/helper/Playwright.js +24 -32
- package/lib/helper/REST.js +8 -4
- package/lib/helper/WebDriver.js +5 -7
- package/lib/output.js +4 -0
- package/lib/plugin/customLocator.js +50 -3
- package/lib/plugin/retryFailedStep.js +1 -1
- package/lib/plugin/retryTo.js +1 -8
- package/lib/secret.js +30 -0
- package/lib/step.js +1 -1
- package/package.json +4 -4
- package/typings/types.d.ts +1016 -520
package/docs/build/REST.js
CHANGED
|
@@ -2,6 +2,7 @@ const axios = require('axios').default;
|
|
|
2
2
|
const Secret = require('../secret');
|
|
3
3
|
|
|
4
4
|
const Helper = require('../helper');
|
|
5
|
+
const { beautify } = require('../utils');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* REST helper allows to send additional requests to the REST API during acceptance tests.
|
|
@@ -10,6 +11,7 @@ const Helper = require('../helper');
|
|
|
10
11
|
* ## Configuration
|
|
11
12
|
*
|
|
12
13
|
* * endpoint: API base URL
|
|
14
|
+
* * prettyPrintJson: pretty print json for response/request on console logs
|
|
13
15
|
* * timeout: timeout for requests in milliseconds. 10000ms by default
|
|
14
16
|
* * defaultHeaders: a list of default headers
|
|
15
17
|
* * onRequest: a async function which can update request object.
|
|
@@ -22,6 +24,7 @@ const Helper = require('../helper');
|
|
|
22
24
|
* helpers: {
|
|
23
25
|
* REST: {
|
|
24
26
|
* endpoint: 'http://site.com/api',
|
|
27
|
+
* prettyPrintJson: true,
|
|
25
28
|
* onRequest: (request) => {
|
|
26
29
|
* request.headers.auth = '123';
|
|
27
30
|
* }
|
|
@@ -49,6 +52,7 @@ class REST extends Helper {
|
|
|
49
52
|
timeout: 10000,
|
|
50
53
|
defaultHeaders: {},
|
|
51
54
|
endpoint: '',
|
|
55
|
+
prettyPrintJson: false,
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
if (this.options.maxContentLength) {
|
|
@@ -87,7 +91,7 @@ class REST extends Helper {
|
|
|
87
91
|
* @param {object} headers headers list
|
|
88
92
|
*/
|
|
89
93
|
haveRequestHeaders(headers) {
|
|
90
|
-
this.headers = { ...headers, ...
|
|
94
|
+
this.headers = { ...this.headers, ...headers };
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
/**
|
|
@@ -113,7 +117,7 @@ class REST extends Helper {
|
|
|
113
117
|
*/
|
|
114
118
|
async _executeRequest(request) {
|
|
115
119
|
// Add custom headers. They can be set by amBearerAuthenticated() or haveRequestHeaders()
|
|
116
|
-
request.headers = { ...
|
|
120
|
+
request.headers = { ...this.headers, ...request.headers };
|
|
117
121
|
|
|
118
122
|
const _debugRequest = { ...request };
|
|
119
123
|
this.axios.defaults.timeout = request.timeout || this.options.timeout;
|
|
@@ -137,7 +141,7 @@ class REST extends Helper {
|
|
|
137
141
|
await this.config.onRequest(request);
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
this.debugSection('Request', JSON.stringify(_debugRequest));
|
|
144
|
+
this.options.prettyPrintJson ? this.debugSection('Request', beautify(JSON.stringify(_debugRequest))) : this.debugSection('Request', JSON.stringify(_debugRequest));
|
|
141
145
|
|
|
142
146
|
let response;
|
|
143
147
|
try {
|
|
@@ -150,7 +154,7 @@ class REST extends Helper {
|
|
|
150
154
|
if (this.config.onResponse) {
|
|
151
155
|
await this.config.onResponse(response);
|
|
152
156
|
}
|
|
153
|
-
this.debugSection('Response', JSON.stringify(response.data));
|
|
157
|
+
this.options.prettyPrintJson ? this.debugSection('Response', beautify(JSON.stringify(response.data))) : this.debugSection('Response', JSON.stringify(response.data));
|
|
154
158
|
return response;
|
|
155
159
|
}
|
|
156
160
|
|
package/docs/build/TestCafe.js
CHANGED
|
@@ -334,7 +334,7 @@ class TestCafe extends Helper {
|
|
|
334
334
|
* ```
|
|
335
335
|
*
|
|
336
336
|
* @param {string} url url path or global url.
|
|
337
|
-
* @return {
|
|
337
|
+
* @return {void} automatically synchronized promise with recorder #!
|
|
338
338
|
*/
|
|
339
339
|
async amOnPage(url) {
|
|
340
340
|
if (!(/^\w+\:\/\//.test(url))) {
|
|
@@ -351,7 +351,7 @@ class TestCafe extends Helper {
|
|
|
351
351
|
*
|
|
352
352
|
* @param {number} width width in pixels or `maximize`.
|
|
353
353
|
* @param {number} height height in pixels.
|
|
354
|
-
*
|
|
354
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
355
355
|
*/
|
|
356
356
|
async resizeWindow(width, height) {
|
|
357
357
|
if (width === 'maximize') {
|
|
@@ -386,7 +386,7 @@ class TestCafe extends Helper {
|
|
|
386
386
|
*
|
|
387
387
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
388
388
|
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
389
|
-
*
|
|
389
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
390
390
|
*
|
|
391
391
|
*
|
|
392
392
|
*/
|
|
@@ -400,7 +400,7 @@ class TestCafe extends Helper {
|
|
|
400
400
|
* ```js
|
|
401
401
|
* I.refreshPage();
|
|
402
402
|
* ```
|
|
403
|
-
*
|
|
403
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
404
404
|
*/
|
|
405
405
|
async refreshPage() {
|
|
406
406
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -417,7 +417,7 @@ class TestCafe extends Helper {
|
|
|
417
417
|
*
|
|
418
418
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
419
419
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
420
|
-
*
|
|
420
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
421
421
|
*
|
|
422
422
|
*/
|
|
423
423
|
async waitForVisible(locator, sec) {
|
|
@@ -444,7 +444,7 @@ class TestCafe extends Helper {
|
|
|
444
444
|
* ```
|
|
445
445
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
446
446
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
447
|
-
*
|
|
447
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
448
448
|
*/
|
|
449
449
|
async fillField(field, value) {
|
|
450
450
|
const els = await findFields.call(this, field);
|
|
@@ -464,7 +464,7 @@ class TestCafe extends Helper {
|
|
|
464
464
|
* I.clearField('#email');
|
|
465
465
|
* ```
|
|
466
466
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
467
|
-
*
|
|
467
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
468
468
|
*/
|
|
469
469
|
async clearField(field) {
|
|
470
470
|
const els = await findFields.call(this, field);
|
|
@@ -486,7 +486,7 @@ class TestCafe extends Helper {
|
|
|
486
486
|
* ```
|
|
487
487
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
488
488
|
* @param {string} value text value to append.
|
|
489
|
-
*
|
|
489
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
490
490
|
*
|
|
491
491
|
*/
|
|
492
492
|
async appendField(field, value) {
|
|
@@ -511,7 +511,7 @@ class TestCafe extends Helper {
|
|
|
511
511
|
*
|
|
512
512
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
513
513
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
514
|
-
*
|
|
514
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
515
515
|
*
|
|
516
516
|
*/
|
|
517
517
|
async attachFile(field, pathToFile) {
|
|
@@ -537,7 +537,7 @@ class TestCafe extends Helper {
|
|
|
537
537
|
* ```
|
|
538
538
|
*
|
|
539
539
|
* @param {string|string[]} key key or array of keys to press.
|
|
540
|
-
*
|
|
540
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
541
541
|
*
|
|
542
542
|
* {{ keys }}
|
|
543
543
|
*/
|
|
@@ -561,7 +561,7 @@ class TestCafe extends Helper {
|
|
|
561
561
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
562
562
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
563
563
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
564
|
-
*
|
|
564
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
565
565
|
*
|
|
566
566
|
*/
|
|
567
567
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -586,7 +586,7 @@ class TestCafe extends Helper {
|
|
|
586
586
|
*
|
|
587
587
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
588
588
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
589
|
-
*
|
|
589
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
590
590
|
*
|
|
591
591
|
*/
|
|
592
592
|
async doubleClick(locator, context = null) {
|
|
@@ -617,7 +617,7 @@ class TestCafe extends Helper {
|
|
|
617
617
|
*
|
|
618
618
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
619
619
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
620
|
-
*
|
|
620
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
621
621
|
*
|
|
622
622
|
*/
|
|
623
623
|
async rightClick(locator, context = null) {
|
|
@@ -647,7 +647,7 @@ class TestCafe extends Helper {
|
|
|
647
647
|
* ```
|
|
648
648
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
649
649
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
650
|
-
*
|
|
650
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
651
651
|
*/
|
|
652
652
|
async checkOption(field, context = null) {
|
|
653
653
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -670,7 +670,7 @@ class TestCafe extends Helper {
|
|
|
670
670
|
* ```
|
|
671
671
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
672
672
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
673
|
-
*
|
|
673
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
674
674
|
*/
|
|
675
675
|
async uncheckOption(field, context = null) {
|
|
676
676
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -692,7 +692,7 @@ class TestCafe extends Helper {
|
|
|
692
692
|
* ```
|
|
693
693
|
*
|
|
694
694
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
695
|
-
*
|
|
695
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
696
696
|
*/
|
|
697
697
|
async seeCheckboxIsChecked(field) {
|
|
698
698
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -708,7 +708,7 @@ class TestCafe extends Helper {
|
|
|
708
708
|
* ```
|
|
709
709
|
*
|
|
710
710
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
711
|
-
*
|
|
711
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
712
712
|
*/
|
|
713
713
|
async dontSeeCheckboxIsChecked(field) {
|
|
714
714
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -735,7 +735,7 @@ class TestCafe extends Helper {
|
|
|
735
735
|
* ```
|
|
736
736
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
737
737
|
* @param {string|Array<*>} option visible text or value of option.
|
|
738
|
-
*
|
|
738
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
739
739
|
*/
|
|
740
740
|
async selectOption(select, option) {
|
|
741
741
|
const els = await findFields.call(this, select);
|
|
@@ -787,7 +787,7 @@ class TestCafe extends Helper {
|
|
|
787
787
|
* ```
|
|
788
788
|
*
|
|
789
789
|
* @param {string} url a fragment to check
|
|
790
|
-
*
|
|
790
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
791
791
|
*/
|
|
792
792
|
async seeInCurrentUrl(url) {
|
|
793
793
|
stringIncludes('url').assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -797,7 +797,7 @@ class TestCafe extends Helper {
|
|
|
797
797
|
* Checks that current url does not contain a provided fragment.
|
|
798
798
|
*
|
|
799
799
|
* @param {string} url value to check.
|
|
800
|
-
*
|
|
800
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
801
801
|
*/
|
|
802
802
|
async dontSeeInCurrentUrl(url) {
|
|
803
803
|
stringIncludes('url').negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -814,7 +814,7 @@ class TestCafe extends Helper {
|
|
|
814
814
|
* ```
|
|
815
815
|
*
|
|
816
816
|
* @param {string} url value to check.
|
|
817
|
-
*
|
|
817
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
818
818
|
*/
|
|
819
819
|
async seeCurrentUrlEquals(url) {
|
|
820
820
|
urlEquals(this.options.url).assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -830,7 +830,7 @@ class TestCafe extends Helper {
|
|
|
830
830
|
* ```
|
|
831
831
|
*
|
|
832
832
|
* @param {string} url value to check.
|
|
833
|
-
*
|
|
833
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
834
834
|
*/
|
|
835
835
|
async dontSeeCurrentUrlEquals(url) {
|
|
836
836
|
urlEquals(this.options.url).negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -847,7 +847,7 @@ class TestCafe extends Helper {
|
|
|
847
847
|
* ```
|
|
848
848
|
* @param {string} text expected on page.
|
|
849
849
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
850
|
-
*
|
|
850
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
851
851
|
*
|
|
852
852
|
*/
|
|
853
853
|
async see(text, context = null) {
|
|
@@ -874,7 +874,7 @@ class TestCafe extends Helper {
|
|
|
874
874
|
*
|
|
875
875
|
* @param {string} text which is not present.
|
|
876
876
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
877
|
-
*
|
|
877
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
878
878
|
*
|
|
879
879
|
*/
|
|
880
880
|
async dontSee(text, context = null) {
|
|
@@ -898,7 +898,7 @@ class TestCafe extends Helper {
|
|
|
898
898
|
* I.seeElement('#modal');
|
|
899
899
|
* ```
|
|
900
900
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
901
|
-
*
|
|
901
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
902
902
|
*/
|
|
903
903
|
async seeElement(locator) {
|
|
904
904
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -915,7 +915,7 @@ class TestCafe extends Helper {
|
|
|
915
915
|
* ```
|
|
916
916
|
*
|
|
917
917
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
918
|
-
*
|
|
918
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
919
919
|
*/
|
|
920
920
|
async dontSeeElement(locator) {
|
|
921
921
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -932,7 +932,7 @@ class TestCafe extends Helper {
|
|
|
932
932
|
* I.seeElementInDOM('#modal');
|
|
933
933
|
* ```
|
|
934
934
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
935
|
-
*
|
|
935
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
936
936
|
*/
|
|
937
937
|
async seeElementInDOM(locator) {
|
|
938
938
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -949,7 +949,7 @@ class TestCafe extends Helper {
|
|
|
949
949
|
* ```
|
|
950
950
|
*
|
|
951
951
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
952
|
-
*
|
|
952
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
953
953
|
*/
|
|
954
954
|
async dontSeeElementInDOM(locator) {
|
|
955
955
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -968,7 +968,7 @@ class TestCafe extends Helper {
|
|
|
968
968
|
*
|
|
969
969
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
970
970
|
* @param {number} num number of elements.
|
|
971
|
-
*
|
|
971
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
972
972
|
*
|
|
973
973
|
*/
|
|
974
974
|
async seeNumberOfVisibleElements(locator, num) {
|
|
@@ -1006,7 +1006,7 @@ class TestCafe extends Helper {
|
|
|
1006
1006
|
* ```
|
|
1007
1007
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1008
1008
|
* @param {string} value value to check.
|
|
1009
|
-
*
|
|
1009
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1010
1010
|
*/
|
|
1011
1011
|
async seeInField(field, value) {
|
|
1012
1012
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1030,7 +1030,7 @@ class TestCafe extends Helper {
|
|
|
1030
1030
|
*
|
|
1031
1031
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1032
1032
|
* @param {string} value value to check.
|
|
1033
|
-
*
|
|
1033
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1034
1034
|
*/
|
|
1035
1035
|
async dontSeeInField(field, value) {
|
|
1036
1036
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1064,7 +1064,7 @@ class TestCafe extends Helper {
|
|
|
1064
1064
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1065
1065
|
* ```
|
|
1066
1066
|
* @param {string} text value to check.
|
|
1067
|
-
*
|
|
1067
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1068
1068
|
*/
|
|
1069
1069
|
async seeInSource(text) {
|
|
1070
1070
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1079,7 +1079,7 @@ class TestCafe extends Helper {
|
|
|
1079
1079
|
* ```
|
|
1080
1080
|
*
|
|
1081
1081
|
* @param {string} value to check.
|
|
1082
|
-
*
|
|
1082
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1083
1083
|
*/
|
|
1084
1084
|
async dontSeeInSource(text) {
|
|
1085
1085
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1096,7 +1096,7 @@ class TestCafe extends Helper {
|
|
|
1096
1096
|
*
|
|
1097
1097
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1098
1098
|
* @param {string} fileName file name to save.
|
|
1099
|
-
*
|
|
1099
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1100
1100
|
*
|
|
1101
1101
|
*/
|
|
1102
1102
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -1122,7 +1122,7 @@ class TestCafe extends Helper {
|
|
|
1122
1122
|
*
|
|
1123
1123
|
* @param {string} fileName file name to save.
|
|
1124
1124
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1125
|
-
*
|
|
1125
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1126
1126
|
*/
|
|
1127
1127
|
// TODO Implement full page screenshots
|
|
1128
1128
|
async saveScreenshot(fileName) {
|
|
@@ -1141,7 +1141,7 @@ class TestCafe extends Helper {
|
|
|
1141
1141
|
* ```
|
|
1142
1142
|
*
|
|
1143
1143
|
* @param {number} sec number of second to wait.
|
|
1144
|
-
*
|
|
1144
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1145
1145
|
*/
|
|
1146
1146
|
async wait(sec) {
|
|
1147
1147
|
return new Promise(((done) => {
|
|
@@ -1175,7 +1175,7 @@ class TestCafe extends Helper {
|
|
|
1175
1175
|
*
|
|
1176
1176
|
* @param {string|function} fn function to be executed in browser context.
|
|
1177
1177
|
* @param {...any} args to be passed to function.
|
|
1178
|
-
*
|
|
1178
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1179
1179
|
*
|
|
1180
1180
|
*
|
|
1181
1181
|
* If a function returns a Promise It will wait for it resolution.
|
|
@@ -1388,7 +1388,7 @@ class TestCafe extends Helper {
|
|
|
1388
1388
|
* ```js
|
|
1389
1389
|
* I.scrollPageToTop();
|
|
1390
1390
|
* ```
|
|
1391
|
-
*
|
|
1391
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1392
1392
|
*/
|
|
1393
1393
|
scrollPageToTop() {
|
|
1394
1394
|
return ClientFunction(() => window.scrollTo(0, 0)).with({ boundTestRun: this.t })().catch(mapError);
|
|
@@ -1400,7 +1400,7 @@ class TestCafe extends Helper {
|
|
|
1400
1400
|
* ```js
|
|
1401
1401
|
* I.scrollPageToBottom();
|
|
1402
1402
|
* ```
|
|
1403
|
-
*
|
|
1403
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1404
1404
|
*/
|
|
1405
1405
|
scrollPageToBottom() {
|
|
1406
1406
|
return ClientFunction(() => {
|
|
@@ -1425,7 +1425,7 @@ class TestCafe extends Helper {
|
|
|
1425
1425
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1426
1426
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1427
1427
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1428
|
-
*
|
|
1428
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1429
1429
|
*/
|
|
1430
1430
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1431
1431
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1464,7 +1464,7 @@ class TestCafe extends Helper {
|
|
|
1464
1464
|
* ```
|
|
1465
1465
|
*
|
|
1466
1466
|
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1467
|
-
*
|
|
1467
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1468
1468
|
*/
|
|
1469
1469
|
async switchTo(locator) {
|
|
1470
1470
|
if (Number.isInteger(locator)) {
|
|
@@ -1497,7 +1497,7 @@ class TestCafe extends Helper {
|
|
|
1497
1497
|
* ```
|
|
1498
1498
|
*
|
|
1499
1499
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
1500
|
-
*
|
|
1500
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1501
1501
|
*/
|
|
1502
1502
|
async setCookie(cookie) {
|
|
1503
1503
|
if (Array.isArray(cookie)) {
|
|
@@ -1522,7 +1522,7 @@ class TestCafe extends Helper {
|
|
|
1522
1522
|
* ```
|
|
1523
1523
|
*
|
|
1524
1524
|
* @param {string} name cookie name.
|
|
1525
|
-
*
|
|
1525
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1526
1526
|
*
|
|
1527
1527
|
*/
|
|
1528
1528
|
async seeCookie(name) {
|
|
@@ -1538,7 +1538,7 @@ class TestCafe extends Helper {
|
|
|
1538
1538
|
* ```
|
|
1539
1539
|
*
|
|
1540
1540
|
* @param {string} name cookie name.
|
|
1541
|
-
*
|
|
1541
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1542
1542
|
*/
|
|
1543
1543
|
async dontSeeCookie(name) {
|
|
1544
1544
|
const cookie = await this.grabCookie(name);
|
|
@@ -1588,7 +1588,7 @@ class TestCafe extends Helper {
|
|
|
1588
1588
|
* ```
|
|
1589
1589
|
*
|
|
1590
1590
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
1591
|
-
*
|
|
1591
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1592
1592
|
*/
|
|
1593
1593
|
async clearCookie(cookieName) {
|
|
1594
1594
|
const clearCookies = ClientFunction(() => {
|
|
@@ -1616,7 +1616,7 @@ class TestCafe extends Helper {
|
|
|
1616
1616
|
*
|
|
1617
1617
|
* @param {string} urlPart value to check.
|
|
1618
1618
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1619
|
-
*
|
|
1619
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1620
1620
|
*/
|
|
1621
1621
|
async waitInUrl(urlPart, sec = null) {
|
|
1622
1622
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1642,7 +1642,7 @@ class TestCafe extends Helper {
|
|
|
1642
1642
|
*
|
|
1643
1643
|
* @param {string} urlPart value to check.
|
|
1644
1644
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1645
|
-
*
|
|
1645
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1646
1646
|
*/
|
|
1647
1647
|
async waitUrlEquals(urlPart, sec = null) {
|
|
1648
1648
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1680,7 +1680,7 @@ class TestCafe extends Helper {
|
|
|
1680
1680
|
* @param {string|function} fn to be executed in browser context.
|
|
1681
1681
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
1682
1682
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1683
|
-
*
|
|
1683
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1684
1684
|
*/
|
|
1685
1685
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
1686
1686
|
let args = [];
|
|
@@ -1708,7 +1708,7 @@ class TestCafe extends Helper {
|
|
|
1708
1708
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1709
1709
|
* @param {number} num number of elements.
|
|
1710
1710
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1711
|
-
*
|
|
1711
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1712
1712
|
*/
|
|
1713
1713
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
1714
1714
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1730,7 +1730,7 @@ class TestCafe extends Helper {
|
|
|
1730
1730
|
*
|
|
1731
1731
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1732
1732
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1733
|
-
*
|
|
1733
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1734
1734
|
*/
|
|
1735
1735
|
async waitForElement(locator, sec) {
|
|
1736
1736
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1750,7 +1750,7 @@ class TestCafe extends Helper {
|
|
|
1750
1750
|
*
|
|
1751
1751
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1752
1752
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1753
|
-
*
|
|
1753
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1754
1754
|
*/
|
|
1755
1755
|
async waitToHide(locator, sec) {
|
|
1756
1756
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1770,7 +1770,7 @@ class TestCafe extends Helper {
|
|
|
1770
1770
|
*
|
|
1771
1771
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1772
1772
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1773
|
-
*
|
|
1773
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1774
1774
|
*/
|
|
1775
1775
|
async waitForInvisible(locator, sec) {
|
|
1776
1776
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1793,7 +1793,7 @@ class TestCafe extends Helper {
|
|
|
1793
1793
|
* @param {string }text to wait for.
|
|
1794
1794
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1795
1795
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1796
|
-
*
|
|
1796
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1797
1797
|
*
|
|
1798
1798
|
*/
|
|
1799
1799
|
async waitForText(text, sec = null, context = null) {
|