codeceptjs 3.5.5 → 3.5.6
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/build/FileSystem.js +1 -1
- package/docs/build/Playwright.js +51 -40
- package/docs/build/Puppeteer.js +4 -4
- package/docs/build/WebDriver.js +4 -4
- package/docs/changelog.md +1 -325
- package/docs/community-helpers.md +4 -8
- package/docs/examples.md +2 -8
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Playwright.md +1 -1
- package/docs/helpers/Puppeteer.md +1 -1
- package/docs/helpers/WebDriver.md +1 -1
- package/lib/codecept.js +3 -0
- package/lib/command/info.js +24 -0
- package/lib/command/run-workers.js +3 -2
- package/lib/command/run.js +3 -2
- package/lib/data/context.js +14 -6
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Playwright.js +51 -40
- package/lib/helper/Puppeteer.js +4 -4
- package/lib/helper/WebDriver.js +4 -4
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/pause.js +0 -2
- package/lib/plugin/autoLogin.js +0 -5
- package/lib/plugin/retryTo.js +0 -2
- package/lib/plugin/tryTo.js +0 -3
- package/lib/session.js +1 -1
- package/package.json +13 -13
- package/translations/fr-FR.js +13 -1
- package/typings/promiseBasedTypes.d.ts +1 -1
- package/typings/types.d.ts +5 -5
- package/CHANGELOG.md +0 -2887
package/docs/examples.md
CHANGED
|
@@ -16,7 +16,6 @@ Playground repository where you can run tests in different helpers on a basic si
|
|
|
16
16
|
|
|
17
17
|
Tests repository demonstrate usage of
|
|
18
18
|
|
|
19
|
-
* Playwright helper
|
|
20
19
|
* Puppeteer helper
|
|
21
20
|
* WebDriver helper
|
|
22
21
|
* TestCafe plugin
|
|
@@ -29,6 +28,7 @@ Tests repository demonstrate usage of
|
|
|
29
28
|
CodeceptJS repo contains basic tests (both failing and passing) just to show how it works.
|
|
30
29
|
Our team uses it to test new features and run simple scenarios.
|
|
31
30
|
|
|
31
|
+
|
|
32
32
|
## [CodeceptJS Cucumber E2E Framework](https://github.com/gkushang/codeceptjs-e2e)
|
|
33
33
|
|
|
34
34
|
This repository contains complete E2E framework for CodeceptJS with Cucumber and SauceLabs Integration
|
|
@@ -146,10 +146,4 @@ This is necessary if all integrations with TMS and CI/CD are already configured,
|
|
|
146
146
|
* HTTP request client with session support and unit tests
|
|
147
147
|
* Exemplary code control
|
|
148
148
|
* Ready to launch in a CI/CD system as is
|
|
149
|
-
* OOP, Test data models and builders, endpoint decorators
|
|
150
|
-
|
|
151
|
-
## [Playwright fun with CodeceptJS](https://github.com/PeterNgTr/codeceptjs-playwright-fun)
|
|
152
|
-
* Tests are written in TS
|
|
153
|
-
* CI/CD with Github Actions
|
|
154
|
-
* Page Object Model is applied
|
|
155
|
-
* ReportPortal Integration
|
|
149
|
+
* OOP, Test data models and builders, endpoint decorators
|
|
@@ -74,7 +74,7 @@ Type: [object][5]
|
|
|
74
74
|
- `ignoreLog` **[Array][9]<[string][8]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][44].
|
|
75
75
|
- `ignoreHTTPSErrors` **[boolean][32]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
76
|
- `bypassCSP` **[boolean][32]?** bypass Content Security Policy or CSP
|
|
77
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
77
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -56,7 +56,7 @@ Type: [object][4]
|
|
|
56
56
|
- `manualStart` **[boolean][20]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
57
57
|
- `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
58
58
|
- `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
|
|
59
|
-
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false
|
|
59
|
+
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -45,7 +45,7 @@ Type: [object][16]
|
|
|
45
45
|
- `desiredCapabilities` **[object][16]?** Selenium's [desired capabilities][6].
|
|
46
46
|
- `manualStart` **[boolean][32]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
47
47
|
- `timeouts` **[object][16]?** [WebDriver timeouts][37] defined as hash.
|
|
48
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
48
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
package/lib/codecept.js
CHANGED
package/lib/command/info.js
CHANGED
|
@@ -37,3 +37,27 @@ module.exports = async function (path) {
|
|
|
37
37
|
output.print('Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues');
|
|
38
38
|
output.print('***************************************');
|
|
39
39
|
};
|
|
40
|
+
|
|
41
|
+
module.exports.getMachineInfo = async () => {
|
|
42
|
+
const info = {
|
|
43
|
+
nodeInfo: await envinfo.helpers.getNodeInfo(),
|
|
44
|
+
osInfo: await envinfo.helpers.getOSInfo(),
|
|
45
|
+
cpuInfo: await envinfo.helpers.getCPUInfo(),
|
|
46
|
+
chromeInfo: await envinfo.helpers.getChromeInfo(),
|
|
47
|
+
edgeInfo: await envinfo.helpers.getEdgeInfo(),
|
|
48
|
+
firefoxInfo: await envinfo.helpers.getFirefoxInfo(),
|
|
49
|
+
safariInfo: await envinfo.helpers.getSafariInfo(),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
output.print('***************************************');
|
|
53
|
+
for (const [key, value] of Object.entries(info)) {
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
output.print(`${key}: ${value[1]}`);
|
|
56
|
+
} else {
|
|
57
|
+
output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
output.print('If you need more detailed info, just run this: npx codeceptjs info');
|
|
61
|
+
output.print('***************************************');
|
|
62
|
+
return info;
|
|
63
|
+
};
|
|
@@ -40,8 +40,9 @@ module.exports = async function (workerCount, selectedRuns, options) {
|
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
42
|
if (options.verbose) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
global.debugMode = true;
|
|
44
|
+
const { getMachineInfo } = require('./info');
|
|
45
|
+
await getMachineInfo();
|
|
45
46
|
}
|
|
46
47
|
await workers.bootstrapAll();
|
|
47
48
|
await workers.run();
|
package/lib/command/run.js
CHANGED
|
@@ -30,8 +30,9 @@ module.exports = async function (test, options) {
|
|
|
30
30
|
codecept.loadTests(test);
|
|
31
31
|
|
|
32
32
|
if (options.verbose) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
global.debugMode = true;
|
|
34
|
+
const { getMachineInfo } = require('./info');
|
|
35
|
+
await getMachineInfo();
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
await codecept.run();
|
package/lib/data/context.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = function (context) {
|
|
|
23
23
|
.inject({ current: dataRow.data }));
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
maskSecretInTitle(scenarios);
|
|
26
27
|
return new DataScenarioConfig(scenarios);
|
|
27
28
|
},
|
|
28
29
|
only: {
|
|
@@ -42,6 +43,7 @@ module.exports = function (context) {
|
|
|
42
43
|
.inject({ current: dataRow.data }));
|
|
43
44
|
}
|
|
44
45
|
});
|
|
46
|
+
maskSecretInTitle(scenarios);
|
|
45
47
|
return new DataScenarioConfig(scenarios);
|
|
46
48
|
},
|
|
47
49
|
},
|
|
@@ -71,12 +73,6 @@ function replaceTitle(title, dataRow) {
|
|
|
71
73
|
// it should be printed
|
|
72
74
|
if (Object.prototype.toString.call(dataRow.data) === (Object()).toString()
|
|
73
75
|
&& dataRow.data.toString() !== (Object()).toString()) {
|
|
74
|
-
Object.entries(dataRow.data).forEach(entry => {
|
|
75
|
-
const [key, value] = entry;
|
|
76
|
-
if (value instanceof Secret) {
|
|
77
|
-
dataRow.data[key] = value.getMasked();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
76
|
return `${title} | ${dataRow.data}`;
|
|
81
77
|
}
|
|
82
78
|
|
|
@@ -119,3 +115,15 @@ function detectDataType(dataTable) {
|
|
|
119
115
|
|
|
120
116
|
throw new Error('Invalid data type. Data accepts either: DataTable || generator || Array || function');
|
|
121
117
|
}
|
|
118
|
+
|
|
119
|
+
function maskSecretInTitle(scenarios) {
|
|
120
|
+
scenarios.forEach(scenario => {
|
|
121
|
+
const res = [];
|
|
122
|
+
|
|
123
|
+
scenario.test.title.split(',').forEach(item => {
|
|
124
|
+
res.push(item.replace(/{"_secret":"(.*)"}/, '"*****"'));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
scenario.test.title = res.join(',');
|
|
128
|
+
});
|
|
129
|
+
}
|
package/lib/helper/FileSystem.js
CHANGED
package/lib/helper/Playwright.js
CHANGED
|
@@ -47,7 +47,6 @@ const {
|
|
|
47
47
|
setRestartStrategy, restartsSession, restartsContext, restartsBrowser,
|
|
48
48
|
} = require('./extras/PlaywrightRestartOpts');
|
|
49
49
|
const { createValueEngine, createDisabledEngine } = require('./extras/PlaywrightPropEngine');
|
|
50
|
-
const { highlightElement } = require('./scripts/highlightElement');
|
|
51
50
|
|
|
52
51
|
const pathSeparator = path.sep;
|
|
53
52
|
|
|
@@ -94,7 +93,7 @@ const pathSeparator = path.sep;
|
|
|
94
93
|
* @prop {string[]} [ignoreLog] - An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
|
|
95
94
|
* @prop {boolean} [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
96
95
|
* @prop {boolean} [bypassCSP] - bypass Content Security Policy or CSP
|
|
97
|
-
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
|
|
96
|
+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
98
97
|
*/
|
|
99
98
|
const config = {};
|
|
100
99
|
|
|
@@ -827,8 +826,9 @@ class Playwright extends Helper {
|
|
|
827
826
|
|
|
828
827
|
async _stopBrowser() {
|
|
829
828
|
this.withinLocator = null;
|
|
830
|
-
this._setPage(null);
|
|
829
|
+
await this._setPage(null);
|
|
831
830
|
this.context = null;
|
|
831
|
+
this.frame = null;
|
|
832
832
|
popupStore.clear();
|
|
833
833
|
await this.browser.close();
|
|
834
834
|
}
|
|
@@ -867,6 +867,7 @@ class Playwright extends Helper {
|
|
|
867
867
|
this.withinLocator = null;
|
|
868
868
|
this.context = await this.page;
|
|
869
869
|
this.contextLocator = null;
|
|
870
|
+
this.frame = null;
|
|
870
871
|
}
|
|
871
872
|
|
|
872
873
|
_extractDataFromPerformanceTiming(timing, ...dataNames) {
|
|
@@ -1156,6 +1157,9 @@ class Playwright extends Helper {
|
|
|
1156
1157
|
*/
|
|
1157
1158
|
async _locate(locator) {
|
|
1158
1159
|
const context = await this.context || await this._getContext();
|
|
1160
|
+
|
|
1161
|
+
if (this.frame) return findElements(this.frame, locator);
|
|
1162
|
+
|
|
1159
1163
|
return findElements(context, locator);
|
|
1160
1164
|
}
|
|
1161
1165
|
|
|
@@ -1579,7 +1583,7 @@ class Playwright extends Helper {
|
|
|
1579
1583
|
|
|
1580
1584
|
await el.clear();
|
|
1581
1585
|
|
|
1582
|
-
highlightActiveElement.call(this, el
|
|
1586
|
+
await highlightActiveElement.call(this, el);
|
|
1583
1587
|
|
|
1584
1588
|
await el.type(value.toString(), { delay: this.options.pressKeyDelay });
|
|
1585
1589
|
|
|
@@ -1609,7 +1613,7 @@ class Playwright extends Helper {
|
|
|
1609
1613
|
|
|
1610
1614
|
const el = els[0];
|
|
1611
1615
|
|
|
1612
|
-
highlightActiveElement.call(this, el
|
|
1616
|
+
await highlightActiveElement.call(this, el);
|
|
1613
1617
|
|
|
1614
1618
|
await el.clear();
|
|
1615
1619
|
|
|
@@ -1624,7 +1628,7 @@ class Playwright extends Helper {
|
|
|
1624
1628
|
async appendField(field, value) {
|
|
1625
1629
|
const els = await findFields.call(this, field);
|
|
1626
1630
|
assertElementExists(els, field, 'Field');
|
|
1627
|
-
highlightActiveElement.call(this, els[0]
|
|
1631
|
+
await highlightActiveElement.call(this, els[0]);
|
|
1628
1632
|
await els[0].press('End');
|
|
1629
1633
|
await els[0].type(value.toString(), { delay: this.options.pressKeyDelay });
|
|
1630
1634
|
return this._waitForAction();
|
|
@@ -1670,7 +1674,7 @@ class Playwright extends Helper {
|
|
|
1670
1674
|
assertElementExists(els, select, 'Selectable field');
|
|
1671
1675
|
const el = els[0];
|
|
1672
1676
|
|
|
1673
|
-
highlightActiveElement.call(this, el
|
|
1677
|
+
await highlightActiveElement.call(this, el);
|
|
1674
1678
|
|
|
1675
1679
|
if (!Array.isArray(option)) option = [option];
|
|
1676
1680
|
|
|
@@ -1882,11 +1886,11 @@ class Playwright extends Helper {
|
|
|
1882
1886
|
* @returns {Promise<any>}
|
|
1883
1887
|
*/
|
|
1884
1888
|
async executeScript(fn, arg) {
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1889
|
+
if (this.context && this.context.constructor.name === 'FrameLocator') {
|
|
1890
|
+
// switching to iframe context
|
|
1891
|
+
return this.context.locator(':root').evaluate(fn, arg);
|
|
1888
1892
|
}
|
|
1889
|
-
return
|
|
1893
|
+
return this.page.evaluate.apply(this.page, [fn, arg]);
|
|
1890
1894
|
}
|
|
1891
1895
|
|
|
1892
1896
|
/**
|
|
@@ -2408,7 +2412,7 @@ class Playwright extends Helper {
|
|
|
2408
2412
|
}
|
|
2409
2413
|
|
|
2410
2414
|
async _getContext() {
|
|
2411
|
-
if (this.context && this.context.constructor.name === '
|
|
2415
|
+
if (this.context && this.context.constructor.name === 'FrameLocator') {
|
|
2412
2416
|
return this.context;
|
|
2413
2417
|
}
|
|
2414
2418
|
return this.page;
|
|
@@ -2481,6 +2485,14 @@ class Playwright extends Helper {
|
|
|
2481
2485
|
}, [locator.value, text, $XPath.toString()], { timeout: waitTimeout });
|
|
2482
2486
|
}
|
|
2483
2487
|
} else {
|
|
2488
|
+
// we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
|
|
2489
|
+
if (this.frame) {
|
|
2490
|
+
const { setTimeout } = require('timers/promises');
|
|
2491
|
+
await setTimeout(waitTimeout);
|
|
2492
|
+
waiter = await this.frame.locator(`:has-text('${text}')`).first().isVisible();
|
|
2493
|
+
if (!waiter) throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec`);
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2484
2496
|
waiter = contextObject.waitForFunction(text => document.body && document.body.innerText.indexOf(text) > -1, text, { timeout: waitTimeout });
|
|
2485
2497
|
}
|
|
2486
2498
|
return waiter.catch((err) => {
|
|
@@ -2535,37 +2547,37 @@ class Playwright extends Helper {
|
|
|
2535
2547
|
}
|
|
2536
2548
|
|
|
2537
2549
|
if (locator >= 0 && locator < childFrames.length) {
|
|
2538
|
-
this.context =
|
|
2550
|
+
this.context = await this.page.frameLocator('iframe').nth(locator);
|
|
2539
2551
|
this.contextLocator = locator;
|
|
2540
2552
|
} else {
|
|
2541
2553
|
throw new Error('Element #invalidIframeSelector was not found by text|CSS|XPath');
|
|
2542
2554
|
}
|
|
2543
2555
|
return;
|
|
2544
2556
|
}
|
|
2545
|
-
let contentFrame;
|
|
2546
2557
|
|
|
2547
2558
|
if (!locator) {
|
|
2548
|
-
this.context =
|
|
2559
|
+
this.context = this.page;
|
|
2549
2560
|
this.contextLocator = null;
|
|
2561
|
+
this.frame = null;
|
|
2550
2562
|
return;
|
|
2551
2563
|
}
|
|
2552
2564
|
|
|
2553
2565
|
// iframe by selector
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2566
|
+
locator = buildLocatorString(new Locator(locator, 'css'));
|
|
2567
|
+
const frame = await this._locateElement(locator);
|
|
2568
|
+
|
|
2569
|
+
if (!frame) {
|
|
2570
|
+
throw new Error(`Frame ${JSON.stringify(locator)} was not found by text|CSS|XPath`);
|
|
2557
2571
|
}
|
|
2558
2572
|
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
// get content of the iframe using its name
|
|
2564
|
-
} else if (locator.value.toLowerCase().includes('name=')) {
|
|
2565
|
-
const frameName = locator.value.split('=')[1].replace(/"/g, '').replaceAll(/]/g, '');
|
|
2566
|
-
contentFrame = await this.page.frame(frameName);
|
|
2573
|
+
if (this.frame) {
|
|
2574
|
+
this.frame = await this.frame.frameLocator(locator);
|
|
2575
|
+
} else {
|
|
2576
|
+
this.frame = await this.page.frameLocator(locator);
|
|
2567
2577
|
}
|
|
2568
2578
|
|
|
2579
|
+
const contentFrame = this.frame;
|
|
2580
|
+
|
|
2569
2581
|
if (contentFrame) {
|
|
2570
2582
|
this.context = contentFrame;
|
|
2571
2583
|
this.contextLocator = null;
|
|
@@ -3260,7 +3272,7 @@ async function findElement(matcher, locator) {
|
|
|
3260
3272
|
if (locator.react) return findReact(matcher, locator);
|
|
3261
3273
|
locator = new Locator(locator, 'css');
|
|
3262
3274
|
|
|
3263
|
-
return matcher.locator(buildLocatorString(locator));
|
|
3275
|
+
return matcher.locator(buildLocatorString(locator)).first();
|
|
3264
3276
|
}
|
|
3265
3277
|
|
|
3266
3278
|
async function getVisibleElements(elements) {
|
|
@@ -3290,7 +3302,7 @@ async function proceedClick(locator, context = null, options = {}) {
|
|
|
3290
3302
|
assertElementExists(els, locator, 'Clickable element');
|
|
3291
3303
|
}
|
|
3292
3304
|
|
|
3293
|
-
highlightActiveElement.call(this, els[0]
|
|
3305
|
+
await highlightActiveElement.call(this, els[0]);
|
|
3294
3306
|
|
|
3295
3307
|
/*
|
|
3296
3308
|
using the force true options itself but instead dispatching a click
|
|
@@ -3340,13 +3352,9 @@ async function proceedSee(assertType, text, context, strict = false) {
|
|
|
3340
3352
|
let allText;
|
|
3341
3353
|
|
|
3342
3354
|
if (!context) {
|
|
3343
|
-
|
|
3344
|
-
if (el && !el.getProperty) {
|
|
3345
|
-
// Fallback to body
|
|
3346
|
-
el = await this.page.$('body');
|
|
3347
|
-
}
|
|
3355
|
+
const el = await this.context;
|
|
3348
3356
|
|
|
3349
|
-
allText = [await el.innerText()];
|
|
3357
|
+
allText = [await el.locator('body').innerText()];
|
|
3350
3358
|
description = 'web application';
|
|
3351
3359
|
} else {
|
|
3352
3360
|
const locator = new Locator(context, 'css');
|
|
@@ -3519,8 +3527,7 @@ async function elementSelected(element) {
|
|
|
3519
3527
|
function isFrameLocator(locator) {
|
|
3520
3528
|
locator = new Locator(locator);
|
|
3521
3529
|
if (locator.isFrame()) {
|
|
3522
|
-
|
|
3523
|
-
return _locator.value;
|
|
3530
|
+
return locator.value;
|
|
3524
3531
|
}
|
|
3525
3532
|
return false;
|
|
3526
3533
|
}
|
|
@@ -3716,10 +3723,14 @@ async function saveTraceForContext(context, name) {
|
|
|
3716
3723
|
return fileName;
|
|
3717
3724
|
}
|
|
3718
3725
|
|
|
3719
|
-
function highlightActiveElement(element
|
|
3720
|
-
if (
|
|
3721
|
-
|
|
3722
|
-
|
|
3726
|
+
async function highlightActiveElement(element) {
|
|
3727
|
+
if (this.options.highlightElement && global.debugMode) {
|
|
3728
|
+
await element.evaluate(el => {
|
|
3729
|
+
const prevStyle = el.style.boxShadow;
|
|
3730
|
+
el.style.boxShadow = '0px 0px 4px 3px rgba(255, 0, 0, 0.7)';
|
|
3731
|
+
setTimeout(() => el.style.boxShadow = prevStyle, 2000);
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3723
3734
|
}
|
|
3724
3735
|
|
|
3725
3736
|
const createAdvancedTestResults = (url, dataToCheck, requests) => {
|
package/lib/helper/Puppeteer.js
CHANGED
|
@@ -69,7 +69,7 @@ const consoleLogStore = new Console();
|
|
|
69
69
|
* @prop {boolean} [manualStart=false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
70
70
|
* @prop {string} [browser=chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
71
71
|
* @prop {object} [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
72
|
-
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
|
|
72
|
+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
73
73
|
*/
|
|
74
74
|
const config = {};
|
|
75
75
|
|
|
@@ -2727,7 +2727,7 @@ function getNormalizedKey(key) {
|
|
|
2727
2727
|
}
|
|
2728
2728
|
|
|
2729
2729
|
function highlightActiveElement(element, context) {
|
|
2730
|
-
if (
|
|
2731
|
-
|
|
2732
|
-
|
|
2730
|
+
if (this.options.highlightElement && global.debugMode) {
|
|
2731
|
+
highlightElement(element, context);
|
|
2732
|
+
}
|
|
2733
2733
|
}
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -62,7 +62,7 @@ const webRoot = 'body';
|
|
|
62
62
|
* @prop {object} [desiredCapabilities] Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
|
|
63
63
|
* @prop {boolean} [manualStart=false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
64
64
|
* @prop {object} [timeouts] [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
65
|
-
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
|
|
65
|
+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
66
66
|
*/
|
|
67
67
|
const config = {};
|
|
68
68
|
|
|
@@ -2918,9 +2918,9 @@ function isModifierKey(key) {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
|
|
2920
2920
|
function highlightActiveElement(element) {
|
|
2921
|
-
if (
|
|
2922
|
-
|
|
2923
|
-
|
|
2921
|
+
if (this.options.highlightElement && global.debugMode) {
|
|
2922
|
+
highlightElement(element, this.browser);
|
|
2923
|
+
}
|
|
2924
2924
|
}
|
|
2925
2925
|
|
|
2926
2926
|
function prepareLocateFn(context) {
|
package/lib/pause.js
CHANGED
|
@@ -78,7 +78,6 @@ async function parseInput(cmd) {
|
|
|
78
78
|
rl.pause();
|
|
79
79
|
next = false;
|
|
80
80
|
recorder.session.start('pause');
|
|
81
|
-
store.debugMode = false;
|
|
82
81
|
if (cmd === '') next = true;
|
|
83
82
|
if (!cmd || cmd === 'resume' || cmd === 'exit') {
|
|
84
83
|
finish();
|
|
@@ -98,7 +97,6 @@ async function parseInput(cmd) {
|
|
|
98
97
|
return cmd;
|
|
99
98
|
};
|
|
100
99
|
|
|
101
|
-
store.debugMode = true;
|
|
102
100
|
let isCustomCommand = false;
|
|
103
101
|
let lastError = null;
|
|
104
102
|
let isAiCommand = false;
|
package/lib/plugin/autoLogin.js
CHANGED
|
@@ -251,20 +251,16 @@ module.exports = function (config) {
|
|
|
251
251
|
} else {
|
|
252
252
|
userSession.login(I);
|
|
253
253
|
}
|
|
254
|
-
store.debugMode = true;
|
|
255
254
|
const cookies = await userSession.fetch(I);
|
|
256
255
|
if (config.saveToFile) {
|
|
257
256
|
debug(`Saved user session into file for ${name}`);
|
|
258
257
|
fs.writeFileSync(path.join(global.output_dir, `${name}_session.json`), JSON.stringify(cookies));
|
|
259
258
|
}
|
|
260
259
|
store[`${name}_session`] = cookies;
|
|
261
|
-
store.debugMode = false;
|
|
262
260
|
};
|
|
263
261
|
|
|
264
262
|
if (!cookies) return loginAndSave();
|
|
265
263
|
|
|
266
|
-
store.debugMode = true;
|
|
267
|
-
|
|
268
264
|
recorder.session.start('check login');
|
|
269
265
|
if (shouldAwait) {
|
|
270
266
|
await userSession.restore(I, cookies);
|
|
@@ -287,7 +283,6 @@ module.exports = function (config) {
|
|
|
287
283
|
});
|
|
288
284
|
});
|
|
289
285
|
recorder.add(() => {
|
|
290
|
-
store.debugMode = false;
|
|
291
286
|
recorder.session.restore('check login');
|
|
292
287
|
});
|
|
293
288
|
|
package/lib/plugin/retryTo.js
CHANGED
|
@@ -83,7 +83,6 @@ module.exports = function (config) {
|
|
|
83
83
|
return retryTo;
|
|
84
84
|
|
|
85
85
|
function retryTo(callback, maxTries, pollInterval = undefined) {
|
|
86
|
-
const mode = store.debugMode;
|
|
87
86
|
let tries = 1;
|
|
88
87
|
if (!pollInterval) pollInterval = config.pollInterval;
|
|
89
88
|
|
|
@@ -113,7 +112,6 @@ module.exports = function (config) {
|
|
|
113
112
|
};
|
|
114
113
|
|
|
115
114
|
recorder.add('retryTo', async () => {
|
|
116
|
-
store.debugMode = true;
|
|
117
115
|
tryBlock();
|
|
118
116
|
});
|
|
119
117
|
}).then(() => {
|
package/lib/plugin/tryTo.js
CHANGED
|
@@ -81,10 +81,8 @@ module.exports = function (config) {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
function tryTo(callback) {
|
|
84
|
-
const mode = store.debugMode;
|
|
85
84
|
let result = false;
|
|
86
85
|
return recorder.add('tryTo', () => {
|
|
87
|
-
store.debugMode = true;
|
|
88
86
|
recorder.session.start('tryTo');
|
|
89
87
|
callback();
|
|
90
88
|
recorder.add(() => {
|
|
@@ -100,7 +98,6 @@ function tryTo(callback) {
|
|
|
100
98
|
return result;
|
|
101
99
|
});
|
|
102
100
|
return recorder.add('result', () => {
|
|
103
|
-
store.debugMode = mode;
|
|
104
101
|
return result;
|
|
105
102
|
}, true, false);
|
|
106
103
|
}, false, false);
|
package/lib/session.js
CHANGED
|
@@ -19,7 +19,7 @@ const savedSessions = {};
|
|
|
19
19
|
* @param {CodeceptJS.LocatorOrString} sessionName
|
|
20
20
|
* @param {Function | Object<string, *>} config
|
|
21
21
|
* @param {Function} [fn]
|
|
22
|
-
* @return {
|
|
22
|
+
* @return {any}
|
|
23
23
|
*/
|
|
24
24
|
function session(sessionName, config, fn) {
|
|
25
25
|
if (typeof config === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"lint": "eslint bin/ examples/ lib/ test/ translations/ runok.js",
|
|
41
41
|
"lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.js --fix",
|
|
42
42
|
"docs": "./runok.js docs",
|
|
43
|
-
"test:unit": "mocha test/unit --recursive --timeout
|
|
44
|
-
"test:runner": "mocha test/runner --recursive --timeout
|
|
43
|
+
"test:unit": "mocha test/unit --recursive --timeout 10000",
|
|
44
|
+
"test:runner": "mocha test/runner --recursive --timeout 10000",
|
|
45
45
|
"test": "npm run test:unit && npm run test:runner",
|
|
46
46
|
"test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
|
|
47
47
|
"test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"acorn": "8.10.0",
|
|
69
69
|
"arrify": "2.0.1",
|
|
70
70
|
"axios": "1.3.3",
|
|
71
|
-
"chai": "4.3.
|
|
71
|
+
"chai": "4.3.8",
|
|
72
72
|
"chai-deep-match": "1.2.1",
|
|
73
73
|
"chalk": "4.1.2",
|
|
74
74
|
"commander": "11.0.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"html-minifier": "4.0.0",
|
|
84
84
|
"inquirer": "6.5.2",
|
|
85
85
|
"joi": "17.6.0",
|
|
86
|
-
"js-beautify": "1.14.
|
|
86
|
+
"js-beautify": "1.14.9",
|
|
87
87
|
"lodash.clonedeep": "4.5.0",
|
|
88
88
|
"lodash.merge": "4.6.2",
|
|
89
89
|
"mkdirp": "1.0.4",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"@codeceptjs/detox-helper": "1.0.2",
|
|
103
103
|
"@codeceptjs/mock-request": "0.3.1",
|
|
104
104
|
"@faker-js/faker": "7.6.0",
|
|
105
|
-
"@pollyjs/adapter-puppeteer": "6.0.
|
|
105
|
+
"@pollyjs/adapter-puppeteer": "6.0.6",
|
|
106
106
|
"@pollyjs/core": "5.1.0",
|
|
107
107
|
"@types/inquirer": "9.0.3",
|
|
108
108
|
"@types/node": "20.4.4",
|
|
109
109
|
"@wdio/sauce-service": "8.3.8",
|
|
110
110
|
"@wdio/selenium-standalone-service": "8.3.2",
|
|
111
|
-
"@wdio/utils": "8.
|
|
111
|
+
"@wdio/utils": "8.16.22",
|
|
112
112
|
"apollo-server-express": "2.25.3",
|
|
113
113
|
"chai-as-promised": "7.1.1",
|
|
114
114
|
"chai-subset": "1.6.0",
|
|
@@ -116,23 +116,23 @@
|
|
|
116
116
|
"documentation": "12.3.0",
|
|
117
117
|
"dtslint": "4.1.6",
|
|
118
118
|
"electron": "26.1.0",
|
|
119
|
-
"eslint": "8.
|
|
119
|
+
"eslint": "8.50.0",
|
|
120
120
|
"eslint-config-airbnb-base": "15.0.0",
|
|
121
121
|
"eslint-plugin-import": "2.25.4",
|
|
122
122
|
"eslint-plugin-mocha": "6.3.0",
|
|
123
|
-
"expect": "29.
|
|
123
|
+
"expect": "29.7.0",
|
|
124
124
|
"express": "4.17.2",
|
|
125
125
|
"graphql": "14.6.0",
|
|
126
|
-
"husky": "8.0.
|
|
126
|
+
"husky": "8.0.3",
|
|
127
127
|
"inquirer-test": "2.0.1",
|
|
128
128
|
"jsdoc": "3.6.10",
|
|
129
129
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
130
130
|
"json-server": "0.10.1",
|
|
131
|
-
"playwright": "1.
|
|
131
|
+
"playwright": "1.38.1",
|
|
132
132
|
"puppeteer": "21.1.1",
|
|
133
133
|
"qrcode-terminal": "0.12.0",
|
|
134
134
|
"rosie": "2.1.0",
|
|
135
|
-
"runok": "0.9.
|
|
135
|
+
"runok": "0.9.3",
|
|
136
136
|
"sinon": "15.2.0",
|
|
137
137
|
"sinon-chai": "3.7.0",
|
|
138
138
|
"testcafe": "3.0.1",
|
|
@@ -153,4 +153,4 @@
|
|
|
153
153
|
"npm": ">=5.6.0"
|
|
154
154
|
},
|
|
155
155
|
"es6": true
|
|
156
|
-
}
|
|
156
|
+
}
|