codeceptjs 3.6.2-beta.2 → 3.6.3-beta.2
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/README.md +1 -1
- package/lib/cli.js +15 -11
- package/lib/helper/Playwright.js +1 -2
- package/lib/helper/WebDriver.js +12 -5
- package/lib/plugin/coverage.js +34 -1
- package/lib/plugin/screenshotOnFail.js +2 -1
- package/lib/plugin/stepByStepReport.js +4 -2
- package/lib/utils.js +1 -1
- package/package.json +18 -18
- package/typings/promiseBasedTypes.d.ts +1 -1
- package/typings/types.d.ts +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently,
|
|
|
46
46
|
|
|
47
47
|
* [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
|
|
48
48
|
* [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
|
|
49
|
-
* [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol.
|
|
49
|
+
* [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver or Devtools protocol.
|
|
50
50
|
* [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation.
|
|
51
51
|
* [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
|
|
52
52
|
* [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
|
package/lib/cli.js
CHANGED
|
@@ -186,20 +186,24 @@ class Cli extends Base {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
stack.
|
|
192
|
-
|
|
189
|
+
try {
|
|
190
|
+
let stack = err.stack ? err.stack.split('\n') : [];
|
|
191
|
+
if (stack[0] && stack[0].includes(err.message)) {
|
|
192
|
+
stack.shift();
|
|
193
|
+
}
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
if (output.level() < 3) {
|
|
196
|
+
stack = stack.slice(0, 3);
|
|
197
|
+
}
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
err.stack = `${stack.join('\n')}\n\n${output.colors.blue(log)}`;
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
// clone err object so stack trace adjustments won't affect test other reports
|
|
202
|
+
test.err = err;
|
|
203
|
+
return test;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
throw Error(e);
|
|
206
|
+
}
|
|
203
207
|
});
|
|
204
208
|
|
|
205
209
|
const originalLog = Base.consoleLog;
|
package/lib/helper/Playwright.js
CHANGED
|
@@ -3115,8 +3115,6 @@ class Playwright extends Helper {
|
|
|
3115
3115
|
/**
|
|
3116
3116
|
* Returns full URL of request matching parameter "urlMatch".
|
|
3117
3117
|
*
|
|
3118
|
-
* @param {string|RegExp} urlMatch Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
3119
|
-
*
|
|
3120
3118
|
* Examples:
|
|
3121
3119
|
*
|
|
3122
3120
|
* ```js
|
|
@@ -3124,6 +3122,7 @@ class Playwright extends Helper {
|
|
|
3124
3122
|
* I.grabTrafficUrl(/session.*start/);
|
|
3125
3123
|
* ```
|
|
3126
3124
|
*
|
|
3125
|
+
* @param {string|RegExp} urlMatch Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
3127
3126
|
* @return {Promise<*>}
|
|
3128
3127
|
*/
|
|
3129
3128
|
grabTrafficUrl(urlMatch) {
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -642,6 +642,7 @@ class WebDriver extends Helper {
|
|
|
642
642
|
|
|
643
643
|
if (this.options.automationProtocol) {
|
|
644
644
|
this.puppeteerBrowser = await this.browser.getPuppeteer();
|
|
645
|
+
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
645
646
|
}
|
|
646
647
|
|
|
647
648
|
return this.browser;
|
|
@@ -1795,14 +1796,21 @@ class WebDriver extends Helper {
|
|
|
1795
1796
|
* {{> saveScreenshot }}
|
|
1796
1797
|
*/
|
|
1797
1798
|
async saveScreenshot(fileName, fullPage = false) {
|
|
1798
|
-
|
|
1799
|
+
let outputFile = screenshotOutputFolder(fileName);
|
|
1799
1800
|
|
|
1800
1801
|
if (this.activeSessionName) {
|
|
1801
1802
|
const browser = this.sessionWindows[this.activeSessionName];
|
|
1802
1803
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1804
|
+
for (const sessionName in this.sessionWindows) {
|
|
1805
|
+
const activeSessionPage = this.sessionWindows[sessionName];
|
|
1806
|
+
outputFile = screenshotOutputFolder(`${sessionName}_${fileName}`);
|
|
1807
|
+
|
|
1808
|
+
this.debug(`${sessionName} - Screenshot is saving to ${outputFile}`);
|
|
1809
|
+
|
|
1810
|
+
if (browser) {
|
|
1811
|
+
this.debug(`Screenshot of ${sessionName} session has been saved to ${outputFile}`);
|
|
1812
|
+
return browser.saveScreenshot(outputFile);
|
|
1813
|
+
}
|
|
1806
1814
|
}
|
|
1807
1815
|
}
|
|
1808
1816
|
|
|
@@ -2724,7 +2732,6 @@ class WebDriver extends Helper {
|
|
|
2724
2732
|
this.recording = true;
|
|
2725
2733
|
this.recordedAtLeastOnce = true;
|
|
2726
2734
|
|
|
2727
|
-
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
2728
2735
|
await this.page.setRequestInterception(true);
|
|
2729
2736
|
|
|
2730
2737
|
this.page.on('request', (request) => {
|
package/lib/plugin/coverage.js
CHANGED
|
@@ -11,7 +11,7 @@ const defaultConfig = {
|
|
|
11
11
|
outputDir: 'output/coverage',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const supportedHelpers = ['Puppeteer', 'Playwright'];
|
|
14
|
+
const supportedHelpers = ['Puppeteer', 'Playwright', 'WebDriver'];
|
|
15
15
|
|
|
16
16
|
const v8CoverageHelpers = {
|
|
17
17
|
Playwright: {
|
|
@@ -61,6 +61,33 @@ const v8CoverageHelpers = {
|
|
|
61
61
|
await coverageReport.add(coverageList);
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
|
+
WebDriver: {
|
|
65
|
+
startCoverage: async (page) => {
|
|
66
|
+
await Promise.all([
|
|
67
|
+
page.coverage.startJSCoverage({
|
|
68
|
+
resetOnNavigation: false,
|
|
69
|
+
includeRawScriptCoverage: true,
|
|
70
|
+
}),
|
|
71
|
+
page.coverage.startCSSCoverage({
|
|
72
|
+
resetOnNavigation: false,
|
|
73
|
+
}),
|
|
74
|
+
]);
|
|
75
|
+
},
|
|
76
|
+
takeCoverage: async (page, coverageReport) => {
|
|
77
|
+
const [jsCoverage, cssCoverage] = await Promise.all([
|
|
78
|
+
page.coverage.stopJSCoverage(),
|
|
79
|
+
page.coverage.stopCSSCoverage(),
|
|
80
|
+
]);
|
|
81
|
+
// to raw V8 script coverage
|
|
82
|
+
const coverageList = [...jsCoverage.map((it) => {
|
|
83
|
+
return {
|
|
84
|
+
source: it.text,
|
|
85
|
+
...it.rawScriptCoverage,
|
|
86
|
+
};
|
|
87
|
+
}), ...cssCoverage];
|
|
88
|
+
await coverageReport.add(coverageList);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
64
91
|
};
|
|
65
92
|
|
|
66
93
|
/**
|
|
@@ -109,11 +136,17 @@ module.exports = function (config) {
|
|
|
109
136
|
const debug = debugModule(`codeceptjs:plugin:${helperName.toLowerCase()}Coverage`);
|
|
110
137
|
|
|
111
138
|
const helper = helpers[helperName];
|
|
139
|
+
|
|
140
|
+
if (helperName === 'WebDriver' && !helper.config.devtoolsProtocol) throw Error('Coverage is currently supporting the WebDriver running with Devtools protocol.');
|
|
141
|
+
|
|
112
142
|
const v8Helper = v8CoverageHelpers[helperName];
|
|
113
143
|
|
|
114
144
|
const coverageOptions = {
|
|
115
145
|
...config,
|
|
116
146
|
};
|
|
147
|
+
|
|
148
|
+
if (helperName === 'WebDriver') coverageOptions.coverageProvider = 'v8';
|
|
149
|
+
|
|
117
150
|
const coverageReport = new CoverageReport(coverageOptions);
|
|
118
151
|
coverageReport.cleanCache();
|
|
119
152
|
|
|
@@ -110,7 +110,8 @@ module.exports = function (config) {
|
|
|
110
110
|
allureReporter.addAttachment('Main session - Last Seen Screenshot', fs.readFileSync(path.join(global.output_dir, fileName)), dataType);
|
|
111
111
|
|
|
112
112
|
if (helper.activeSessionName) {
|
|
113
|
-
|
|
113
|
+
const sessions = helper.sessionPages || helper.sessionWindows;
|
|
114
|
+
for (const sessionName in sessions) {
|
|
114
115
|
const screenshotFileName = `${sessionName}_${fileName}`;
|
|
115
116
|
test.artifacts[`${sessionName.replace(/ /g, '_')}_screenshot`] = path.join(global.output_dir, screenshotFileName);
|
|
116
117
|
allureReporter.addAttachment(`${sessionName} - Last Seen Screenshot`, fs.readFileSync(path.join(global.output_dir, screenshotFileName)), dataType);
|
|
@@ -112,11 +112,13 @@ module.exports = function (config) {
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
event.dispatcher.on(event.test.failed, (test, err) => {
|
|
115
|
+
// BeforeSuite/AfterSuite don't have any access to the browser, hence it could not take screenshot.
|
|
116
|
+
if (test.ctx._runnable.title.includes('hook: BeforeSuite')) return;
|
|
115
117
|
persist(test, err);
|
|
116
118
|
});
|
|
117
119
|
|
|
118
120
|
event.dispatcher.on(event.all.result, () => {
|
|
119
|
-
if (!Object.keys(slides).length) return;
|
|
121
|
+
if (Object.keys(recordedTests).length === 0 || !Object.keys(slides).length) return;
|
|
120
122
|
|
|
121
123
|
let links = '';
|
|
122
124
|
|
|
@@ -148,7 +150,7 @@ module.exports = function (config) {
|
|
|
148
150
|
stepNum++;
|
|
149
151
|
slides[fileName] = step;
|
|
150
152
|
try {
|
|
151
|
-
await helper.saveScreenshot(path.
|
|
153
|
+
await helper.saveScreenshot(path.join(dir, fileName), config.fullPageScreenshots);
|
|
152
154
|
} catch (err) {
|
|
153
155
|
output.plugin(`Can't save step screenshot: ${err}`);
|
|
154
156
|
error = err;
|
package/lib/utils.js
CHANGED
|
@@ -291,7 +291,7 @@ module.exports.screenshotOutputFolder = function (fileName) {
|
|
|
291
291
|
const fileSep = path.sep;
|
|
292
292
|
|
|
293
293
|
if (!fileName.includes(fileSep) || fileName.includes('record_')) {
|
|
294
|
-
return path.
|
|
294
|
+
return path.resolve(global.output_dir, fileName);
|
|
295
295
|
}
|
|
296
296
|
return path.resolve(global.codecept_dir, fileName);
|
|
297
297
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3-beta.2",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"acorn": "8.11.3",
|
|
78
78
|
"arrify": "2.0.1",
|
|
79
79
|
"axios": "1.6.7",
|
|
80
|
-
"chai": "5.1.
|
|
80
|
+
"chai": "5.1.1",
|
|
81
81
|
"chai-deep-match": "1.2.1",
|
|
82
82
|
"chai-exclude": "2.1.0",
|
|
83
83
|
"chai-json-schema": "1.5.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"cross-spawn": "7.0.3",
|
|
90
90
|
"css-to-xpath": "0.1.0",
|
|
91
91
|
"csstoxpath": "1.6.0",
|
|
92
|
-
"devtools": "8.
|
|
92
|
+
"devtools": "8.36.1",
|
|
93
93
|
"envinfo": "7.11.1",
|
|
94
94
|
"escape-string-regexp": "4.0.0",
|
|
95
95
|
"figures": "3.2.0",
|
|
@@ -98,16 +98,16 @@
|
|
|
98
98
|
"glob": "6.0.1",
|
|
99
99
|
"html-minifier-terser": "7.2.0",
|
|
100
100
|
"inquirer": "6.5.2",
|
|
101
|
-
"joi": "17.
|
|
101
|
+
"joi": "17.13.0",
|
|
102
102
|
"js-beautify": "1.15.1",
|
|
103
103
|
"lodash.clonedeep": "4.5.0",
|
|
104
104
|
"lodash.merge": "4.6.2",
|
|
105
105
|
"mkdirp": "1.0.4",
|
|
106
106
|
"mocha": "10.4.0",
|
|
107
|
-
"monocart-coverage-reports": "2.
|
|
107
|
+
"monocart-coverage-reports": "2.8.3",
|
|
108
108
|
"ms": "2.1.3",
|
|
109
109
|
"ora-classic": "5.4.2",
|
|
110
|
-
"pactum": "3.6.
|
|
110
|
+
"pactum": "3.6.9",
|
|
111
111
|
"parse-function": "5.6.10",
|
|
112
112
|
"parse5": "7.1.2",
|
|
113
113
|
"promise-retry": "1.1.1",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"uuid": "9.0"
|
|
117
117
|
},
|
|
118
118
|
"optionalDependencies": {
|
|
119
|
-
"@codeceptjs/detox-helper": "1.0.
|
|
119
|
+
"@codeceptjs/detox-helper": "1.0.7"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@codeceptjs/mock-request": "0.3.1",
|
|
@@ -128,43 +128,43 @@
|
|
|
128
128
|
"@types/node": "20.11.30",
|
|
129
129
|
"@wdio/sauce-service": "8.35.1",
|
|
130
130
|
"@wdio/selenium-standalone-service": "8.3.2",
|
|
131
|
-
"@wdio/utils": "8.
|
|
131
|
+
"@wdio/utils": "8.36.1",
|
|
132
132
|
"@xmldom/xmldom": "0.8.10",
|
|
133
133
|
"apollo-server-express": "2.25.3",
|
|
134
|
-
"chai-as-promised": "7.1.
|
|
134
|
+
"chai-as-promised": "7.1.2",
|
|
135
135
|
"chai-subset": "1.6.0",
|
|
136
136
|
"contributor-faces": "1.1.0",
|
|
137
137
|
"documentation": "12.3.0",
|
|
138
|
-
"electron": "30.0.
|
|
139
|
-
"eslint": "
|
|
138
|
+
"electron": "30.0.3",
|
|
139
|
+
"eslint": "9.2.0",
|
|
140
140
|
"eslint-config-airbnb-base": "15.0.0",
|
|
141
141
|
"eslint-plugin-import": "2.29.1",
|
|
142
|
-
"eslint-plugin-mocha": "
|
|
142
|
+
"eslint-plugin-mocha": "10.4.3",
|
|
143
143
|
"expect": "29.7.0",
|
|
144
144
|
"express": "4.19.2",
|
|
145
145
|
"graphql": "14.6.0",
|
|
146
146
|
"husky": "8.0.3",
|
|
147
147
|
"inquirer-test": "2.0.1",
|
|
148
|
-
"jsdoc": "
|
|
148
|
+
"jsdoc": "4.0.3",
|
|
149
149
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
150
150
|
"json-server": "0.10.1",
|
|
151
|
-
"playwright": "1.
|
|
152
|
-
"puppeteer": "22.
|
|
151
|
+
"playwright": "1.44.0",
|
|
152
|
+
"puppeteer": "22.10.0",
|
|
153
153
|
"qrcode-terminal": "0.12.0",
|
|
154
154
|
"rosie": "2.1.1",
|
|
155
155
|
"runok": "0.9.3",
|
|
156
|
-
"sinon": "
|
|
156
|
+
"sinon": "18.0.0",
|
|
157
157
|
"sinon-chai": "3.7.0",
|
|
158
158
|
"testcafe": "3.5.0",
|
|
159
159
|
"ts-morph": "21.0.1",
|
|
160
160
|
"ts-node": "10.9.2",
|
|
161
161
|
"tsd": "^0.31.0",
|
|
162
162
|
"tsd-jsdoc": "2.5.0",
|
|
163
|
-
"typedoc": "0.25.
|
|
163
|
+
"typedoc": "0.25.13",
|
|
164
164
|
"typedoc-plugin-markdown": "3.17.1",
|
|
165
165
|
"typescript": "5.3.3",
|
|
166
166
|
"wdio-docker-service": "1.5.0",
|
|
167
|
-
"webdriverio": "8.
|
|
167
|
+
"webdriverio": "8.36.1",
|
|
168
168
|
"xml2js": "0.6.2",
|
|
169
169
|
"xpath": "0.0.34"
|
|
170
170
|
},
|
|
@@ -4825,7 +4825,6 @@ declare namespace CodeceptJS {
|
|
|
4825
4825
|
stopRecordingTraffic(): Promise<any>;
|
|
4826
4826
|
/**
|
|
4827
4827
|
* Returns full URL of request matching parameter "urlMatch".
|
|
4828
|
-
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
4829
4828
|
*
|
|
4830
4829
|
* Examples:
|
|
4831
4830
|
*
|
|
@@ -4833,6 +4832,7 @@ declare namespace CodeceptJS {
|
|
|
4833
4832
|
* I.grabTrafficUrl('https://api.example.com/session');
|
|
4834
4833
|
* I.grabTrafficUrl(/session.*start/);
|
|
4835
4834
|
* ```
|
|
4835
|
+
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
4836
4836
|
*/
|
|
4837
4837
|
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
4838
4838
|
/**
|
package/typings/types.d.ts
CHANGED
|
@@ -5076,7 +5076,6 @@ declare namespace CodeceptJS {
|
|
|
5076
5076
|
stopRecordingTraffic(): void;
|
|
5077
5077
|
/**
|
|
5078
5078
|
* Returns full URL of request matching parameter "urlMatch".
|
|
5079
|
-
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
5080
5079
|
*
|
|
5081
5080
|
* Examples:
|
|
5082
5081
|
*
|
|
@@ -5084,6 +5083,7 @@ declare namespace CodeceptJS {
|
|
|
5084
5083
|
* I.grabTrafficUrl('https://api.example.com/session');
|
|
5085
5084
|
* I.grabTrafficUrl(/session.*start/);
|
|
5086
5085
|
* ```
|
|
5086
|
+
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
5087
5087
|
*/
|
|
5088
5088
|
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
5089
5089
|
/**
|