@zohodesk/testinglibrary 0.1.2 → 0.1.4-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/.eslintrc.js +1 -1
- package/build/core/playwright/clear-caches.js +30 -0
- package/build/core/playwright/readConfigFile.js +20 -4
- package/build/core/playwright/setup/config-creator.js +22 -13
- package/build/core/playwright/setup/config-utils.js +34 -2
- package/build/core/playwright/setup/custom-reporter.js +84 -0
- package/build/lib/cli.js +7 -0
- package/build/setup-folder-structure/samples/git-ignore.sample.js +8 -4
- package/build/setup-folder-structure/samples/uat-config-sample.js +5 -3
- package/build/setup-folder-structure/setupProject.js +10 -5
- package/build/utils/fileUtils.js +12 -0
- package/changelog.md +10 -0
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/.eslintrc.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _fileUtils = require("../../utils/fileUtils");
|
|
10
|
+
var _logger = require("../../utils/logger");
|
|
11
|
+
var _readConfigFile = require("./readConfigFile");
|
|
12
|
+
function clearCaches() {
|
|
13
|
+
try {
|
|
14
|
+
const {
|
|
15
|
+
authFilePath,
|
|
16
|
+
reportPath
|
|
17
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
18
|
+
authFilePath.split('/').pop();
|
|
19
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting auth files present in ${authFilePath}`);
|
|
20
|
+
(0, _fileUtils.deleteFolder)(_path.default.resolve(process.cwd(), authFilePath));
|
|
21
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting Playwright report ${reportPath}`);
|
|
22
|
+
(0, _fileUtils.deleteFolder)(reportPath);
|
|
23
|
+
(0, _fileUtils.deleteFolder)(_path.default.resolve(process.cwd(), 'uat', '.features-gen'));
|
|
24
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared');
|
|
25
|
+
} catch (err) {
|
|
26
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error While clearing cookies');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
var _default = clearCaches;
|
|
30
|
+
exports.default = _default;
|
|
@@ -15,6 +15,7 @@ const fileName = 'uat.config.js';
|
|
|
15
15
|
exports.fileName = fileName;
|
|
16
16
|
function getDefaultConfig() {
|
|
17
17
|
return {
|
|
18
|
+
headless: false,
|
|
18
19
|
browsers: ['Chrome'],
|
|
19
20
|
trace: false,
|
|
20
21
|
video: false,
|
|
@@ -31,14 +32,28 @@ function getDefaultConfig() {
|
|
|
31
32
|
},
|
|
32
33
|
debug: false,
|
|
33
34
|
mode: 'dev',
|
|
34
|
-
additionalPages: {}
|
|
35
|
+
additionalPages: {},
|
|
36
|
+
featureFilesFolder: 'feature-files',
|
|
37
|
+
stepDefinitionsFolder: 'steps',
|
|
38
|
+
testIdAttribute: 'data-testid'
|
|
35
39
|
};
|
|
36
40
|
}
|
|
37
41
|
function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
38
42
|
let defaultConfig = getDefaultConfig();
|
|
43
|
+
let configurationObj = {};
|
|
44
|
+
Object.keys(userConfiguration).forEach(configKey => {
|
|
45
|
+
let configValue = userConfiguration[configKey];
|
|
46
|
+
if (configValue !== null && configValue !== undefined) {
|
|
47
|
+
configurationObj[configKey] = configValue;
|
|
48
|
+
} else if (defaultConfig[configKey]) {
|
|
49
|
+
configurationObj[configKey] = defaultConfig[configKey];
|
|
50
|
+
} else {
|
|
51
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `key - ${configKey} is not yet supported in uat configuration. This will not be used while creating playwright configuration`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
39
54
|
return {
|
|
40
55
|
...defaultConfig,
|
|
41
|
-
...
|
|
56
|
+
...configurationObj
|
|
42
57
|
};
|
|
43
58
|
}
|
|
44
59
|
|
|
@@ -56,7 +71,7 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
56
71
|
* @property {boolean} video - video for test cases,
|
|
57
72
|
* @property {boolean} debug - debug mode
|
|
58
73
|
* @property {string} mode: mode in which the test cases needs to run
|
|
59
|
-
* @property {boolean} isAuthMode - Auth Mode
|
|
74
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
60
75
|
* @property {string} authFilePath - File Path where the cookies stored
|
|
61
76
|
* @property {any} browsers: List of browsers
|
|
62
77
|
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
@@ -67,7 +82,8 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
67
82
|
* @property {Object} additionalPages: custom pages configuration
|
|
68
83
|
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
69
84
|
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
70
|
-
* @property {viewportConfig} viewport: viewport configuration
|
|
85
|
+
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
86
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
71
87
|
*/
|
|
72
88
|
|
|
73
89
|
/**
|
|
@@ -20,7 +20,10 @@ const {
|
|
|
20
20
|
expectTimeout,
|
|
21
21
|
testTimeout,
|
|
22
22
|
authFilePath,
|
|
23
|
-
viewport
|
|
23
|
+
viewport,
|
|
24
|
+
featureFilesFolder,
|
|
25
|
+
stepDefinitionsFolder,
|
|
26
|
+
testIdAttribute
|
|
24
27
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
25
28
|
const projects = (0, _configUtils.getProjects)({
|
|
26
29
|
browsers,
|
|
@@ -30,7 +33,22 @@ const projects = (0, _configUtils.getProjects)({
|
|
|
30
33
|
testTimeout,
|
|
31
34
|
viewport
|
|
32
35
|
});
|
|
33
|
-
const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd()
|
|
36
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
37
|
+
featureFilesFolder,
|
|
38
|
+
stepDefinitionsFolder
|
|
39
|
+
});
|
|
40
|
+
const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
41
|
+
trace,
|
|
42
|
+
video,
|
|
43
|
+
viewport,
|
|
44
|
+
testIdAttribute
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Playwright configuration object
|
|
49
|
+
*
|
|
50
|
+
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
51
|
+
*/
|
|
34
52
|
function getPlaywrightConfig() {
|
|
35
53
|
return {
|
|
36
54
|
testDir,
|
|
@@ -42,21 +60,12 @@ function getPlaywrightConfig() {
|
|
|
42
60
|
reporter: [['html', {
|
|
43
61
|
outputFolder: reportPath,
|
|
44
62
|
open: openReportOn
|
|
45
|
-
}]],
|
|
63
|
+
}], ['list'], ['./src/reporter.js']],
|
|
46
64
|
timeout: testTimeout,
|
|
47
65
|
expect: {
|
|
48
66
|
timeout: expectTimeout
|
|
49
67
|
},
|
|
50
|
-
use:
|
|
51
|
-
viewport,
|
|
52
|
-
trace: trace ? 'on' : 'off',
|
|
53
|
-
video: video ? {
|
|
54
|
-
mode: 'on',
|
|
55
|
-
size: {
|
|
56
|
-
...viewport
|
|
57
|
-
}
|
|
58
|
-
} : 'off'
|
|
59
|
-
},
|
|
68
|
+
use: testOptions,
|
|
60
69
|
projects: isAuthMode ? [{
|
|
61
70
|
name: 'setup',
|
|
62
71
|
testMatch: /.*\.setup\.js/,
|
|
@@ -6,10 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getProjects = getProjects;
|
|
8
8
|
exports.getTestDir = getTestDir;
|
|
9
|
+
exports.getTestUseOptions = getTestUseOptions;
|
|
9
10
|
var _test = require("@playwright/test");
|
|
10
11
|
var _path = _interopRequireDefault(require("path"));
|
|
11
12
|
var _readConfigFile = require("../readConfigFile");
|
|
12
13
|
var _bddFramework = require("../../../bdd-framework");
|
|
14
|
+
/**
|
|
15
|
+
** Playwright project configuration
|
|
16
|
+
* @returns {import('@playwright/test').Project}
|
|
17
|
+
*/
|
|
13
18
|
function getBrowserConfig({
|
|
14
19
|
browserName,
|
|
15
20
|
isAuthMode,
|
|
@@ -81,6 +86,12 @@ function getBrowserConfig({
|
|
|
81
86
|
return false;
|
|
82
87
|
}
|
|
83
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @param {*} param0
|
|
93
|
+
* @returns {import('@playwright/test').Project[]}
|
|
94
|
+
*/
|
|
84
95
|
function getProjects({
|
|
85
96
|
browsers,
|
|
86
97
|
isAuthMode,
|
|
@@ -98,12 +109,33 @@ function getProjects({
|
|
|
98
109
|
viewport
|
|
99
110
|
})).filter(Boolean);
|
|
100
111
|
}
|
|
101
|
-
function getTestDir(bddMode, cwd
|
|
112
|
+
function getTestDir(bddMode, cwd, {
|
|
113
|
+
stepDefinitionsFolder
|
|
114
|
+
}) {
|
|
102
115
|
return bddMode ? (0, _bddFramework.defineBddConfig)({
|
|
103
116
|
paths: [_path.default.join(cwd, 'uat', '**', '*.feature')],
|
|
104
|
-
import: [_path.default.join(cwd, 'uat', '**',
|
|
117
|
+
import: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
|
|
105
118
|
featuresRoot: _path.default.join(cwd, 'uat'),
|
|
106
119
|
outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
|
|
107
120
|
publish: true
|
|
108
121
|
}) : _path.default.join(cwd, 'uat');
|
|
122
|
+
}
|
|
123
|
+
function getTestUseOptions({
|
|
124
|
+
viewport,
|
|
125
|
+
trace,
|
|
126
|
+
video,
|
|
127
|
+
testIdAttribute
|
|
128
|
+
}) {
|
|
129
|
+
let defaultTestuseOptions = {
|
|
130
|
+
viewport,
|
|
131
|
+
testIdAttribute,
|
|
132
|
+
trace: trace ? 'on' : 'off',
|
|
133
|
+
video: video ? {
|
|
134
|
+
mode: 'on',
|
|
135
|
+
size: {
|
|
136
|
+
...viewport
|
|
137
|
+
}
|
|
138
|
+
} : 'off'
|
|
139
|
+
};
|
|
140
|
+
return defaultTestuseOptions;
|
|
109
141
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _fileUtils = require("../../../utils/fileUtils");
|
|
10
|
+
var _readConfigFile = require("../readConfigFile");
|
|
11
|
+
class JSONSummaryReporter {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.durationInMS = -1;
|
|
14
|
+
this.passed = [];
|
|
15
|
+
this.skipped = [];
|
|
16
|
+
this.failed = [];
|
|
17
|
+
this.warned = [];
|
|
18
|
+
this.interrupted = [];
|
|
19
|
+
this.timedOut = [];
|
|
20
|
+
this.flakey = [];
|
|
21
|
+
this.status = 'unknown';
|
|
22
|
+
this.startedAt = 0;
|
|
23
|
+
}
|
|
24
|
+
onBegin() {
|
|
25
|
+
this.startedAt = Date.now();
|
|
26
|
+
}
|
|
27
|
+
onTestEnd(test, result) {
|
|
28
|
+
const title = [];
|
|
29
|
+
const fileName = [];
|
|
30
|
+
let clean = true;
|
|
31
|
+
for (const s of test.titlePath()) {
|
|
32
|
+
if (s === '' && clean) continue;
|
|
33
|
+
clean = false;
|
|
34
|
+
title.push(s);
|
|
35
|
+
if (s.includes('.ts') || s.includes('.js')) {
|
|
36
|
+
fileName.push(s);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// This will publish the file name + line number test begins on
|
|
40
|
+
const z = `${fileName[0]}:${test.location.line}:${test.location.column}`;
|
|
41
|
+
// Using the t variable in the push will push a full test name + test description
|
|
42
|
+
const t = title.join(' > ');
|
|
43
|
+
// Set the status
|
|
44
|
+
const status = !['passed', 'skipped'].includes(result.status) && t.includes('@warn') ? 'warned' : result.status;
|
|
45
|
+
// Logic to push the results into the correct array
|
|
46
|
+
if (result.status === 'passed' && result.retry >= 1) {
|
|
47
|
+
this.flakey.push(z);
|
|
48
|
+
} else {
|
|
49
|
+
this[status].push(z);
|
|
50
|
+
}
|
|
51
|
+
this[status].push(z);
|
|
52
|
+
}
|
|
53
|
+
onEnd(result) {
|
|
54
|
+
this.durationInMS = Date.now() - this.startedAt;
|
|
55
|
+
this.status = result.status;
|
|
56
|
+
// removing duplicate tests from passed array
|
|
57
|
+
this.passed = this.passed.filter((element, index) => {
|
|
58
|
+
return this.passed.indexOf(element) === index;
|
|
59
|
+
});
|
|
60
|
+
// removing duplicate tests from the failed array
|
|
61
|
+
this.failed = this.failed.filter((element, index) => {
|
|
62
|
+
if (!this.passed.includes(element)) return this.failed.indexOf(element) === index;
|
|
63
|
+
});
|
|
64
|
+
// removing duplicate tests from the skipped array
|
|
65
|
+
this.skipped = this.skipped.filter((element, index) => {
|
|
66
|
+
return this.skipped.indexOf(element) === index;
|
|
67
|
+
});
|
|
68
|
+
// removing duplicate tests from the timedOut array
|
|
69
|
+
this.timedOut = this.timedOut.filter((element, index) => {
|
|
70
|
+
return this.timedOut.indexOf(element) === index;
|
|
71
|
+
});
|
|
72
|
+
// removing duplicate tests from the interrupted array
|
|
73
|
+
this.interrupted = this.interrupted.filter((element, index) => {
|
|
74
|
+
return this.interrupted.indexOf(element) === index;
|
|
75
|
+
});
|
|
76
|
+
// fs.writeFileSync('./summary.json', JSON.stringify(this, null, ' '));
|
|
77
|
+
let {
|
|
78
|
+
reportPath
|
|
79
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
80
|
+
(0, _fileUtils.writeFileContents)(_path.default.join(reportPath, './', 'test-summary.json'), JSON.stringify(this, null, ' '));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
var _default = JSONSummaryReporter;
|
|
84
|
+
exports.default = _default;
|
package/build/lib/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ var _codegen = _interopRequireDefault(require("../core/playwright/codegen"));
|
|
|
7
7
|
var _logger = require("../utils/logger");
|
|
8
8
|
var _setupProject = _interopRequireDefault(require("../setup-folder-structure/setupProject"));
|
|
9
9
|
var _parser = require("../parser/parser");
|
|
10
|
+
var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-caches"));
|
|
10
11
|
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
11
12
|
|
|
12
13
|
const [,, option, ...otherOptions] = process.argv;
|
|
@@ -46,6 +47,12 @@ switch (option) {
|
|
|
46
47
|
(0, _parser.generateSpecCodeForFeatureFile)(otherOptions);
|
|
47
48
|
break;
|
|
48
49
|
}
|
|
50
|
+
case 'clearCaches':
|
|
51
|
+
{
|
|
52
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Clearing caches...');
|
|
53
|
+
(0, _clearCaches.default)();
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
49
56
|
default:
|
|
50
57
|
{
|
|
51
58
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Supported Commands test and report');
|
|
@@ -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
|
/**
|
|
@@ -36,7 +37,8 @@ module.exports = {
|
|
|
36
37
|
authFilePath: 'uat/playwright/.auth/user.json',
|
|
37
38
|
trace: true,
|
|
38
39
|
video: true,
|
|
40
|
+
bddMode: true,
|
|
39
41
|
featureFilesFolder: 'feature-files',
|
|
40
42
|
stepDefinitionsFolder: 'steps',
|
|
41
|
-
viewport:
|
|
43
|
+
viewport: { width: 1280, height: 720 }
|
|
42
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(() => {
|
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/changelog.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
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
|
+
|
|
10
|
+
# 0.1.3
|
|
11
|
+
|
|
12
|
+
- uat config sample file updated with `bddMode` and `viewport` values
|
|
13
|
+
- user configuration issue fix when the value is undefined
|
|
14
|
+
|
|
5
15
|
# 0.1.2
|
|
6
16
|
|
|
7
17
|
- Bdd version updated to `5.4.0`
|
package/npm-shrinkwrap.json
CHANGED