codeceptjs 3.3.7-beta.1 → 3.3.7
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/docs/basics.md +2 -3
- package/docs/bdd.md +33 -0
- package/docs/best.md +8 -8
- package/docs/build/Appium.js +60 -22
- package/docs/build/GraphQL.js +6 -6
- package/docs/build/Nightmare.js +4 -4
- package/docs/build/Playwright.js +102 -39
- package/docs/build/Polly.js +0 -0
- package/docs/build/Protractor.js +25 -25
- package/docs/build/Puppeteer.js +7 -7
- package/docs/build/SeleniumWebdriver.js +0 -0
- package/docs/build/TestCafe.js +12 -12
- package/docs/build/WebDriver.js +32 -32
- package/docs/changelog.md +36 -1
- package/docs/helpers/Appium.md +103 -79
- package/docs/helpers/GraphQL.md +6 -6
- package/docs/helpers/Playwright.md +280 -245
- package/docs/helpers/Puppeteer.md +1 -1
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/WebDriver.md +2 -2
- package/docs/playwright.md +14 -0
- package/docs/quickstart.md +40 -13
- package/docs/translation.md +83 -56
- package/docs/typescript.md +49 -3
- package/docs/wiki/Books-&-Posts.md +0 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +0 -0
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -0
- package/docs/wiki/Examples.md +0 -0
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
- package/docs/wiki/Home.md +0 -0
- package/docs/wiki/Release-Process.md +0 -0
- package/docs/wiki/Roadmap.md +0 -0
- package/docs/wiki/Tests.md +0 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
- package/docs/wiki/Videos.md +0 -0
- package/lib/codecept.js +3 -1
- package/lib/command/definitions.js +26 -2
- package/lib/command/generate.js +23 -9
- package/lib/command/init.js +32 -7
- package/lib/command/run.js +5 -1
- package/lib/container.js +15 -15
- package/lib/helper/Appium.js +60 -22
- package/lib/helper/GraphQL.js +6 -6
- package/lib/helper/Nightmare.js +4 -4
- package/lib/helper/Playwright.js +102 -41
- package/lib/helper/Protractor.js +25 -25
- package/lib/helper/Puppeteer.js +7 -7
- package/lib/helper/TestCafe.js +12 -12
- package/lib/helper/WebDriver.js +32 -32
- package/lib/helper/errors/ElementNotFound.js +1 -1
- package/lib/helper/extras/PlaywrightRestartOpts.js +0 -2
- package/lib/interfaces/bdd.js +26 -1
- package/lib/listener/artifacts.js +19 -0
- package/lib/rerun.js +12 -13
- package/lib/step.js +5 -5
- package/lib/translation.js +32 -0
- package/package.json +11 -17
- package/translations/ru-RU.js +1 -0
- package/typings/index.d.ts +29 -1
- package/typings/promiseBasedTypes.d.ts +10466 -0
- package/typings/types.d.ts +62 -12
- package/CHANGELOG.md +0 -2340
package/lib/command/init.js
CHANGED
|
@@ -62,6 +62,12 @@ module.exports = function (initPath) {
|
|
|
62
62
|
print(` Welcome to ${colors.magenta.bold('CodeceptJS')} initialization tool`);
|
|
63
63
|
print(' It will prepare and configure a test environment for you');
|
|
64
64
|
print();
|
|
65
|
+
print(' Useful links:');
|
|
66
|
+
print();
|
|
67
|
+
print(' 👉 How to start testing ASAP: https://codecept.io/quickstart/#init');
|
|
68
|
+
print(' 👉 How to select helper: https://codecept.io/basics/#architecture');
|
|
69
|
+
print(' 👉 TypeScript setup: https://codecept.io/typescript/#getting-started');
|
|
70
|
+
print();
|
|
65
71
|
|
|
66
72
|
if (!path) {
|
|
67
73
|
print('No test root specified.');
|
|
@@ -105,17 +111,32 @@ module.exports = function (initPath) {
|
|
|
105
111
|
name: 'helper',
|
|
106
112
|
type: 'list',
|
|
107
113
|
choices: helpers,
|
|
114
|
+
default: 'Playwright',
|
|
108
115
|
message: 'What helpers do you want to use?',
|
|
109
116
|
},
|
|
117
|
+
{
|
|
118
|
+
name: 'jsonResponse',
|
|
119
|
+
type: 'confirm',
|
|
120
|
+
default: true,
|
|
121
|
+
message: 'Do you want to use JSONResponse helper for assertions on JSON responses? http://bit.ly/3ASVPy9',
|
|
122
|
+
when: (answers) => ['GraphQL', 'REST'].includes(answers.helper) === true,
|
|
123
|
+
},
|
|
110
124
|
{
|
|
111
125
|
name: 'output',
|
|
112
126
|
default: './output',
|
|
113
127
|
message: 'Where should logs, screenshots, and reports to be stored?',
|
|
114
128
|
},
|
|
129
|
+
{
|
|
130
|
+
name: 'promise',
|
|
131
|
+
type: 'confirm',
|
|
132
|
+
default: false,
|
|
133
|
+
message: 'Would you prefer to use promise-based typings for all I.* commands? http://bit.ly/3XIMq6n',
|
|
134
|
+
when: (answers) => answers.typescript,
|
|
135
|
+
},
|
|
115
136
|
{
|
|
116
137
|
name: 'translation',
|
|
117
138
|
type: 'list',
|
|
118
|
-
message: 'Do you want localization for tests?
|
|
139
|
+
message: 'Do you want to enable localization for tests? http://bit.ly/3GNUBbh',
|
|
119
140
|
choices: translations,
|
|
120
141
|
},
|
|
121
142
|
]).then((result) => {
|
|
@@ -134,6 +155,7 @@ module.exports = function (initPath) {
|
|
|
134
155
|
config.tests = result.tests;
|
|
135
156
|
if (isTypeScript) {
|
|
136
157
|
config.tests = `${config.tests.replace(/\.js$/, `.${extension}`)}`;
|
|
158
|
+
config.fullPromiseBased = result.promise;
|
|
137
159
|
}
|
|
138
160
|
|
|
139
161
|
// create a directory tests if it is included in tests path
|
|
@@ -147,6 +169,10 @@ module.exports = function (initPath) {
|
|
|
147
169
|
const helperName = result.helper;
|
|
148
170
|
config.helpers[helperName] = {};
|
|
149
171
|
|
|
172
|
+
if (result.jsonResponse === true) {
|
|
173
|
+
config.helpers.JSONResponse = {};
|
|
174
|
+
}
|
|
175
|
+
|
|
150
176
|
let helperConfigs = [];
|
|
151
177
|
|
|
152
178
|
try {
|
|
@@ -168,12 +194,11 @@ module.exports = function (initPath) {
|
|
|
168
194
|
|
|
169
195
|
const finish = async () => {
|
|
170
196
|
// create steps file by default
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
197
|
+
// no extra step file for typescript (as it doesn't match TS conventions)
|
|
198
|
+
const stepFile = `./steps_file.${extension}`;
|
|
199
|
+
fs.writeFileSync(path.join(testsPath, stepFile), defaultActor);
|
|
200
|
+
config.include.I = isTypeScript === true ? './steps_file' : stepFile;
|
|
201
|
+
print(`Steps file created at ${stepFile}`);
|
|
177
202
|
|
|
178
203
|
let configSource;
|
|
179
204
|
const hasConfigure = isLocal && !initPath;
|
package/lib/command/run.js
CHANGED
|
@@ -8,7 +8,11 @@ module.exports = async function (test, options) {
|
|
|
8
8
|
// registering options globally to use in config
|
|
9
9
|
// Backward compatibility for --profile
|
|
10
10
|
process.profile = options.profile;
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
if (options.profile) {
|
|
13
|
+
process.env.profile = options.profile;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
const configFile = options.config;
|
|
13
17
|
|
|
14
18
|
let config = getConfig(configFile);
|
package/lib/container.js
CHANGED
|
@@ -42,7 +42,7 @@ class Container {
|
|
|
42
42
|
};
|
|
43
43
|
this.createMocha();
|
|
44
44
|
container.helpers = createHelpers(config.helpers || {});
|
|
45
|
-
container.translation = loadTranslation(config.translation || null);
|
|
45
|
+
container.translation = loadTranslation(config.translation || null, config.vocabularies || []);
|
|
46
46
|
container.support = createSupportObjects(config.include || {});
|
|
47
47
|
container.plugins = createPlugins(config.plugins || {}, opts);
|
|
48
48
|
if (config.gherkin) loadGherkinSteps(config.gherkin.steps || []);
|
|
@@ -406,25 +406,25 @@ function getObjectMethods(obj) {
|
|
|
406
406
|
return methods;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
function loadTranslation(
|
|
410
|
-
if (!
|
|
411
|
-
return
|
|
412
|
-
I: 'I',
|
|
413
|
-
actions: {},
|
|
414
|
-
}, false);
|
|
409
|
+
function loadTranslation(locale, vocabularies) {
|
|
410
|
+
if (!locale) {
|
|
411
|
+
return Translation.createEmpty();
|
|
415
412
|
}
|
|
416
413
|
|
|
417
|
-
let
|
|
414
|
+
let translation;
|
|
415
|
+
|
|
418
416
|
// check if it is a known translation
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
} if (fileExists(path.join(global.codecept_dir, translation))) {
|
|
417
|
+
if (Translation.langs[locale]) {
|
|
418
|
+
translation = new Translation(Translation.langs[locale]);
|
|
419
|
+
} else if (fileExists(path.join(global.codecept_dir, locale))) {
|
|
423
420
|
// get from a provided file instead
|
|
424
|
-
|
|
421
|
+
translation = Translation.createDefault();
|
|
422
|
+
translation.loadVocabulary(locale);
|
|
425
423
|
} else {
|
|
426
|
-
|
|
424
|
+
translation = Translation.createDefault();
|
|
427
425
|
}
|
|
428
426
|
|
|
429
|
-
|
|
427
|
+
vocabularies.forEach(v => translation.loadVocabulary(v));
|
|
428
|
+
|
|
429
|
+
return translation;
|
|
430
430
|
}
|
package/lib/helper/Appium.js
CHANGED
|
@@ -2,7 +2,7 @@ let webdriverio;
|
|
|
2
2
|
let wdioV4;
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
5
|
-
const axios = require('axios');
|
|
5
|
+
const axios = require('axios').default;
|
|
6
6
|
|
|
7
7
|
const Webdriver = require('./WebDriver');
|
|
8
8
|
const AssertionFailedError = require('../assert/error');
|
|
@@ -13,6 +13,10 @@ const ConnectionRefused = require('./errors/ConnectionRefused');
|
|
|
13
13
|
|
|
14
14
|
const mobileRoot = '//*';
|
|
15
15
|
const webRoot = 'body';
|
|
16
|
+
const supportedPlatform = {
|
|
17
|
+
android: 'Android',
|
|
18
|
+
iOS: 'iOS',
|
|
19
|
+
};
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Appium helper extends [Webriver](http://codecept.io/helpers/WebDriver/) helper.
|
|
@@ -131,6 +135,7 @@ class Appium extends Webdriver {
|
|
|
131
135
|
super(config);
|
|
132
136
|
|
|
133
137
|
this.isRunning = false;
|
|
138
|
+
this.axios = axios.create();
|
|
134
139
|
|
|
135
140
|
webdriverio = require('webdriverio');
|
|
136
141
|
(!webdriverio.VERSION || webdriverio.VERSION.indexOf('4') !== 0) ? wdioV4 = false : wdioV4 = true;
|
|
@@ -185,7 +190,7 @@ class Appium extends Webdriver {
|
|
|
185
190
|
config.capabilities.app = config.app || config.capabilities.app;
|
|
186
191
|
config.capabilities.platformName = config.platform || config.capabilities.platformName;
|
|
187
192
|
config.capabilities.tunnelIdentifier = config.tunnelIdentifier || config.capabilities.tunnelIdentifier; // Adding the code to connect to sauce labs via sauce tunnel
|
|
188
|
-
config.waitForTimeout
|
|
193
|
+
config.waitForTimeoutInSeconds = config.waitForTimeout / 1000; // convert to seconds
|
|
189
194
|
|
|
190
195
|
// [CodeceptJS compatible] transform host to hostname
|
|
191
196
|
config.hostname = config.host || config.hostname;
|
|
@@ -215,8 +220,8 @@ class Appium extends Webdriver {
|
|
|
215
220
|
name: 'platform',
|
|
216
221
|
message: 'Mobile Platform',
|
|
217
222
|
type: 'list',
|
|
218
|
-
choices: ['iOS',
|
|
219
|
-
default:
|
|
223
|
+
choices: ['iOS', supportedPlatform.android],
|
|
224
|
+
default: supportedPlatform.android,
|
|
220
225
|
}, {
|
|
221
226
|
name: 'device',
|
|
222
227
|
message: 'Device to run tests on',
|
|
@@ -427,6 +432,23 @@ class Appium extends Webdriver {
|
|
|
427
432
|
fn();
|
|
428
433
|
}
|
|
429
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Returns app installation status.
|
|
437
|
+
*
|
|
438
|
+
* ```js
|
|
439
|
+
* I.checkIfAppIsInstalled("com.example.android.apis");
|
|
440
|
+
* ```
|
|
441
|
+
*
|
|
442
|
+
* @param {string} bundleId String ID of bundled app
|
|
443
|
+
* @return {Promise<boolean>}
|
|
444
|
+
*
|
|
445
|
+
* Appium: support only Android
|
|
446
|
+
*/
|
|
447
|
+
async checkIfAppIsInstalled(bundleId) {
|
|
448
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
449
|
+
return this.browser.isAppInstalled(bundleId);
|
|
450
|
+
}
|
|
451
|
+
|
|
430
452
|
/**
|
|
431
453
|
* Check if an app is installed.
|
|
432
454
|
*
|
|
@@ -440,7 +462,7 @@ class Appium extends Webdriver {
|
|
|
440
462
|
* Appium: support only Android
|
|
441
463
|
*/
|
|
442
464
|
async seeAppIsInstalled(bundleId) {
|
|
443
|
-
onlyForApps.call(this,
|
|
465
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
444
466
|
const res = await this.browser.isAppInstalled(bundleId);
|
|
445
467
|
return truth(`app ${bundleId}`, 'to be installed').assert(res);
|
|
446
468
|
}
|
|
@@ -458,7 +480,7 @@ class Appium extends Webdriver {
|
|
|
458
480
|
* Appium: support only Android
|
|
459
481
|
*/
|
|
460
482
|
async seeAppIsNotInstalled(bundleId) {
|
|
461
|
-
onlyForApps.call(this,
|
|
483
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
462
484
|
const res = await this.browser.isAppInstalled(bundleId);
|
|
463
485
|
return truth(`app ${bundleId}`, 'to be installed').negate(res);
|
|
464
486
|
}
|
|
@@ -475,7 +497,7 @@ class Appium extends Webdriver {
|
|
|
475
497
|
* Appium: support only Android
|
|
476
498
|
*/
|
|
477
499
|
async installApp(path) {
|
|
478
|
-
onlyForApps.call(this,
|
|
500
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
479
501
|
return this.browser.installApp(path);
|
|
480
502
|
}
|
|
481
503
|
|
|
@@ -492,19 +514,35 @@ class Appium extends Webdriver {
|
|
|
492
514
|
* @param {string} [bundleId] ID of bundle
|
|
493
515
|
*/
|
|
494
516
|
async removeApp(appId, bundleId) {
|
|
495
|
-
onlyForApps.call(this,
|
|
517
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
496
518
|
|
|
497
519
|
if (wdioV4) {
|
|
498
520
|
return this.browser.removeApp(bundleId);
|
|
499
521
|
}
|
|
500
522
|
|
|
501
|
-
return axios({
|
|
523
|
+
return this.axios({
|
|
502
524
|
method: 'post',
|
|
503
525
|
url: `${this._buildAppiumEndpoint()}/session/${this.browser.sessionId}/appium/device/remove_app`,
|
|
504
526
|
data: { appId, bundleId },
|
|
505
527
|
});
|
|
506
528
|
}
|
|
507
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Reset the currently running app for current session.
|
|
532
|
+
*
|
|
533
|
+
* ```js
|
|
534
|
+
* I.resetApp();
|
|
535
|
+
* ```
|
|
536
|
+
*
|
|
537
|
+
*/
|
|
538
|
+
async resetApp() {
|
|
539
|
+
onlyForApps.call(this);
|
|
540
|
+
return this.axios({
|
|
541
|
+
method: 'post',
|
|
542
|
+
url: `${this._buildAppiumEndpoint()}/session/${this.browser.sessionId}/appium/app/reset`,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
|
|
508
546
|
/**
|
|
509
547
|
* Check current activity on an Android device.
|
|
510
548
|
*
|
|
@@ -517,7 +555,7 @@ class Appium extends Webdriver {
|
|
|
517
555
|
* Appium: support only Android
|
|
518
556
|
*/
|
|
519
557
|
async seeCurrentActivityIs(currentActivity) {
|
|
520
|
-
onlyForApps.call(this,
|
|
558
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
521
559
|
const res = await this.browser.getCurrentActivity();
|
|
522
560
|
return truth('current activity', `to be ${currentActivity}`).assert(res === currentActivity);
|
|
523
561
|
}
|
|
@@ -534,7 +572,7 @@ class Appium extends Webdriver {
|
|
|
534
572
|
* Appium: support only Android
|
|
535
573
|
*/
|
|
536
574
|
async seeDeviceIsLocked() {
|
|
537
|
-
onlyForApps.call(this,
|
|
575
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
538
576
|
const res = await this.browser.isLocked();
|
|
539
577
|
return truth('device', 'to be locked').assert(res);
|
|
540
578
|
}
|
|
@@ -551,7 +589,7 @@ class Appium extends Webdriver {
|
|
|
551
589
|
* Appium: support only Android
|
|
552
590
|
*/
|
|
553
591
|
async seeDeviceIsUnlocked() {
|
|
554
|
-
onlyForApps.call(this,
|
|
592
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
555
593
|
const res = await this.browser.isLocked();
|
|
556
594
|
return truth('device', 'to be locked').negate(res);
|
|
557
595
|
}
|
|
@@ -579,7 +617,7 @@ class Appium extends Webdriver {
|
|
|
579
617
|
currentOrientation = res;
|
|
580
618
|
}
|
|
581
619
|
|
|
582
|
-
const res = await axios({
|
|
620
|
+
const res = await this.axios({
|
|
583
621
|
method: 'get',
|
|
584
622
|
url: `${this._buildAppiumEndpoint()}/session/${this.browser.sessionId}/orientation`,
|
|
585
623
|
});
|
|
@@ -606,7 +644,7 @@ class Appium extends Webdriver {
|
|
|
606
644
|
return this.browser.setOrientation(orientation);
|
|
607
645
|
}
|
|
608
646
|
|
|
609
|
-
return axios({
|
|
647
|
+
return this.axios({
|
|
610
648
|
method: 'post',
|
|
611
649
|
url: `${this._buildAppiumEndpoint()}/session/${this.browser.sessionId}/orientation`,
|
|
612
650
|
data: { orientation },
|
|
@@ -657,7 +695,7 @@ class Appium extends Webdriver {
|
|
|
657
695
|
* Appium: support only Android
|
|
658
696
|
*/
|
|
659
697
|
async grabCurrentActivity() {
|
|
660
|
-
onlyForApps.call(this,
|
|
698
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
661
699
|
return this.browser.getCurrentActivity();
|
|
662
700
|
}
|
|
663
701
|
|
|
@@ -675,7 +713,7 @@ class Appium extends Webdriver {
|
|
|
675
713
|
* Appium: support only Android
|
|
676
714
|
*/
|
|
677
715
|
async grabNetworkConnection() {
|
|
678
|
-
onlyForApps.call(this,
|
|
716
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
679
717
|
const res = await this.browser.getNetworkConnection();
|
|
680
718
|
return {
|
|
681
719
|
value: res,
|
|
@@ -795,7 +833,7 @@ class Appium extends Webdriver {
|
|
|
795
833
|
* @return {Promise<void>}
|
|
796
834
|
*/
|
|
797
835
|
async startActivity(appPackage, appActivity) {
|
|
798
|
-
onlyForApps.call(this,
|
|
836
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
799
837
|
return this.browser.startActivity(appPackage, appActivity);
|
|
800
838
|
}
|
|
801
839
|
|
|
@@ -820,7 +858,7 @@ class Appium extends Webdriver {
|
|
|
820
858
|
* Appium: support only Android
|
|
821
859
|
*/
|
|
822
860
|
async setNetworkConnection(value) {
|
|
823
|
-
onlyForApps.call(this,
|
|
861
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
824
862
|
return this.browser.setNetworkConnection(value);
|
|
825
863
|
}
|
|
826
864
|
|
|
@@ -877,7 +915,7 @@ class Appium extends Webdriver {
|
|
|
877
915
|
* Appium: support only Android
|
|
878
916
|
*/
|
|
879
917
|
async sendDeviceKeyEvent(keyValue) {
|
|
880
|
-
onlyForApps.call(this,
|
|
918
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
881
919
|
if (wdioV4) {
|
|
882
920
|
return this.browser.sendKeyEvent(keyValue);
|
|
883
921
|
}
|
|
@@ -896,7 +934,7 @@ class Appium extends Webdriver {
|
|
|
896
934
|
* Appium: support only Android
|
|
897
935
|
*/
|
|
898
936
|
async openNotifications() {
|
|
899
|
-
onlyForApps.call(this,
|
|
937
|
+
onlyForApps.call(this, supportedPlatform.android);
|
|
900
938
|
return this.browser.openNotifications();
|
|
901
939
|
}
|
|
902
940
|
|
|
@@ -965,7 +1003,7 @@ class Appium extends Webdriver {
|
|
|
965
1003
|
onlyForApps.call(this);
|
|
966
1004
|
const res = await this.browser.$(parseLocator.call(this, locator));
|
|
967
1005
|
// if (!res.length) throw new ElementNotFound(locator, 'was not found in UI');
|
|
968
|
-
return this.performSwipe(await res.getLocation(), { x: await res.getLocation().x + xoffset, y: await res.getLocation().y + yoffset });
|
|
1006
|
+
return this.performSwipe(await res.getLocation(), { x: (await res.getLocation()).x + xoffset, y: (await res.getLocation()).y + yoffset });
|
|
969
1007
|
}
|
|
970
1008
|
/* eslint-enable */
|
|
971
1009
|
|
|
@@ -1148,7 +1186,7 @@ class Appium extends Webdriver {
|
|
|
1148
1186
|
direction = 'swipeRight';
|
|
1149
1187
|
break;
|
|
1150
1188
|
}
|
|
1151
|
-
timeout = timeout || this.options.
|
|
1189
|
+
timeout = timeout || this.options.waitForTimeoutInSeconds;
|
|
1152
1190
|
|
|
1153
1191
|
const errorMsg = `element ("${searchableLocator}") still not visible after ${timeout}seconds`;
|
|
1154
1192
|
const browser = this.browser;
|
package/lib/helper/GraphQL.js
CHANGED
|
@@ -139,9 +139,9 @@ class GraphQL extends Helper {
|
|
|
139
139
|
* ```
|
|
140
140
|
*
|
|
141
141
|
* @param {String} query
|
|
142
|
-
* @param {object} variables that may go along with the query
|
|
143
|
-
* @param {object} options are additional query options
|
|
144
|
-
* @param {object} headers
|
|
142
|
+
* @param {object} [variables] that may go along with the query
|
|
143
|
+
* @param {object} [options] are additional query options
|
|
144
|
+
* @param {object} [headers]
|
|
145
145
|
* @return Promise<any>
|
|
146
146
|
*/
|
|
147
147
|
async sendQuery(query, variables, options = {}, headers = {}) {
|
|
@@ -179,9 +179,9 @@ class GraphQL extends Helper {
|
|
|
179
179
|
* ```
|
|
180
180
|
*
|
|
181
181
|
* @param {String} mutation
|
|
182
|
-
* @param {object} variables that may go along with the mutation
|
|
183
|
-
* @param {object} options are additional query options
|
|
184
|
-
* @param {object} headers
|
|
182
|
+
* @param {object} [variables] that may go along with the mutation
|
|
183
|
+
* @param {object} [options] are additional query options
|
|
184
|
+
* @param {object} [headers]
|
|
185
185
|
* @return Promise<any>
|
|
186
186
|
*/
|
|
187
187
|
async sendMutation(mutation, variables, options = {}, headers = {}) {
|
package/lib/helper/Nightmare.js
CHANGED
|
@@ -128,7 +128,7 @@ class Nightmare extends Helper {
|
|
|
128
128
|
this.evaluate_now((by, locator, contextEl) => {
|
|
129
129
|
const res = window.codeceptjs.findAndStoreElement(by, locator, contextEl);
|
|
130
130
|
if (res === null) {
|
|
131
|
-
throw new Error(`Element ${locator} couldn't be located by ${by}`);
|
|
131
|
+
throw new Error(`Element ${(new Locator(locator))} couldn't be located by ${by}`);
|
|
132
132
|
}
|
|
133
133
|
return res;
|
|
134
134
|
}, done, by, value, contextEl);
|
|
@@ -554,7 +554,7 @@ class Nightmare extends Helper {
|
|
|
554
554
|
*/
|
|
555
555
|
async seeNumberOfElements(locator, num) {
|
|
556
556
|
const elements = await this._locate(locator);
|
|
557
|
-
return equals(`expected number of elements (${locator}) is ${num}, but found ${elements.length}`).assert(elements.length, num);
|
|
557
|
+
return equals(`expected number of elements (${(new Locator(locator))}) is ${num}, but found ${elements.length}`).assert(elements.length, num);
|
|
558
558
|
}
|
|
559
559
|
|
|
560
560
|
/**
|
|
@@ -562,7 +562,7 @@ class Nightmare extends Helper {
|
|
|
562
562
|
*/
|
|
563
563
|
async seeNumberOfVisibleElements(locator, num) {
|
|
564
564
|
const res = await this.grabNumberOfVisibleElements(locator);
|
|
565
|
-
return equals(`expected number of visible elements (${locator}) is ${num}, but found ${res}`).assert(res, num);
|
|
565
|
+
return equals(`expected number of visible elements (${(new Locator(locator))}) is ${num}, but found ${res}`).assert(res, num);
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
/**
|
|
@@ -1168,7 +1168,7 @@ class Nightmare extends Helper {
|
|
|
1168
1168
|
height: Math.floor(rect.height),
|
|
1169
1169
|
};
|
|
1170
1170
|
|
|
1171
|
-
this.debug(`Screenshot of ${locator} element has been saved to ${outputFile}`);
|
|
1171
|
+
this.debug(`Screenshot of ${(new Locator(locator))} element has been saved to ${outputFile}`);
|
|
1172
1172
|
// take the screenshot
|
|
1173
1173
|
await this.browser.screenshot(outputFile, button_clip);
|
|
1174
1174
|
}
|