@zohodesk/testinglibrary 0.1.8-exp-bdd-v2 → 0.1.8-exp-bdd-v4
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/.eslintrc.js +5 -1
- package/build/bdd-framework/cli/commands/env.js +2 -3
- package/build/bdd-framework/cli/commands/export.js +1 -2
- package/build/bdd-framework/cli/commands/test.js +7 -4
- package/build/bdd-framework/cli/options.js +1 -2
- package/build/bdd-framework/config/env.js +2 -1
- package/build/bdd-framework/config/index.js +1 -2
- package/build/bdd-framework/config/lang.js +14 -0
- package/build/bdd-framework/cucumber/loadSteps.js +8 -3
- package/build/bdd-framework/decorators.js +6 -10
- package/build/bdd-framework/gen/fixtures.js +48 -0
- package/build/bdd-framework/gen/formatter.js +57 -10
- package/build/bdd-framework/gen/i18n.js +6 -2
- package/build/bdd-framework/gen/index.js +7 -6
- package/build/bdd-framework/gen/testFile.js +105 -39
- package/build/bdd-framework/gen/testNode.js +16 -3
- package/build/bdd-framework/gen/testPoms.js +18 -8
- package/build/bdd-framework/hooks/scenario.js +107 -0
- package/build/bdd-framework/hooks/worker.js +83 -0
- package/build/bdd-framework/playwright/fixtureParameterNames.js +24 -8
- package/build/bdd-framework/playwright/getLocationInFile.js +13 -7
- package/build/bdd-framework/playwright/testTypeImpl.js +11 -7
- package/build/bdd-framework/playwright/transform.js +6 -2
- package/build/bdd-framework/playwright/utils.js +1 -4
- package/build/bdd-framework/run/StepInvoker.js +73 -0
- package/build/bdd-framework/run/bddFixtures.js +119 -57
- package/build/bdd-framework/run/bddWorld.js +24 -36
- package/build/bdd-framework/snippets/index.js +3 -2
- package/build/bdd-framework/snippets/snippetSyntax.js +3 -1
- package/build/bdd-framework/stepDefinitions/createBdd.js +28 -11
- package/build/bdd-framework/stepDefinitions/decorators/{poms.js → class.js} +7 -3
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +8 -3
- package/build/bdd-framework/stepDefinitions/defineStep.js +2 -1
- package/build/bdd-framework/utils/exit.js +8 -4
- package/build/bdd-framework/utils/index.js +27 -1
- package/build/bdd-framework/utils/logger.js +4 -3
- package/build/bdd-poc/core-runner/main.js +10 -0
- package/build/bdd-poc/core-runner/stepDefinitions.js +0 -1
- package/build/bdd-poc/index.js +26 -0
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +6 -6
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +1 -2
- package/build/bdd-poc/test/testDataMap.js +5 -5
- package/build/core/jest/preprocessor/jsPreprocessor.js +2 -3
- package/build/core/playwright/builtInFixtures/addTags.js +19 -0
- package/build/core/playwright/builtInFixtures/cacheLayer.js +13 -0
- package/build/core/playwright/builtInFixtures/context.js +15 -0
- package/build/core/playwright/builtInFixtures/index.js +26 -0
- package/build/core/playwright/builtInFixtures/page.js +51 -0
- package/build/core/playwright/clear-caches.js +29 -0
- package/build/core/playwright/custom-commands.js +1 -2
- package/build/core/playwright/index.js +12 -93
- package/build/core/playwright/readConfigFile.js +12 -6
- package/build/core/playwright/report-generator.js +2 -1
- package/build/core/playwright/setup/config-creator.js +23 -17
- package/build/core/playwright/setup/config-utils.js +43 -11
- package/build/core/playwright/setup/custom-reporter.js +109 -0
- package/build/core/playwright/tag-processor.js +68 -0
- package/build/core/playwright/test-runner.js +40 -36
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +2 -16
- package/build/index.d.ts +59 -4
- package/build/index.js +10 -9
- package/build/lib/cli.js +10 -1
- package/build/parser/parser.js +0 -1
- package/build/setup-folder-structure/helper.js +34 -0
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +25 -0
- package/build/setup-folder-structure/reportEnhancement/reportAlteration.js +25 -0
- package/build/setup-folder-structure/samples/git-ignore.sample.js +8 -4
- package/build/setup-folder-structure/samples/uat-config-sample.js +3 -2
- package/build/setup-folder-structure/setupProject.js +10 -5
- package/build/utils/fileUtils.js +15 -4
- package/build/utils/logger.js +1 -2
- package/build/utils/stepDefinitionsFormatter.js +1 -2
- package/changelog.md +57 -0
- package/npm-shrinkwrap.json +1426 -2172
- package/package.json +5 -4
- package/build/bdd-framework/cucumber/gherkin.d.ts +0 -45
- package/build/bdd-framework/gen/poms.js +0 -46
- package/build/bdd-framework/stepDefinitions/createDecorators.js +0 -109
- package/build/bdd-poc/main.js +0 -10
- /package/build/bdd-poc/{runner.js → core-runner/runner.js} +0 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @property {boolean} video - video for test cases,
|
|
12
12
|
* @property {boolean} debug - debug mode
|
|
13
13
|
* @property {string} mode: mode in which the test cases needs to run
|
|
14
|
-
* @property {boolean} isAuthMode - Auth Mode
|
|
14
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
15
15
|
* @property {string} authFilePath - File Path where the cookies stored
|
|
16
16
|
* @property {any} browsers: List of browsers
|
|
17
17
|
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
* @property {Object} additionalPages: custom pages configuration
|
|
23
23
|
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
24
24
|
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
25
|
-
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is {width: 1280, height: 720 }
|
|
25
|
+
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
26
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -61,14 +61,18 @@ function createUatConfig() {
|
|
|
61
61
|
function createAuthenticationFile() {
|
|
62
62
|
const isUATexist = _path.default.resolve(process.cwd(), 'uat');
|
|
63
63
|
if ((0, _fs.existsSync)(isUATexist)) {
|
|
64
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating Authentication File ....');
|
|
65
64
|
try {
|
|
66
|
-
(0, _fs.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
if (!(0, _fs.existsSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures'))) {
|
|
66
|
+
(0, _fs.mkdirSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures'));
|
|
67
|
+
}
|
|
68
|
+
if (!(0, _fs.existsSync)(_path.default.resolve(process.cwd(), 'uat', 'playwright', '.auth'))) {
|
|
69
|
+
(0, _fs.mkdirSync)(_path.default.resolve(process.cwd(), 'uat', 'playwright', '.auth'), {
|
|
70
|
+
recursive: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
70
73
|
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'auth.setup.js'), getSetupFileAsString('auth-setup-sample.js'), null, 2);
|
|
71
74
|
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'authUsers.json'), getSetupFileAsString('authUsers-sample.json'), null, 2);
|
|
75
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating Authentication File ....');
|
|
72
76
|
} catch (err) {
|
|
73
77
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Something went wrong ! Folder not Created. Please re-initialize npm init-uat');
|
|
74
78
|
}
|
|
@@ -91,6 +95,7 @@ function setupProject() {
|
|
|
91
95
|
createFolderForUAT();
|
|
92
96
|
createConfigJson();
|
|
93
97
|
createAuthenticationFile();
|
|
98
|
+
//updateGitIgnore()
|
|
94
99
|
// Create folder for playwright . Inside .auth folder needs to be created. user.json
|
|
95
100
|
// Add playwright and test-results to .gitignore
|
|
96
101
|
setTimeout(() => {
|
package/build/utils/fileUtils.js
CHANGED
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.checkIfFileExists = checkIfFileExists;
|
|
8
8
|
exports.deleteFile = deleteFile;
|
|
9
|
+
exports.deleteFolder = deleteFolder;
|
|
9
10
|
exports.readFileContents = readFileContents;
|
|
10
11
|
exports.writeFileContents = writeFileContents;
|
|
11
12
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
|
+
var _path = _interopRequireDefault(require("path"));
|
|
12
14
|
function checkIfFileExists(file) {
|
|
13
15
|
try {
|
|
14
16
|
_fs.default.accessSync(file, _fs.default.constants.F_OK);
|
|
@@ -26,9 +28,7 @@ function readFileContents(filePath) {
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
function writeFileContents(filePath, content, writeOptions = {}) {
|
|
29
|
-
|
|
30
|
-
let fileName = filePaths.pop();
|
|
31
|
-
let directoryPath = filePaths.join('/');
|
|
31
|
+
const directoryPath = _path.default.dirname(filePath);
|
|
32
32
|
|
|
33
33
|
// Check if the directory exists
|
|
34
34
|
if (!_fs.default.existsSync(directoryPath)) {
|
|
@@ -37,7 +37,7 @@ function writeFileContents(filePath, content, writeOptions = {}) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
|
-
_fs.default.writeFileSync(`${
|
|
40
|
+
_fs.default.writeFileSync(`${filePath}`, content, writeOptions);
|
|
41
41
|
} catch (err) {
|
|
42
42
|
throw new Error(err);
|
|
43
43
|
}
|
|
@@ -50,4 +50,15 @@ function deleteFile(filePath) {
|
|
|
50
50
|
throw new Error(`Error while deleting the test data file: ${filePath}`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
}
|
|
54
|
+
function deleteFolder(folderPath) {
|
|
55
|
+
if (_fs.default.existsSync(folderPath)) {
|
|
56
|
+
try {
|
|
57
|
+
_fs.default.rmdirSync(folderPath, {
|
|
58
|
+
recursive: true
|
|
59
|
+
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
throw new Error(`Error while deleting the test data file: ${folderPath}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
53
64
|
}
|
package/build/utils/logger.js
CHANGED
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.delimiters = void 0;
|
|
7
7
|
exports.findDelimiterFromStep = findDelimiterFromStep;
|
|
8
|
-
const delimiters = ["Given", "When", "Then", "And"];
|
|
9
|
-
exports.delimiters = delimiters;
|
|
8
|
+
const delimiters = exports.delimiters = ["Given", "When", "Then", "And"];
|
|
10
9
|
function findDelimiterFromStep(step) {
|
|
11
10
|
return delimiters.find(delimiter => step.includes(delimiter));
|
|
12
11
|
}
|
package/changelog.md
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
# Testing Framework
|
|
2
2
|
|
|
3
3
|
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
+
# 0.1.8
|
|
5
|
+
**Issue Fixes**
|
|
6
|
+
- Fix #9 Custom report generate Error on Windows
|
|
7
|
+
- Add Tags annotations only on bddMode
|
|
8
|
+
|
|
9
|
+
**Enhancements**
|
|
10
|
+
- Added Failed steps in test summary
|
|
11
|
+
|
|
12
|
+
# 0.1.7
|
|
13
|
+
**Enhancements**
|
|
14
|
+
- Added option to run teardown logic.
|
|
15
|
+
- Added support for tag based filtering.
|
|
16
|
+
- Playwright-bdd version updated to 5.6.0.
|
|
17
|
+
- New fixture added to add tag as annotations in test report
|
|
18
|
+
|
|
19
|
+
**Issue Fixes**
|
|
20
|
+
- Edition command option. Fixed the edition tags not generated properly
|
|
21
|
+
|
|
22
|
+
# 0.1.6
|
|
23
|
+
|
|
24
|
+
**Enhancements**
|
|
25
|
+
- New Command option Added `--edition`.
|
|
26
|
+
- New Configuration Added `editionOrder`.
|
|
27
|
+
`In uat.config.js, editionOrder: ['Free', 'Express']`
|
|
28
|
+
- Cache Layer added
|
|
29
|
+
|
|
30
|
+
**USAGE**
|
|
31
|
+
- npm run uat --edition="Free"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# 0.1.5
|
|
36
|
+
|
|
37
|
+
**Enhancements**
|
|
38
|
+
|
|
39
|
+
- Playwright version updated to `1.40.1`
|
|
40
|
+
- And and But Support added
|
|
41
|
+
- Added Code Suggestions support
|
|
42
|
+
- Custom Reporter added. Now the report will be available in json format.
|
|
43
|
+
- New Commands added.
|
|
44
|
+
|
|
45
|
+
`- help: npx ZDTestingFramework help`
|
|
46
|
+
|
|
47
|
+
- Will list down the commands available in the tool
|
|
48
|
+
|
|
49
|
+
`- clearCaches: npx ZDTestingFramework clearCaches`
|
|
50
|
+
|
|
51
|
+
- Will clear the exisiting cookies in the authentication setup
|
|
52
|
+
|
|
53
|
+
**Issue Fixes**
|
|
54
|
+
|
|
55
|
+
- Fixed Issue that occurs while quitting node process.
|
|
56
|
+
|
|
57
|
+
# 0.1.4
|
|
58
|
+
|
|
59
|
+
- `testIdAttribute` config added
|
|
60
|
+
- Fixed issue while reading boolean configuration values
|
|
4
61
|
|
|
5
62
|
# 0.1.3
|
|
6
63
|
|