codeceptjs 3.5.4-beta.1 → 3.5.5
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 +368 -0
- package/README.md +0 -2
- package/docs/build/Appium.js +48 -7
- package/docs/build/GraphQL.js +25 -0
- package/docs/build/Nightmare.js +15 -6
- package/docs/build/Playwright.js +436 -197
- package/docs/build/Protractor.js +17 -8
- package/docs/build/Puppeteer.js +37 -20
- package/docs/build/TestCafe.js +19 -10
- package/docs/build/WebDriver.js +45 -37
- package/docs/changelog.md +375 -0
- package/docs/community-helpers.md +8 -4
- package/docs/examples.md +8 -2
- package/docs/helpers/Appium.md +39 -2
- package/docs/helpers/GraphQL.md +21 -0
- package/docs/helpers/Nightmare.md +1260 -0
- package/docs/helpers/Playwright.md +223 -119
- package/docs/helpers/Protractor.md +1711 -0
- package/docs/helpers/Puppeteer.md +31 -29
- package/docs/helpers/TestCafe.md +18 -17
- package/docs/helpers/WebDriver.md +34 -32
- package/docs/playwright.md +24 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -0
- package/docs/webapi/executeScript.mustache +2 -0
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/wiki/Books-&-Posts.md +0 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
- package/docs/wiki/Examples.md +8 -2
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
- package/docs/wiki/Home.md +0 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -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 +1 -0
- package/lib/command/definitions.js +2 -7
- package/lib/command/init.js +40 -4
- package/lib/command/run-multiple/collection.js +17 -5
- package/lib/command/run-workers.js +4 -0
- package/lib/command/run.js +6 -0
- package/lib/helper/Appium.js +46 -5
- package/lib/helper/GraphQL.js +25 -0
- package/lib/helper/Nightmare.js +1415 -0
- package/lib/helper/Playwright.js +336 -62
- package/lib/helper/Protractor.js +1837 -0
- package/lib/helper/Puppeteer.js +31 -18
- package/lib/helper/TestCafe.js +15 -8
- package/lib/helper/WebDriver.js +39 -35
- package/lib/helper/clientscripts/nightmare.js +213 -0
- package/lib/helper/errors/ElementNotFound.js +2 -1
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/interfaces/bdd.js +1 -1
- package/lib/mochaFactory.js +2 -1
- package/lib/pause.js +6 -4
- package/lib/plugin/heal.js +2 -3
- package/lib/plugin/selenoid.js +6 -1
- package/lib/step.js +27 -10
- package/lib/utils.js +4 -0
- package/lib/workers.js +3 -1
- package/package.json +87 -87
- package/typings/promiseBasedTypes.d.ts +163 -126
- package/typings/types.d.ts +183 -144
- package/docs/build/Polly.js +0 -42
- package/docs/build/SeleniumWebdriver.js +0 -76
package/lib/plugin/heal.js
CHANGED
|
@@ -147,11 +147,10 @@ module.exports = function (config = {}) {
|
|
|
147
147
|
async function tryToHeal(failedStep, err) {
|
|
148
148
|
output.debug(`Running OpenAI to heal ${failedStep.toCode()} step`);
|
|
149
149
|
|
|
150
|
-
const codeSnippets = await aiAssistant.healFailedStep(
|
|
151
|
-
failedStep, err, currentTest,
|
|
152
|
-
);
|
|
150
|
+
const codeSnippets = await aiAssistant.healFailedStep(failedStep, err, currentTest);
|
|
153
151
|
|
|
154
152
|
output.debug(`Received ${codeSnippets.length} suggestions from OpenAI`);
|
|
153
|
+
const I = Container.support('I'); // eslint-disable-line
|
|
155
154
|
|
|
156
155
|
for (const codeSnippet of codeSnippets) {
|
|
157
156
|
try {
|
package/lib/plugin/selenoid.js
CHANGED
|
@@ -58,7 +58,12 @@ let seleniumUrl = 'http://localhost:$port$';
|
|
|
58
58
|
const supportedHelpers = ['WebDriver'];
|
|
59
59
|
const SELENOID_START_TIMEOUT = 2000;
|
|
60
60
|
const SELENOID_STOP_TIMEOUT = 10000;
|
|
61
|
-
const wait = time => new Promise((res) =>
|
|
61
|
+
const wait = time => new Promise((res) => {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
res();
|
|
65
|
+
}, time);
|
|
66
|
+
});
|
|
62
67
|
|
|
63
68
|
/**
|
|
64
69
|
* [Selenoid](https://aerokube.com/selenoid/) plugin automatically starts browsers and video recording.
|
package/lib/step.js
CHANGED
|
@@ -138,13 +138,7 @@ class Step {
|
|
|
138
138
|
|
|
139
139
|
/** @return {string} */
|
|
140
140
|
humanize() {
|
|
141
|
-
return this.name
|
|
142
|
-
// insert a space before all caps
|
|
143
|
-
.replace(/([A-Z])/g, ' $1')
|
|
144
|
-
// _ chars to spaces
|
|
145
|
-
.replace('_', ' ')
|
|
146
|
-
// uppercase the first character
|
|
147
|
-
.replace(/^(.)|\s(.)/g, $1 => $1.toLowerCase());
|
|
141
|
+
return humanizeString(this.name);
|
|
148
142
|
}
|
|
149
143
|
|
|
150
144
|
/** @return {string} */
|
|
@@ -247,12 +241,21 @@ class MetaStep extends Step {
|
|
|
247
241
|
}
|
|
248
242
|
|
|
249
243
|
toString() {
|
|
250
|
-
const actorText =
|
|
251
|
-
|
|
244
|
+
const actorText = this.actor;
|
|
245
|
+
|
|
246
|
+
if (this.isBDD() || this.isWithin()) {
|
|
247
|
+
return `${this.prefix}${actorText} ${this.name} "${this.humanizeArgs()}${this.suffix}"`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (actorText === 'I') {
|
|
251
|
+
return `${this.prefix}${actorText} ${this.humanize()} ${this.humanizeArgs()}${this.suffix}`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return `On ${this.prefix}${actorText}: ${this.humanize()} ${this.humanizeArgs()}${this.suffix}`;
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
humanize() {
|
|
255
|
-
return this.name;
|
|
258
|
+
return humanizeString(this.name);
|
|
256
259
|
}
|
|
257
260
|
|
|
258
261
|
setTrace() {
|
|
@@ -316,3 +319,17 @@ function dryRunResolver() {
|
|
|
316
319
|
},
|
|
317
320
|
};
|
|
318
321
|
}
|
|
322
|
+
|
|
323
|
+
function humanizeString(string) {
|
|
324
|
+
// split strings by words, then make them all lowercase
|
|
325
|
+
const _result = string.replace(/([a-z](?=[A-Z]))/g, '$1 ')
|
|
326
|
+
.split(' ')
|
|
327
|
+
.map(word => word.toLowerCase());
|
|
328
|
+
|
|
329
|
+
_result[0] = _result[0] === 'i' ? capitalizeFLetter(_result[0]) : _result[0];
|
|
330
|
+
return _result.join(' ').trim();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function capitalizeFLetter(string) {
|
|
334
|
+
return (string[0].toUpperCase() + string.slice(1));
|
|
335
|
+
}
|
package/lib/utils.js
CHANGED
package/lib/workers.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -54,99 +54,99 @@
|
|
|
54
54
|
"def": "./runok.js def",
|
|
55
55
|
"dev:graphql": "node test/data/graphql/index.js",
|
|
56
56
|
"publish:site": "./runok.js publish:site",
|
|
57
|
-
"update-contributor-faces": "contributor
|
|
57
|
+
"update-contributor-faces": "./runok.js contributor:faces",
|
|
58
58
|
"dtslint": "dtslint typings --localTs './node_modules/typescript/lib'",
|
|
59
59
|
"prepare": "husky install"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@codeceptjs/configure": "
|
|
63
|
-
"@codeceptjs/helper": "
|
|
64
|
-
"@cucumber/cucumber-expressions": "
|
|
65
|
-
"@cucumber/gherkin": "
|
|
66
|
-
"@cucumber/messages": "
|
|
67
|
-
"@xmldom/xmldom": "
|
|
68
|
-
"acorn": "
|
|
69
|
-
"arrify": "
|
|
70
|
-
"axios": "
|
|
71
|
-
"chai": "
|
|
72
|
-
"chai-deep-match": "
|
|
73
|
-
"chalk": "
|
|
74
|
-
"commander": "
|
|
75
|
-
"cross-spawn": "
|
|
76
|
-
"css-to-xpath": "
|
|
77
|
-
"envinfo": "
|
|
78
|
-
"escape-string-regexp": "
|
|
79
|
-
"figures": "
|
|
80
|
-
"fn-args": "
|
|
81
|
-
"fs-extra": "
|
|
82
|
-
"glob": "
|
|
83
|
-
"html-minifier": "
|
|
84
|
-
"inquirer": "
|
|
85
|
-
"joi": "
|
|
86
|
-
"js-beautify": "
|
|
87
|
-
"lodash.clonedeep": "
|
|
88
|
-
"lodash.merge": "
|
|
89
|
-
"mkdirp": "
|
|
90
|
-
"mocha": "
|
|
91
|
-
"ms": "
|
|
92
|
-
"openai": "
|
|
93
|
-
"ora-classic": "
|
|
94
|
-
"parse-function": "
|
|
95
|
-
"parse5": "
|
|
96
|
-
"promise-retry": "
|
|
97
|
-
"resq": "
|
|
98
|
-
"sprintf-js": "
|
|
99
|
-
"uuid": "
|
|
62
|
+
"@codeceptjs/configure": "0.10.0",
|
|
63
|
+
"@codeceptjs/helper": "2.0.1",
|
|
64
|
+
"@cucumber/cucumber-expressions": "16",
|
|
65
|
+
"@cucumber/gherkin": "26",
|
|
66
|
+
"@cucumber/messages": "22.0.0",
|
|
67
|
+
"@xmldom/xmldom": "0.8.10",
|
|
68
|
+
"acorn": "8.10.0",
|
|
69
|
+
"arrify": "2.0.1",
|
|
70
|
+
"axios": "1.3.3",
|
|
71
|
+
"chai": "4.3.6",
|
|
72
|
+
"chai-deep-match": "1.2.1",
|
|
73
|
+
"chalk": "4.1.2",
|
|
74
|
+
"commander": "11.0.0",
|
|
75
|
+
"cross-spawn": "7.0.3",
|
|
76
|
+
"css-to-xpath": "0.1.0",
|
|
77
|
+
"envinfo": "7.8.1",
|
|
78
|
+
"escape-string-regexp": "4.0.0",
|
|
79
|
+
"figures": "3.2.0",
|
|
80
|
+
"fn-args": "4.0.0",
|
|
81
|
+
"fs-extra": "8.1.0",
|
|
82
|
+
"glob": "6.0.1",
|
|
83
|
+
"html-minifier": "4.0.0",
|
|
84
|
+
"inquirer": "6.5.2",
|
|
85
|
+
"joi": "17.6.0",
|
|
86
|
+
"js-beautify": "1.14.0",
|
|
87
|
+
"lodash.clonedeep": "4.5.0",
|
|
88
|
+
"lodash.merge": "4.6.2",
|
|
89
|
+
"mkdirp": "1.0.4",
|
|
90
|
+
"mocha": "10.2.0",
|
|
91
|
+
"ms": "2.1.3",
|
|
92
|
+
"openai": "3.2.1",
|
|
93
|
+
"ora-classic": "5.4.2",
|
|
94
|
+
"parse-function": "5.6.4",
|
|
95
|
+
"parse5": "7.1.2",
|
|
96
|
+
"promise-retry": "1.1.1",
|
|
97
|
+
"resq": "1.10.2",
|
|
98
|
+
"sprintf-js": "1.1.1",
|
|
99
|
+
"uuid": "9.0"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@codeceptjs/detox-helper": "
|
|
103
|
-
"@codeceptjs/mock-request": "
|
|
104
|
-
"@faker-js/faker": "
|
|
105
|
-
"@pollyjs/adapter-puppeteer": "
|
|
106
|
-
"@pollyjs/core": "
|
|
107
|
-
"@types/inquirer": "
|
|
108
|
-
"@types/node": "
|
|
109
|
-
"@wdio/sauce-service": "
|
|
110
|
-
"@wdio/selenium-standalone-service": "
|
|
111
|
-
"@wdio/utils": "
|
|
102
|
+
"@codeceptjs/detox-helper": "1.0.2",
|
|
103
|
+
"@codeceptjs/mock-request": "0.3.1",
|
|
104
|
+
"@faker-js/faker": "7.6.0",
|
|
105
|
+
"@pollyjs/adapter-puppeteer": "6.0.5",
|
|
106
|
+
"@pollyjs/core": "5.1.0",
|
|
107
|
+
"@types/inquirer": "9.0.3",
|
|
108
|
+
"@types/node": "20.4.4",
|
|
109
|
+
"@wdio/sauce-service": "8.3.8",
|
|
110
|
+
"@wdio/selenium-standalone-service": "8.3.2",
|
|
111
|
+
"@wdio/utils": "8.3.0",
|
|
112
112
|
"apollo-server-express": "2.25.3",
|
|
113
|
-
"chai-as-promised": "
|
|
114
|
-
"chai-subset": "
|
|
115
|
-
"contributor-faces": "
|
|
116
|
-
"documentation": "
|
|
117
|
-
"dtslint": "
|
|
118
|
-
"electron": "
|
|
119
|
-
"eslint": "
|
|
120
|
-
"eslint-config-airbnb-base": "
|
|
121
|
-
"eslint-plugin-import": "
|
|
122
|
-
"eslint-plugin-mocha": "
|
|
123
|
-
"expect": "
|
|
124
|
-
"express": "
|
|
125
|
-
"graphql": "
|
|
126
|
-
"husky": "
|
|
127
|
-
"inquirer-test": "
|
|
128
|
-
"jsdoc": "
|
|
129
|
-
"jsdoc-typeof-plugin": "
|
|
130
|
-
"json-server": "
|
|
131
|
-
"playwright": "
|
|
132
|
-
"puppeteer": "
|
|
133
|
-
"qrcode-terminal": "
|
|
134
|
-
"rosie": "
|
|
135
|
-
"runok": "
|
|
136
|
-
"sinon": "
|
|
137
|
-
"sinon-chai": "
|
|
138
|
-
"testcafe": "
|
|
139
|
-
"ts-morph": "
|
|
140
|
-
"ts-node": "
|
|
141
|
-
"tsd-jsdoc": "
|
|
142
|
-
"typedoc": "
|
|
143
|
-
"typedoc-plugin-markdown": "
|
|
144
|
-
"typescript": "
|
|
145
|
-
"wdio-docker-service": "
|
|
146
|
-
"webdriverio": "
|
|
147
|
-
"xml2js": "
|
|
148
|
-
"xmldom": "
|
|
149
|
-
"xpath": "0.0.
|
|
113
|
+
"chai-as-promised": "7.1.1",
|
|
114
|
+
"chai-subset": "1.6.0",
|
|
115
|
+
"contributor-faces": "1.0.3",
|
|
116
|
+
"documentation": "12.3.0",
|
|
117
|
+
"dtslint": "4.1.6",
|
|
118
|
+
"electron": "26.1.0",
|
|
119
|
+
"eslint": "8.45.0",
|
|
120
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
121
|
+
"eslint-plugin-import": "2.25.4",
|
|
122
|
+
"eslint-plugin-mocha": "6.3.0",
|
|
123
|
+
"expect": "29.6.2",
|
|
124
|
+
"express": "4.17.2",
|
|
125
|
+
"graphql": "14.6.0",
|
|
126
|
+
"husky": "8.0.1",
|
|
127
|
+
"inquirer-test": "2.0.1",
|
|
128
|
+
"jsdoc": "3.6.10",
|
|
129
|
+
"jsdoc-typeof-plugin": "1.0.0",
|
|
130
|
+
"json-server": "0.10.1",
|
|
131
|
+
"playwright": "1.35.1",
|
|
132
|
+
"puppeteer": "21.1.1",
|
|
133
|
+
"qrcode-terminal": "0.12.0",
|
|
134
|
+
"rosie": "2.1.0",
|
|
135
|
+
"runok": "0.9.2",
|
|
136
|
+
"sinon": "15.2.0",
|
|
137
|
+
"sinon-chai": "3.7.0",
|
|
138
|
+
"testcafe": "3.0.1",
|
|
139
|
+
"ts-morph": "19.0.0",
|
|
140
|
+
"ts-node": "10.9.1",
|
|
141
|
+
"tsd-jsdoc": "2.5.0",
|
|
142
|
+
"typedoc": "0.24.8",
|
|
143
|
+
"typedoc-plugin-markdown": "3.13.4",
|
|
144
|
+
"typescript": "5.1.6",
|
|
145
|
+
"wdio-docker-service": "1.5.0",
|
|
146
|
+
"webdriverio": "8.3.8",
|
|
147
|
+
"xml2js": "0.6.0",
|
|
148
|
+
"xmldom": "0.6.0",
|
|
149
|
+
"xpath": "0.0.33"
|
|
150
150
|
},
|
|
151
151
|
"engines": {
|
|
152
152
|
"node": ">=16.0",
|