@zohodesk/testinglibrary 0.1.3 → 0.1.4-exp.10
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 +1 -1
- package/build/bdd-framework/cli/commands/env.js +1 -2
- package/build/bdd-framework/cli/commands/export.js +1 -2
- package/build/bdd-framework/cli/commands/test.js +1 -2
- package/build/bdd-framework/cli/options.js +1 -2
- package/build/bdd-framework/config/index.js +1 -2
- package/build/bdd-framework/decorators.js +4 -8
- package/build/bdd-framework/playwright/utils.js +1 -4
- package/build/bdd-framework/run/bddFixtures.js +1 -2
- package/build/bdd-framework/utils/logger.js +1 -2
- package/build/core/jest/preprocessor/jsPreprocessor.js +2 -3
- package/build/core/playwright/clear-caches.js +29 -0
- package/build/core/playwright/custom-commands.js +1 -2
- package/build/core/playwright/index.js +1 -2
- package/build/core/playwright/readConfigFile.js +10 -6
- package/build/core/playwright/setup/config-creator.js +17 -14
- package/build/core/playwright/setup/config-utils.js +30 -0
- package/build/core/playwright/setup/custom-reporter.js +100 -0
- package/build/core/playwright/test-runner.js +3 -5
- package/build/index.d.ts +56 -3
- package/build/index.js +4 -2
- package/build/lib/cli.js +10 -1
- package/build/setup-folder-structure/helper.js +34 -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 +12 -0
- package/build/utils/logger.js +1 -2
- package/build/utils/stepDefinitionsFormatter.js +1 -2
- package/changelog.md +5 -0
- package/npm-shrinkwrap.json +5777 -3934
- package/package.json +5 -4
|
@@ -2,15 +2,19 @@ import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { Logger } from '../utils/logger';
|
|
4
4
|
import { generateConfigFromFile } from '../core/playwright/readConfigFile';
|
|
5
|
-
|
|
5
|
+
const gitIgnoreAbsolutePath = path.resolve(process.cwd(), '../', '../')
|
|
6
6
|
|
|
7
7
|
const { reportPath = path.resolve(process.cwd(), 'uat', 'playwright-reports') } = generateConfigFromFile();
|
|
8
8
|
const testResultsPath = path.resolve(process.cwd(), 'uat', 'test-results');
|
|
9
9
|
|
|
10
|
-
const testResultsRelativepath = path.relative(
|
|
11
|
-
const reportRelativepath = path.relative(
|
|
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)
|
|
12
16
|
|
|
13
|
-
const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}`
|
|
17
|
+
const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}\n${featuregenRelativePath}`
|
|
14
18
|
|
|
15
19
|
function updateGitIgnore() {
|
|
16
20
|
if (existsSync(path.resolve(process.cwd(), '../', '../', '.gitignore'))) {
|
|
@@ -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,6 +6,7 @@ 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"));
|
|
@@ -50,4 +51,15 @@ function deleteFile(filePath) {
|
|
|
50
51
|
throw new Error(`Error while deleting the test data file: ${filePath}`);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
}
|
|
55
|
+
function deleteFolder(folderPath) {
|
|
56
|
+
if (_fs.default.existsSync(folderPath)) {
|
|
57
|
+
try {
|
|
58
|
+
_fs.default.rmdirSync(folderPath, {
|
|
59
|
+
recursive: true
|
|
60
|
+
});
|
|
61
|
+
} catch (err) {
|
|
62
|
+
throw new Error(`Error while deleting the test data file: ${folderPath}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
53
65
|
}
|
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
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Framework that abstracts the configuration for playwright and Jest
|
|
4
4
|
|
|
5
|
+
# 0.1.4
|
|
6
|
+
|
|
7
|
+
- `testIdAttribute` config added
|
|
8
|
+
- Fixed issue while reading boolean configuration values
|
|
9
|
+
|
|
5
10
|
# 0.1.3
|
|
6
11
|
|
|
7
12
|
- uat config sample file updated with `bddMode` and `viewport` values
|