codeceptjs 3.3.0-beta.4 → 3.3.1
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 +43 -1
- package/README.md +26 -0
- package/docs/api.md +45 -30
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +58 -43
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +99 -70
- package/docs/build/Playwright.js +187 -109
- package/docs/build/Protractor.js +70 -32
- package/docs/build/Puppeteer.js +141 -98
- package/docs/build/REST.js +4 -1
- package/docs/build/TestCafe.js +96 -65
- package/docs/build/WebDriver.js +183 -133
- package/docs/changelog.md +92 -0
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/email.md +5 -0
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +113 -15
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/MockRequest.md +8 -6
- package/docs/helpers/Nightmare.md +131 -29
- package/docs/helpers/Playwright.md +424 -215
- package/docs/helpers/Puppeteer.md +229 -92
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +166 -62
- package/docs/helpers/WebDriver.md +254 -103
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/videos.md +2 -2
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +7 -2
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +49 -13
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +6 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +4 -3
- package/typings/types.d.ts +598 -600
package/lib/interfaces/bdd.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { CucumberExpression, ParameterTypeRegistry } = require('cucumber-expressions');
|
|
2
|
+
const Config = require('../config');
|
|
2
3
|
|
|
3
4
|
let steps = {};
|
|
4
5
|
|
|
@@ -9,7 +10,11 @@ const STACK_POSITION = 2;
|
|
|
9
10
|
* @param {*} fn
|
|
10
11
|
*/
|
|
11
12
|
const addStep = (step, fn) => {
|
|
13
|
+
const avoidDuplicateSteps = Config.get('gherkin', {}).avoidDuplicateSteps || false;
|
|
12
14
|
const stack = (new Error()).stack;
|
|
15
|
+
if (avoidDuplicateSteps && steps[step]) {
|
|
16
|
+
throw new Error(`Step '${step}' is already defined`);
|
|
17
|
+
}
|
|
13
18
|
steps[step] = fn;
|
|
14
19
|
fn.line = stack && stack.split('\n')[STACK_POSITION];
|
|
15
20
|
if (fn.line) {
|
package/lib/listener/steps.js
CHANGED
|
@@ -69,6 +69,7 @@ module.exports = function () {
|
|
|
69
69
|
event.dispatcher.on(event.step.started, (step) => {
|
|
70
70
|
if (store.debugMode) return;
|
|
71
71
|
step.startedAt = +new Date();
|
|
72
|
+
step.test = currentTest;
|
|
72
73
|
if (currentHook && Array.isArray(currentHook.steps)) {
|
|
73
74
|
return currentHook.steps.push(step);
|
|
74
75
|
}
|
|
@@ -142,18 +142,20 @@ module.exports = function (config) {
|
|
|
142
142
|
if (step.metaStep && step.metaStep.name === 'BeforeSuite') return;
|
|
143
143
|
|
|
144
144
|
const fileName = `${pad.substring(0, pad.length - stepNum.toString().length) + stepNum.toString()}.png`;
|
|
145
|
+
if (step.status === 'failed') {
|
|
146
|
+
scenarioFailed = true;
|
|
147
|
+
}
|
|
148
|
+
stepNum++;
|
|
149
|
+
slides[fileName] = step;
|
|
145
150
|
try {
|
|
146
|
-
if (step.status === 'failed') {
|
|
147
|
-
scenarioFailed = true;
|
|
148
|
-
}
|
|
149
|
-
stepNum++;
|
|
150
|
-
slides[fileName] = step;
|
|
151
151
|
await helper.saveScreenshot(path.relative(reportDir, path.join(dir, fileName)), config.fullPageScreenshots);
|
|
152
152
|
} catch (err) {
|
|
153
153
|
output.plugin(`Can't save step screenshot: ${err}`);
|
|
154
154
|
error = err;
|
|
155
|
+
return;
|
|
156
|
+
} finally {
|
|
157
|
+
savedStep = step;
|
|
155
158
|
}
|
|
156
|
-
savedStep = step;
|
|
157
159
|
|
|
158
160
|
if (!currentTest.artifacts.screenshots) currentTest.artifacts.screenshots = [];
|
|
159
161
|
// added attachments to test
|
package/lib/workers.js
CHANGED
|
@@ -358,6 +358,18 @@ class Workers extends EventEmitter {
|
|
|
358
358
|
case event.test.after:
|
|
359
359
|
this.emit(event.test.after, repackTest(message.data));
|
|
360
360
|
break;
|
|
361
|
+
case event.step.finished:
|
|
362
|
+
this.emit(event.step.finished, message.data);
|
|
363
|
+
break;
|
|
364
|
+
case event.step.started:
|
|
365
|
+
this.emit(event.step.started, message.data);
|
|
366
|
+
break;
|
|
367
|
+
case event.step.passed:
|
|
368
|
+
this.emit(event.step.passed, message.data);
|
|
369
|
+
break;
|
|
370
|
+
case event.step.failed:
|
|
371
|
+
this.emit(event.step.failed, message.data);
|
|
372
|
+
break;
|
|
361
373
|
}
|
|
362
374
|
});
|
|
363
375
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"allure-js-commons": "^1.3.2",
|
|
60
60
|
"arrify": "^2.0.1",
|
|
61
61
|
"axios": "^0.21.4",
|
|
62
|
+
"chai": "^4.3.6",
|
|
62
63
|
"chai-deep-match": "^1.2.1",
|
|
63
64
|
"chalk": "^4.1.2",
|
|
64
65
|
"commander": "^2.20.3",
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"devDependencies": {
|
|
92
93
|
"@codeceptjs/detox-helper": "^1.0.2",
|
|
93
94
|
"@codeceptjs/mock-request": "^0.3.1",
|
|
95
|
+
"@faker-js/faker": "^5.5.3",
|
|
94
96
|
"@pollyjs/adapter-puppeteer": "^5.1.0",
|
|
95
97
|
"@pollyjs/core": "^5.1.0",
|
|
96
98
|
"@types/inquirer": "^0.0.35",
|
|
@@ -111,7 +113,6 @@
|
|
|
111
113
|
"eslint-plugin-mocha": "^6.3.0",
|
|
112
114
|
"expect": "^26.6.2",
|
|
113
115
|
"express": "^4.17.2",
|
|
114
|
-
"faker": "5.5.3",
|
|
115
116
|
"form-data": "^3.0.1",
|
|
116
117
|
"graphql": "^14.6.0",
|
|
117
118
|
"husky": "^4.3.8",
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
"npm": ">=5.6.0"
|
|
145
146
|
},
|
|
146
147
|
"peerDependencies": {
|
|
147
|
-
"faker": "^5.5.
|
|
148
|
+
"@faker-js/faker": "^5.5.3"
|
|
148
149
|
},
|
|
149
150
|
"es6": true,
|
|
150
151
|
"husky": {
|