@zohodesk/testinglibrary 0.1.8-exp-bdd-v1 → 0.1.8-exp.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/.babelrc +18 -18
- package/.eslintrc.js +31 -27
- package/.prettierrc +5 -5
- package/README.md +17 -17
- package/bin/cli.js +2 -2
- package/build/bdd-framework/cli/commands/env.js +4 -4
- package/build/bdd-framework/cli/commands/test.js +6 -2
- package/build/bdd-framework/cli/options.js +4 -4
- package/build/bdd-framework/cli/worker.js +3 -3
- package/build/bdd-framework/config/dir.js +6 -6
- package/build/bdd-framework/config/env.js +5 -4
- package/build/bdd-framework/config/index.js +2 -2
- package/build/bdd-framework/config/lang.js +14 -0
- package/build/bdd-framework/cucumber/buildStepDefinition.js +3 -3
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +3 -3
- package/build/bdd-framework/cucumber/loadSources.js +9 -9
- package/build/bdd-framework/cucumber/loadSteps.js +8 -3
- package/build/bdd-framework/decorators.js +2 -2
- package/build/bdd-framework/gen/fixtures.js +48 -0
- package/build/bdd-framework/gen/formatter.js +64 -17
- package/build/bdd-framework/gen/i18n.js +9 -5
- package/build/bdd-framework/gen/index.js +9 -8
- package/build/bdd-framework/gen/testFile.js +121 -55
- package/build/bdd-framework/gen/testNode.js +19 -6
- package/build/bdd-framework/gen/testPoms.js +49 -39
- 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 +27 -11
- package/build/bdd-framework/playwright/getLocationInFile.js +17 -11
- package/build/bdd-framework/playwright/loadConfig.js +3 -3
- package/build/bdd-framework/playwright/testTypeImpl.js +19 -15
- package/build/bdd-framework/playwright/transform.js +10 -6
- package/build/bdd-framework/playwright/utils.js +3 -6
- package/build/bdd-framework/run/StepInvoker.js +73 -0
- package/build/bdd-framework/run/bddFixtures.js +118 -55
- package/build/bdd-framework/run/bddWorld.js +24 -36
- package/build/bdd-framework/snippets/index.js +5 -3
- package/build/bdd-framework/snippets/snippetSyntax.js +3 -1
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +4 -4
- package/build/bdd-framework/stepDefinitions/createBdd.js +30 -13
- package/build/bdd-framework/stepDefinitions/decorators/{poms.js → class.js} +13 -9
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +14 -8
- package/build/bdd-framework/stepDefinitions/defineStep.js +5 -4
- package/build/bdd-framework/stepDefinitions/stepConfig.js +5 -5
- package/build/bdd-framework/utils/exit.js +26 -18
- package/build/bdd-framework/utils/index.js +30 -4
- package/build/bdd-framework/utils/jsStringWrap.js +9 -9
- package/build/bdd-framework/utils/logger.js +5 -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 -1
- package/build/core/playwright/index.js +6 -74
- package/build/core/playwright/readConfigFile.js +37 -30
- package/build/core/playwright/report-generator.js +2 -1
- package/build/core/playwright/setup/config-creator.js +43 -20
- package/build/core/playwright/setup/config-utils.js +30 -0
- 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 +8 -12
- package/build/index.d.ts +60 -5
- package/build/index.js +18 -12
- package/build/lib/cli.js +10 -1
- package/build/parser/sample.feature +34 -34
- package/build/parser/sample.spec.js +18 -18
- package/build/setup-folder-structure/helper.js +35 -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/auth-setup-sample.js +72 -72
- package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
- package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
- package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -32
- package/build/setup-folder-structure/samples/uat-config-sample.js +44 -43
- package/build/setup-folder-structure/setupProject.js +10 -5
- package/build/utils/cliArgsToObject.js +29 -25
- package/build/utils/fileUtils.js +15 -4
- package/changelog.md +137 -74
- package/jest.config.js +63 -63
- package/npm-shrinkwrap.json +6469 -7781
- package/package.json +55 -54
- package/playwright.config.js +112 -112
- 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 -108
- package/build/bdd-poc/core-runner/exportMethods.js +0 -20
- package/build/bdd-poc/core-runner/stepDefinitions.js +0 -53
- package/build/bdd-poc/main.js +0 -10
- package/build/bdd-poc/runner.js +0 -19
- package/build/bdd-poc/test/cucumber/featureFileParer.js +0 -81
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +0 -36
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +0 -43
- package/build/bdd-poc/test/testDataMap.js +0 -98
- package/build/bdd-poc/test/testStructure.js +0 -83
- package/build/bdd-poc/utils/stringManipulation.js +0 -19
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { Logger } from '../utils/logger';
|
|
4
|
-
import { generateConfigFromFile } from '../core/playwright/readConfigFile';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { reportPath = path.resolve(process.cwd(), 'uat', 'playwright-reports') } = generateConfigFromFile();
|
|
8
|
-
const testResultsPath = path.resolve(process.cwd(), 'uat', 'test-results');
|
|
9
|
-
|
|
10
|
-
const testResultsRelativepath = path.relative(
|
|
11
|
-
const reportRelativepath = path.relative(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { Logger } from '../utils/logger';
|
|
4
|
+
import { generateConfigFromFile } from '../core/playwright/readConfigFile';
|
|
5
|
+
const gitIgnoreAbsolutePath = path.resolve(process.cwd(), '../', '../')
|
|
6
|
+
|
|
7
|
+
const { reportPath = path.resolve(process.cwd(), 'uat', 'playwright-reports') } = generateConfigFromFile();
|
|
8
|
+
const testResultsPath = path.resolve(process.cwd(), 'uat', 'test-results');
|
|
9
|
+
|
|
10
|
+
const testResultsRelativepath = path.relative(gitIgnoreAbsolutePath, testResultsPath)
|
|
11
|
+
const reportRelativepath = path.relative(gitIgnoreAbsolutePath, reportPath)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const absolutePathfeaturegen = path.resolve(process.cwd(), 'uat', '.features-gen');
|
|
15
|
+
const featuregenRelativePath = path.relative(gitIgnoreAbsolutePath,absolutePathfeaturegen)
|
|
16
|
+
|
|
17
|
+
const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}\n${featuregenRelativePath}`
|
|
18
|
+
|
|
19
|
+
function updateGitIgnore() {
|
|
20
|
+
if (existsSync(path.resolve(process.cwd(), '../', '../', '.gitignore'))) {
|
|
21
|
+
let gitIgnoreData = readFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore'), 'utf-8', (err) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
Logger.log(Logger.FAILURE_TYPE, 'cannot able to read git ignore ')
|
|
24
|
+
// process.exit()
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
if (gitIgnoreData.includes(dirpathtoIgnore)) {
|
|
28
|
+
return
|
|
29
|
+
} else {
|
|
30
|
+
writeFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore', dirpathtoIgnore, null, 2))
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
Logger.log(Logger.INFO_TYPE, 'GitIgnore file is No Found ....')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
export default updateGitIgnore;
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object|null} viewportConfig
|
|
3
|
-
* @property {number} width - width of the viewport
|
|
4
|
-
* @property {number} height - height of the viewport
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Represents the user configuration object.
|
|
8
|
-
* @typedef {Object} UserConfig
|
|
9
|
-
* @property {string} headless - Headless Browsers mode.
|
|
10
|
-
* @property {number} trace - trace for test cases.
|
|
11
|
-
* @property {boolean} video - video for test cases,
|
|
12
|
-
* @property {boolean} debug - debug mode
|
|
13
|
-
* @property {string} mode: mode in which the test cases needs to run
|
|
14
|
-
* @property {boolean} isAuthMode - Auth Mode
|
|
15
|
-
* @property {string} authFilePath - File Path where the cookies stored
|
|
16
|
-
* @property {any} browsers: List of browsers
|
|
17
|
-
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
18
|
-
* @property {any} reportPath : directory where report is generate
|
|
19
|
-
* @property {boolean} bddMode: Feature files needs to be processed
|
|
20
|
-
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
21
|
-
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
22
|
-
* @property {Object} additionalPages: custom pages configuration
|
|
23
|
-
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
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 }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object|null} viewportConfig
|
|
3
|
+
* @property {number} width - width of the viewport
|
|
4
|
+
* @property {number} height - height of the viewport
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents the user configuration object.
|
|
8
|
+
* @typedef {Object} UserConfig
|
|
9
|
+
* @property {string} headless - Headless Browsers mode.
|
|
10
|
+
* @property {number} trace - trace for test cases.
|
|
11
|
+
* @property {boolean} video - video for test cases,
|
|
12
|
+
* @property {boolean} debug - debug mode
|
|
13
|
+
* @property {string} mode: mode in which the test cases needs to run
|
|
14
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
15
|
+
* @property {string} authFilePath - File Path where the cookies stored
|
|
16
|
+
* @property {any} browsers: List of browsers
|
|
17
|
+
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
18
|
+
* @property {any} reportPath : directory where report is generate
|
|
19
|
+
* @property {boolean} bddMode: Feature files needs to be processed
|
|
20
|
+
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
21
|
+
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
22
|
+
* @property {Object} additionalPages: custom pages configuration
|
|
23
|
+
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
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 }
|
|
26
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @type {UserConfig}
|
|
31
|
+
*/
|
|
32
|
+
module.exports = {
|
|
33
|
+
headless: false,
|
|
34
|
+
browsers: ['Chrome', 'Firefox', 'Safari', 'Edge'],
|
|
35
|
+
mode: 'dev',
|
|
36
|
+
isAuthMode: true,
|
|
37
|
+
authFilePath: 'uat/playwright/.auth/user.json',
|
|
38
|
+
trace: true,
|
|
39
|
+
video: true,
|
|
40
|
+
bddMode: true,
|
|
41
|
+
featureFilesFolder: 'feature-files',
|
|
42
|
+
stepDefinitionsFolder: 'steps',
|
|
43
|
+
viewport: { width: 1280, height: 720 }
|
|
44
|
+
}
|
|
@@ -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(() => {
|
|
@@ -5,19 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.cliArgsToObject = cliArgsToObject;
|
|
7
7
|
exports.objectToCliArgs = objectToCliArgs;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* const
|
|
20
|
-
*
|
|
8
|
+
exports.parseUserArgs = parseUserArgs;
|
|
9
|
+
/**
|
|
10
|
+
* Converts an array of command-line arguments into an object.
|
|
11
|
+
*
|
|
12
|
+
* @param {string[]} cliArgs - An array of command-line arguments.
|
|
13
|
+
* @param {boolean} [isKeyNeedToBeAdded=true] - Indicates whether the keys should be added to the resulting object.
|
|
14
|
+
* @returns {Object} An object representing the command-line arguments, where keys are argument names (without '--') and values are argument values.
|
|
15
|
+
* If `isKeyNeedToBeAdded` is set to `false`, only values are included in the object with numeric indexes as keys.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Example usage:
|
|
19
|
+
* const args = ['--port=8080', '--verbose', 'input.txt'];
|
|
20
|
+
* const result = cliArgsToObject(args);
|
|
21
|
+
* // result will be: { port: '8080', verbose: true }
|
|
21
22
|
*/
|
|
22
23
|
// eslint-disable-next-line no-unused-vars
|
|
23
24
|
function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
@@ -37,18 +38,18 @@ function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
|
37
38
|
return processEnv;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
/**
|
|
41
|
-
* Converts an object to an array of command-line arguments.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
|
|
44
|
-
* @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
|
|
45
|
-
* @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* // Example usage:
|
|
49
|
-
* const options = { port: 8080, verbose: true, input: 'input.txt' };
|
|
50
|
-
* const args = objectToCliArgs(options);
|
|
51
|
-
* // args will be: ['--port=8080', '--verbose', '--input=input.txt']
|
|
41
|
+
/**
|
|
42
|
+
* Converts an object to an array of command-line arguments.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
|
|
45
|
+
* @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
|
|
46
|
+
* @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Example usage:
|
|
50
|
+
* const options = { port: 8080, verbose: true, input: 'input.txt' };
|
|
51
|
+
* const args = objectToCliArgs(options);
|
|
52
|
+
* // args will be: ['--port=8080', '--verbose', '--input=input.txt']
|
|
52
53
|
*/
|
|
53
54
|
function objectToCliArgs(objectToBeConverted, isKeyNeedToBeAdded) {
|
|
54
55
|
const argsArray = [];
|
|
@@ -62,4 +63,7 @@ function objectToCliArgs(objectToBeConverted, isKeyNeedToBeAdded) {
|
|
|
62
63
|
}
|
|
63
64
|
});
|
|
64
65
|
return argsArray;
|
|
66
|
+
}
|
|
67
|
+
function parseUserArgs() {
|
|
68
|
+
return cliArgsToObject(process.argv.slice(2));
|
|
65
69
|
}
|
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/changelog.md
CHANGED
|
@@ -1,74 +1,137 @@
|
|
|
1
|
-
# Testing Framework
|
|
2
|
-
|
|
3
|
-
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
-
|
|
5
|
-
# 0.1.
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
# 0.1.
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# 0.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
# 0.
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
# Testing Framework
|
|
2
|
+
|
|
3
|
+
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
+
|
|
5
|
+
# 0.1.8-exp.1
|
|
6
|
+
**Enhancements**
|
|
7
|
+
- Added option to specify browsers in command line.
|
|
8
|
+
- npm run uat -- --browsers='chrome,firefox'
|
|
9
|
+
|
|
10
|
+
# 0.1.8
|
|
11
|
+
**Issue Fixes**
|
|
12
|
+
- Fix #9 Custom report generate Error on Windows
|
|
13
|
+
- Add Tags annotations only on bddMode
|
|
14
|
+
|
|
15
|
+
**Enhancements**
|
|
16
|
+
- Added Failed steps in test summary
|
|
17
|
+
|
|
18
|
+
# 0.1.7
|
|
19
|
+
**Enhancements**
|
|
20
|
+
- Added option to run teardown logic.
|
|
21
|
+
- Added support for tag based filtering.
|
|
22
|
+
- Playwright-bdd version updated to 5.6.0.
|
|
23
|
+
- New fixture added to add tag as annotations in test report
|
|
24
|
+
|
|
25
|
+
**Issue Fixes**
|
|
26
|
+
- Edition command option. Fixed the edition tags not generated properly
|
|
27
|
+
|
|
28
|
+
# 0.1.6
|
|
29
|
+
|
|
30
|
+
**Enhancements**
|
|
31
|
+
- New Command option Added `--edition`.
|
|
32
|
+
- New Configuration Added `editionOrder`.
|
|
33
|
+
`In uat.config.js, editionOrder: ['Free', 'Express']`
|
|
34
|
+
- Cache Layer added
|
|
35
|
+
|
|
36
|
+
**USAGE**
|
|
37
|
+
- npm run uat --edition="Free"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# 0.1.5
|
|
42
|
+
|
|
43
|
+
**Enhancements**
|
|
44
|
+
|
|
45
|
+
- Playwright version updated to `1.40.1`
|
|
46
|
+
- And and But Support added
|
|
47
|
+
- Added Code Suggestions support
|
|
48
|
+
- Custom Reporter added. Now the report will be available in json format.
|
|
49
|
+
- New Commands added.
|
|
50
|
+
|
|
51
|
+
`- help: npx ZDTestingFramework help`
|
|
52
|
+
|
|
53
|
+
- Will list down the commands available in the tool
|
|
54
|
+
|
|
55
|
+
`- clearCaches: npx ZDTestingFramework clearCaches`
|
|
56
|
+
|
|
57
|
+
- Will clear the exisiting cookies in the authentication setup
|
|
58
|
+
|
|
59
|
+
**Issue Fixes**
|
|
60
|
+
|
|
61
|
+
- Fixed Issue that occurs while quitting node process.
|
|
62
|
+
|
|
63
|
+
# 0.1.4
|
|
64
|
+
|
|
65
|
+
- `testIdAttribute` config added
|
|
66
|
+
- Fixed issue while reading boolean configuration values
|
|
67
|
+
|
|
68
|
+
# 0.1.3
|
|
69
|
+
|
|
70
|
+
- uat config sample file updated with `bddMode` and `viewport` values
|
|
71
|
+
- user configuration issue fix when the value is undefined
|
|
72
|
+
|
|
73
|
+
# 0.1.2
|
|
74
|
+
|
|
75
|
+
- Bdd version updated to `5.4.0`
|
|
76
|
+
- Playwright version updated to `1.39.0`
|
|
77
|
+
|
|
78
|
+
# 0.1.1
|
|
79
|
+
|
|
80
|
+
- Fixed post install script error
|
|
81
|
+
- Fixed error `@cucumber/gherkin` not found. Cause of this issue is updating @cucumber/cucumber to 9.5.0. Reverting this version to 9.2.0
|
|
82
|
+
- Removed testing library exports
|
|
83
|
+
|
|
84
|
+
# 0.1.0
|
|
85
|
+
|
|
86
|
+
- Removed eslint as dev dependencies as it causes `npm aliases not supported error` for npm version < 6
|
|
87
|
+
|
|
88
|
+
# 0.0.9
|
|
89
|
+
|
|
90
|
+
- Video sized in report adjusted to viewport size
|
|
91
|
+
- Changes in package.json scripts while setting up project
|
|
92
|
+
|
|
93
|
+
# 0.0.8
|
|
94
|
+
|
|
95
|
+
- Tags Support
|
|
96
|
+
- Enable running without bddmode feature
|
|
97
|
+
- viewport configuration
|
|
98
|
+
- Internal Change - Code refactoring
|
|
99
|
+
|
|
100
|
+
# 0.0.7
|
|
101
|
+
|
|
102
|
+
- Removed react and react-dom as dependencies. Added this as peer dependency
|
|
103
|
+
|
|
104
|
+
# 0.0.6
|
|
105
|
+
|
|
106
|
+
## Provided Initial Support for cucumber feature files
|
|
107
|
+
|
|
108
|
+
- Playwright-bdd and cucumber added as dependencies
|
|
109
|
+
- Added config bddMode which toggles the feature files processing
|
|
110
|
+
- Added expect timeout and test timeout as an option
|
|
111
|
+
- Decorators support for given, when and then. Typescript support needed to use this feature
|
|
112
|
+
|
|
113
|
+
## Internal Library change
|
|
114
|
+
|
|
115
|
+
- Provided support for import/export statements
|
|
116
|
+
|
|
117
|
+
# 0.0.5
|
|
118
|
+
|
|
119
|
+
- Added Init command to initialize the folder structure and configuration for testing
|
|
120
|
+
- Renamed config.json to env-config.json
|
|
121
|
+
- Configured report file path directory and Handled Edge case in Cookies Handling
|
|
122
|
+
|
|
123
|
+
# 0.0.4
|
|
124
|
+
|
|
125
|
+
- Issue Fixes while loading the storage state
|
|
126
|
+
|
|
127
|
+
# 0.0.3
|
|
128
|
+
|
|
129
|
+
- Added Support for custom config generator based on user preferences
|
|
130
|
+
|
|
131
|
+
# 0.0.2
|
|
132
|
+
|
|
133
|
+
- Fix for Finding directories inside node_modules folder
|
|
134
|
+
|
|
135
|
+
# 0.0.1
|
|
136
|
+
|
|
137
|
+
- test and report command support
|
package/jest.config.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { existsSync } = require('fs');
|
|
3
|
-
const appPath = process.cwd();
|
|
4
|
-
|
|
5
|
-
const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
rootDir: process.cwd(),
|
|
9
|
-
testEnvironment: 'jsdom',
|
|
10
|
-
|
|
11
|
-
setupFilesAfterEnv: [
|
|
12
|
-
existsSync(appGlobals) && appGlobals,
|
|
13
|
-
path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
|
|
14
|
-
].filter(Boolean),
|
|
15
|
-
|
|
16
|
-
transform: {
|
|
17
|
-
'^.+\\.(js|jsx)$': path.resolve(
|
|
18
|
-
__dirname,
|
|
19
|
-
'src',
|
|
20
|
-
'core',
|
|
21
|
-
'jest',
|
|
22
|
-
'preprocessor',
|
|
23
|
-
'jsPreprocessor.js'
|
|
24
|
-
)
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
modulePathIgnorePatterns: ['/build/'],
|
|
28
|
-
|
|
29
|
-
transformIgnorePatterns: [
|
|
30
|
-
'/node_modules/(?!(@zohodesk)/)'
|
|
31
|
-
],
|
|
32
|
-
|
|
33
|
-
testPathIgnorePatterns: [
|
|
34
|
-
'/node_modules/',
|
|
35
|
-
'/build/',
|
|
36
|
-
'/uat/'
|
|
37
|
-
],
|
|
38
|
-
|
|
39
|
-
watchPathIgnorePatterns: [
|
|
40
|
-
'/node_modules/',
|
|
41
|
-
'/build/'
|
|
42
|
-
],
|
|
43
|
-
|
|
44
|
-
clearMocks: true,
|
|
45
|
-
resetMocks: false,
|
|
46
|
-
|
|
47
|
-
collectCoverage: true,
|
|
48
|
-
collectCoverageFrom: ['src/**/*.js'],
|
|
49
|
-
coverageDirectory: './build/cov',
|
|
50
|
-
coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
|
|
51
|
-
coverageThreshold: {
|
|
52
|
-
global: {
|
|
53
|
-
branches: 100,
|
|
54
|
-
functions: 100,
|
|
55
|
-
lines: 100,
|
|
56
|
-
statements: 100
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
globals: {
|
|
60
|
-
__DEVELOPMENT__: true,
|
|
61
|
-
__DOCS__: false,
|
|
62
|
-
__TEST__: true
|
|
63
|
-
}
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { existsSync } = require('fs');
|
|
3
|
+
const appPath = process.cwd();
|
|
4
|
+
|
|
5
|
+
const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
rootDir: process.cwd(),
|
|
9
|
+
testEnvironment: 'jsdom',
|
|
10
|
+
|
|
11
|
+
setupFilesAfterEnv: [
|
|
12
|
+
existsSync(appGlobals) && appGlobals,
|
|
13
|
+
path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
|
|
14
|
+
].filter(Boolean),
|
|
15
|
+
|
|
16
|
+
transform: {
|
|
17
|
+
'^.+\\.(js|jsx)$': path.resolve(
|
|
18
|
+
__dirname,
|
|
19
|
+
'src',
|
|
20
|
+
'core',
|
|
21
|
+
'jest',
|
|
22
|
+
'preprocessor',
|
|
23
|
+
'jsPreprocessor.js'
|
|
24
|
+
)
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
modulePathIgnorePatterns: ['/build/'],
|
|
28
|
+
|
|
29
|
+
transformIgnorePatterns: [
|
|
30
|
+
'/node_modules/(?!(@zohodesk)/)'
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
testPathIgnorePatterns: [
|
|
34
|
+
'/node_modules/',
|
|
35
|
+
'/build/',
|
|
36
|
+
'/uat/'
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
watchPathIgnorePatterns: [
|
|
40
|
+
'/node_modules/',
|
|
41
|
+
'/build/'
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
clearMocks: true,
|
|
45
|
+
resetMocks: false,
|
|
46
|
+
|
|
47
|
+
collectCoverage: true,
|
|
48
|
+
collectCoverageFrom: ['src/**/*.js'],
|
|
49
|
+
coverageDirectory: './build/cov',
|
|
50
|
+
coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
|
|
51
|
+
coverageThreshold: {
|
|
52
|
+
global: {
|
|
53
|
+
branches: 100,
|
|
54
|
+
functions: 100,
|
|
55
|
+
lines: 100,
|
|
56
|
+
statements: 100
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
globals: {
|
|
60
|
+
__DEVELOPMENT__: true,
|
|
61
|
+
__DOCS__: false,
|
|
62
|
+
__TEST__: true
|
|
63
|
+
}
|
|
64
64
|
};
|