codeceptjs 3.1.3 → 3.2.3
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 +75 -1
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +99 -61
- package/docs/basics.md +27 -2
- package/docs/bdd.md +2 -2
- package/docs/build/Appium.js +62 -0
- package/docs/build/FileSystem.js +12 -1
- package/docs/build/Playwright.js +37 -33
- package/docs/build/Protractor.js +9 -24
- package/docs/build/Puppeteer.js +10 -28
- package/docs/build/REST.js +1 -0
- package/docs/build/WebDriver.js +2 -24
- package/docs/changelog.md +75 -1
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +2 -37
- package/docs/data.md +9 -9
- package/docs/helpers/Appium.md +240 -198
- package/docs/helpers/FileSystem.md +12 -2
- package/docs/helpers/Playwright.md +226 -225
- package/docs/helpers/Puppeteer.md +1 -17
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +1 -17
- package/docs/installation.md +1 -1
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/pageobjects.md +2 -0
- package/docs/playwright.md +4 -4
- package/docs/plugins.md +138 -9
- package/docs/puppeteer.md +5 -5
- package/docs/reports.md +3 -3
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +1 -1
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +2 -2
- package/lib/actor.js +19 -1
- package/lib/cli.js +25 -20
- package/lib/codecept.js +2 -0
- package/lib/command/info.js +1 -1
- package/lib/command/workers/runTests.js +25 -7
- package/lib/config.js +12 -0
- package/lib/container.js +3 -1
- package/lib/helper/Appium.js +62 -0
- package/lib/helper/FileSystem.js +12 -1
- package/lib/helper/Playwright.js +37 -23
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +3 -18
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -14
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +72 -0
- package/lib/locator.js +3 -0
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/retryFailedStep.js +4 -3
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +91 -0
- package/lib/plugin/tryTo.js +6 -0
- package/lib/recorder.js +18 -6
- package/lib/step.js +58 -0
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +4 -6
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +149 -164
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
package/lib/step.js
CHANGED
|
@@ -13,6 +13,27 @@ const STACK_LINE = 4;
|
|
|
13
13
|
* @param {string} name
|
|
14
14
|
*/
|
|
15
15
|
class Step {
|
|
16
|
+
static get TIMEOUT_ORDER() {
|
|
17
|
+
return {
|
|
18
|
+
/**
|
|
19
|
+
* timeouts set with order below zero only override timeouts of higher order if their value is smaller
|
|
20
|
+
*/
|
|
21
|
+
testOrSuite: -5,
|
|
22
|
+
/**
|
|
23
|
+
* 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
|
|
24
|
+
*/
|
|
25
|
+
stepTimeoutHard: 5,
|
|
26
|
+
/**
|
|
27
|
+
* 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
|
|
28
|
+
*/
|
|
29
|
+
codeLimitTime: 15,
|
|
30
|
+
/**
|
|
31
|
+
* 20-29 - designated for timeout settings which could be overriden in tests code, 25 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=false
|
|
32
|
+
*/
|
|
33
|
+
stepTimeoutSoft: 25,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
16
37
|
constructor(helper, name) {
|
|
17
38
|
/** @member {string} */
|
|
18
39
|
this.actor = 'I'; // I = actor
|
|
@@ -38,6 +59,41 @@ class Step {
|
|
|
38
59
|
this.metaStep = undefined;
|
|
39
60
|
/** @member {string} */
|
|
40
61
|
this.stack = '';
|
|
62
|
+
|
|
63
|
+
const timeouts = new Map();
|
|
64
|
+
/**
|
|
65
|
+
* @method
|
|
66
|
+
* @returns {number|undefined}
|
|
67
|
+
*/
|
|
68
|
+
this.getTimeout = function () {
|
|
69
|
+
let totalTimeout;
|
|
70
|
+
// iterate over all timeouts starting from highest values of order
|
|
71
|
+
new Map([...timeouts.entries()].sort().reverse()).forEach((timeout, order) => {
|
|
72
|
+
if (timeout !== undefined && (
|
|
73
|
+
// when orders >= 0 - timeout value overrides those set with higher order elements
|
|
74
|
+
order >= 0
|
|
75
|
+
|
|
76
|
+
// when `order < 0 && totalTimeout === undefined` - timeout is used when nothing is set by elements with higher order
|
|
77
|
+
|| totalTimeout === undefined
|
|
78
|
+
|
|
79
|
+
// when `order < 0` - timeout overrides higher values of timeout or 'no timeout' (totalTimeout === 0) set by elements with higher order
|
|
80
|
+
|| timeout > 0 && (timeout < totalTimeout || totalTimeout === 0)
|
|
81
|
+
)) {
|
|
82
|
+
totalTimeout = timeout;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return totalTimeout;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* @method
|
|
89
|
+
* @param {number} timeout - timeout in milliseconds or 0 if no timeout
|
|
90
|
+
* @param {number} order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
|
|
91
|
+
* When order below 0 value of timeout only override if new value is lower
|
|
92
|
+
*/
|
|
93
|
+
this.setTimeout = function (timeout, order) {
|
|
94
|
+
timeouts.set(order, timeout);
|
|
95
|
+
};
|
|
96
|
+
|
|
41
97
|
this.setTrace();
|
|
42
98
|
}
|
|
43
99
|
|
|
@@ -228,6 +284,8 @@ class MetaStep extends Step {
|
|
|
228
284
|
}
|
|
229
285
|
}
|
|
230
286
|
|
|
287
|
+
Step.TIMEOUTS = {};
|
|
288
|
+
|
|
231
289
|
/** @type {Class<MetaStep>} */
|
|
232
290
|
Step.MetaStep = MetaStep;
|
|
233
291
|
|
package/lib/store.js
CHANGED
package/lib/ui.js
CHANGED
|
@@ -65,7 +65,7 @@ module.exports = function (suite) {
|
|
|
65
65
|
|
|
66
66
|
suite.addTest(scenario.test(test));
|
|
67
67
|
if (opts.retries) test.retries(opts.retries);
|
|
68
|
-
if (opts.timeout) test.
|
|
68
|
+
if (opts.timeout) test.totalTimeout = opts.timeout;
|
|
69
69
|
test.opts = opts;
|
|
70
70
|
|
|
71
71
|
return new ScenarioConfig(test);
|
|
@@ -103,7 +103,7 @@ module.exports = function (suite) {
|
|
|
103
103
|
suite.timeout(0);
|
|
104
104
|
|
|
105
105
|
if (opts.retries) suite.retries(opts.retries);
|
|
106
|
-
if (opts.timeout) suite.
|
|
106
|
+
if (opts.timeout) suite.totalTimeout = opts.timeout;
|
|
107
107
|
|
|
108
108
|
suite.tags = title.match(/(\@[a-zA-Z0-9-_]+)/g) || []; // match tags from title
|
|
109
109
|
suite.file = file;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"webdriver",
|
|
11
11
|
"testcafe",
|
|
12
12
|
"playwright",
|
|
13
|
-
"protractor",
|
|
14
13
|
"bdd",
|
|
15
14
|
"tdd",
|
|
16
15
|
"testing"
|
|
@@ -103,7 +102,7 @@
|
|
|
103
102
|
"chai-subset": "^1.6.0",
|
|
104
103
|
"contributor-faces": "^1.0.3",
|
|
105
104
|
"documentation": "^12.3.0",
|
|
106
|
-
"dtslint": "^
|
|
105
|
+
"dtslint": "^4.1.6",
|
|
107
106
|
"electron": "^12.0.0",
|
|
108
107
|
"eslint": "^6.8.0",
|
|
109
108
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
@@ -122,7 +121,6 @@
|
|
|
122
121
|
"nightmare": "^3.0.2",
|
|
123
122
|
"nodemon": "^1.19.4",
|
|
124
123
|
"playwright": "^1.9.1",
|
|
125
|
-
"protractor": "^5.4.4",
|
|
126
124
|
"puppeteer": "^10.0.0",
|
|
127
125
|
"qrcode-terminal": "^0.12.0",
|
|
128
126
|
"rosie": "^1.6.0",
|
|
@@ -133,9 +131,9 @@
|
|
|
133
131
|
"testcafe": "^1.9.4",
|
|
134
132
|
"ts-morph": "^3.1.3",
|
|
135
133
|
"tsd-jsdoc": "^2.5.0",
|
|
136
|
-
"typescript": "^
|
|
134
|
+
"typescript": "^4.4.3",
|
|
137
135
|
"wdio-docker-service": "^1.5.0",
|
|
138
|
-
"webdriverio": "^
|
|
136
|
+
"webdriverio": "^7.14.1",
|
|
139
137
|
"xml2js": "^0.4.23",
|
|
140
138
|
"xmldom": "^0.1.31",
|
|
141
139
|
"xpath": "0.0.27"
|
package/typings/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ declare namespace CodeceptJS {
|
|
|
10
10
|
type Cookie = {
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
+
domain?: string,
|
|
14
|
+
path?: string,
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
interface PageScrollPosition {
|
|
@@ -66,7 +68,7 @@ declare namespace CodeceptJS {
|
|
|
66
68
|
type StringOrSecret = string | CodeceptJS.Secret;
|
|
67
69
|
|
|
68
70
|
interface HookCallback {
|
|
69
|
-
(args: SupportObject): void
|
|
71
|
+
(args: SupportObject): void | Promise<void>;
|
|
70
72
|
}
|
|
71
73
|
interface Scenario extends IScenario {
|
|
72
74
|
only: IScenario;
|
|
@@ -195,6 +197,7 @@ declare namespace Mocha {
|
|
|
195
197
|
}
|
|
196
198
|
|
|
197
199
|
interface Test extends Runnable {
|
|
200
|
+
artifacts: [],
|
|
198
201
|
tags: any[];
|
|
199
202
|
}
|
|
200
203
|
}
|
|
@@ -202,3 +205,7 @@ declare namespace Mocha {
|
|
|
202
205
|
declare module "codeceptjs" {
|
|
203
206
|
export = codeceptjs;
|
|
204
207
|
}
|
|
208
|
+
|
|
209
|
+
declare module "@codeceptjs/helper" {
|
|
210
|
+
export = CodeceptJS.Helper;
|
|
211
|
+
}
|