@zohodesk/testinglibrary 0.0.41-n20-experimental → 0.0.43-n20-experimental
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/.gitlab-ci.yml +14 -11
- package/README.md +8 -3
- package/build/core/dataGenerator/DataGenerator.js +17 -12
- package/build/core/playwright/clear-caches.js +2 -5
- package/build/core/playwright/constants/configConstants.js +6 -3
- package/build/core/playwright/constants/reporterConstants.js +2 -7
- package/build/core/playwright/helpers/auth/index.js +1 -8
- package/build/core/playwright/readConfigFile.js +3 -5
- package/build/core/playwright/report-generator.js +42 -0
- package/build/core/playwright/setup/ProjectConfiguration.js +26 -9
- package/build/core/playwright/setup/config-creator.js +5 -8
- package/build/core/playwright/setup/config-utils.js +3 -7
- package/build/core/playwright/setup/qc-custom-reporter.js +1 -4
- package/build/core/playwright/test-runner.js +4 -0
- package/build/index.js +0 -6
- package/build/lib/cli.js +7 -30
- package/build/utils/commonUtils.js +1 -13
- package/npm-shrinkwrap.json +169 -106
- package/package.json +8 -9
- package/playwright.config.js +7 -10
- package/.vscode/mcp.json +0 -9
- package/build/core/playwright/reporter/PlaywrightReporter.js +0 -44
- package/build/core/playwright/reporter/UnitReporter.js +0 -27
package/.gitlab-ci.yml
CHANGED
|
@@ -55,7 +55,7 @@ uat-auth:
|
|
|
55
55
|
artifacts:
|
|
56
56
|
when: always
|
|
57
57
|
paths:
|
|
58
|
-
- examples/
|
|
58
|
+
- examples/uat/playwright-report
|
|
59
59
|
|
|
60
60
|
uat-noauth:
|
|
61
61
|
stage: uat
|
|
@@ -69,7 +69,7 @@ uat-noauth:
|
|
|
69
69
|
artifacts:
|
|
70
70
|
when: always
|
|
71
71
|
paths:
|
|
72
|
-
- examples/
|
|
72
|
+
- examples/uat/playwright-report
|
|
73
73
|
|
|
74
74
|
uat-profile:
|
|
75
75
|
stage: uat
|
|
@@ -83,7 +83,7 @@ uat-profile:
|
|
|
83
83
|
artifacts:
|
|
84
84
|
when: always
|
|
85
85
|
paths:
|
|
86
|
-
- examples/
|
|
86
|
+
- examples/uat/playwright-report
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
uat-unauth:
|
|
@@ -99,7 +99,7 @@ uat-unauth:
|
|
|
99
99
|
artifacts:
|
|
100
100
|
when: always
|
|
101
101
|
paths:
|
|
102
|
-
- examples/
|
|
102
|
+
- examples/uat/playwright-report
|
|
103
103
|
|
|
104
104
|
uat-nobdd:
|
|
105
105
|
stage: uat
|
|
@@ -114,7 +114,7 @@ uat-nobdd:
|
|
|
114
114
|
artifacts:
|
|
115
115
|
when: always
|
|
116
116
|
paths:
|
|
117
|
-
- nobdd/
|
|
117
|
+
- nobdd/uat/playwright-report
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
uatmodule:
|
|
@@ -130,7 +130,7 @@ uatmodule:
|
|
|
130
130
|
artifacts:
|
|
131
131
|
when: always
|
|
132
132
|
paths:
|
|
133
|
-
- examples/
|
|
133
|
+
- examples/uat/playwright-report
|
|
134
134
|
|
|
135
135
|
uatconfigmodule:
|
|
136
136
|
stage: uat
|
|
@@ -144,7 +144,7 @@ uatconfigmodule:
|
|
|
144
144
|
artifacts:
|
|
145
145
|
when: always
|
|
146
146
|
paths:
|
|
147
|
-
- examples/
|
|
147
|
+
- examples/uat/playwright-report
|
|
148
148
|
|
|
149
149
|
uat-smoketest:
|
|
150
150
|
stage: uat
|
|
@@ -158,7 +158,7 @@ uat-smoketest:
|
|
|
158
158
|
artifacts:
|
|
159
159
|
when: always
|
|
160
160
|
paths:
|
|
161
|
-
- examples/
|
|
161
|
+
- examples/uat/playwright-report
|
|
162
162
|
|
|
163
163
|
uat-multiactor:
|
|
164
164
|
stage: uat
|
|
@@ -172,7 +172,7 @@ uat-multiactor:
|
|
|
172
172
|
artifacts:
|
|
173
173
|
when: always
|
|
174
174
|
paths:
|
|
175
|
-
- examples/
|
|
175
|
+
- examples/uat/playwright-report
|
|
176
176
|
|
|
177
177
|
uat-data_generator:
|
|
178
178
|
stage: uat
|
|
@@ -186,7 +186,7 @@ uat-data_generator:
|
|
|
186
186
|
artifacts:
|
|
187
187
|
when: always
|
|
188
188
|
paths:
|
|
189
|
-
- examples/
|
|
189
|
+
- examples/uat/playwright-report
|
|
190
190
|
|
|
191
191
|
uat-search_indexing:
|
|
192
192
|
stage: uat
|
|
@@ -202,4 +202,7 @@ uat-search_indexing:
|
|
|
202
202
|
artifacts:
|
|
203
203
|
when: always
|
|
204
204
|
paths:
|
|
205
|
-
- examples/
|
|
205
|
+
- examples/uat/playwright-report
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
package/README.md
CHANGED
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
- npm run report
|
|
19
19
|
|
|
20
|
-
### v4.
|
|
20
|
+
### v4.0.7-data-generator-discovery - 22-03-2026
|
|
21
21
|
|
|
22
|
-
####
|
|
23
|
-
|
|
22
|
+
#### Enhancement
|
|
23
|
+
- DataGenerator now walks up the directory tree to discover data-generators folders
|
|
24
|
+
- Supports multiple JSON files in data-generators directory (no longer hardcoded to generators.json)
|
|
25
|
+
- Removed hardcoded folder name dependencies for flexible generator file placement
|
|
24
26
|
|
|
25
27
|
### v4.0.6/v3.2.21 - 22-01-2026
|
|
26
28
|
|
|
@@ -32,16 +34,19 @@
|
|
|
32
34
|
#### Bug fix
|
|
33
35
|
- @cucumber/cucumber depedency removed from testing-framework package.json
|
|
34
36
|
|
|
37
|
+
|
|
35
38
|
### v4.0.4/v3.2.20 - 19-12-2025
|
|
36
39
|
|
|
37
40
|
#### Enhancement
|
|
38
41
|
- New common step provided for search index with the data generated entity
|
|
39
42
|
|
|
43
|
+
|
|
40
44
|
### v4.0.3/v3.2.19 - 17-12-2025
|
|
41
45
|
|
|
42
46
|
#### Enhancement
|
|
43
47
|
- Cookie storage prefix support is provided in this version.
|
|
44
48
|
|
|
49
|
+
|
|
45
50
|
### v4.0.2 - 16-12-2025
|
|
46
51
|
|
|
47
52
|
#### Bug Fixes
|
|
@@ -49,20 +49,25 @@ class DataGenerator {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
async function _getGenerator(testInfo, generatorName) {
|
|
52
|
-
let
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
let featureFilePath = await (0, _DataGeneratorHelper.getGeneratorFilePath)(testInfo.file);
|
|
53
|
+
let searchDir = _path.default.dirname(featureFilePath);
|
|
54
|
+
const rootDir = _path.default.parse(searchDir).root;
|
|
55
|
+
while (searchDir !== rootDir) {
|
|
56
|
+
const dataGeneratorsDir = _path.default.join(searchDir, "data-generators");
|
|
57
|
+
if (_fs.default.existsSync(dataGeneratorsDir)) {
|
|
58
|
+
const jsonFiles = _fs.default.readdirSync(dataGeneratorsDir).filter(file => file.endsWith('.json'));
|
|
59
|
+
for (const file of jsonFiles) {
|
|
60
|
+
const filePath = _path.default.join(dataGeneratorsDir, file);
|
|
61
|
+
const data = _fs.default.readFileSync(filePath, 'utf8');
|
|
62
|
+
const generatorObj = JSON.parse(data);
|
|
63
|
+
if (generatorObj.generators && generatorObj.generators[generatorName]) {
|
|
64
|
+
return generatorObj.generators[generatorName];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
60
67
|
}
|
|
68
|
+
searchDir = _path.default.dirname(searchDir);
|
|
61
69
|
}
|
|
62
|
-
|
|
63
|
-
throw new _DataGeneratorError.GeneratorError(`Generator "${generatorName}" could not be found in the path located at "${generatorFilePath}"`);
|
|
64
|
-
}
|
|
65
|
-
return generator;
|
|
70
|
+
throw new _DataGeneratorError.GeneratorError(`Generator "${generatorName}" could not be found in any data-generators directory from "${_path.default.dirname(featureFilePath)}"`);
|
|
66
71
|
}
|
|
67
72
|
async function _generateAPIGenerator(operationId) {
|
|
68
73
|
return [{
|
|
@@ -10,9 +10,6 @@ var _fileUtils = require("../../utils/fileUtils");
|
|
|
10
10
|
var _logger = require("../../utils/logger");
|
|
11
11
|
var _readConfigFile = require("./readConfigFile");
|
|
12
12
|
var _checkAuthDirectory = require("./helpers/checkAuthDirectory");
|
|
13
|
-
var _configConstants = _interopRequireDefault(require("./constants/configConstants"));
|
|
14
|
-
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
15
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
16
13
|
function deleteAuthFiles(authFilePath) {
|
|
17
14
|
authFilePath = _path.default.resolve(process.cwd(), authFilePath);
|
|
18
15
|
const authFileFolder = _path.default.dirname(authFilePath);
|
|
@@ -24,7 +21,7 @@ function deletePlaywrightReport(reportPath) {
|
|
|
24
21
|
(0, _fileUtils.deleteFolder)(reportPath);
|
|
25
22
|
}
|
|
26
23
|
function deleteGeneratedFeatures() {
|
|
27
|
-
const featuresGenPath = _path.default.resolve(process.cwd(),
|
|
24
|
+
const featuresGenPath = _path.default.resolve(process.cwd(), 'uat', '.features-gen');
|
|
28
25
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting generated features at ${featuresGenPath}`);
|
|
29
26
|
(0, _fileUtils.deleteFolder)(featuresGenPath);
|
|
30
27
|
}
|
|
@@ -46,7 +43,7 @@ function clearCaches() {
|
|
|
46
43
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared. Now you can try running npm run uat');
|
|
47
44
|
} catch (err) {
|
|
48
45
|
_logger.Logger.error(err);
|
|
49
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE,
|
|
46
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error While clearing cookies. Try manually delete folder uat/playwright and uat/playwright-report');
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
var _default = exports.default = clearCaches;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
class configConstants {
|
|
4
8
|
static DEFAULT_CONFIG_DIR = 'default';
|
|
5
9
|
static BETA_DIR = 'beta';
|
|
@@ -8,7 +12,6 @@ class configConstants {
|
|
|
8
12
|
static INDEX_FILE = 'index.js';
|
|
9
13
|
static SETTINGS_FILE = 'settings.json';
|
|
10
14
|
static TEST_SUMMARY_FILE = 'test-summary.json';
|
|
11
|
-
static STAGE_CONFIG_MAP_FILE = '
|
|
12
|
-
static TEST_SLICE_FOLDER = 'test-slices';
|
|
15
|
+
static STAGE_CONFIG_MAP_FILE = 'uat/conf_path_map.properties';
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
exports.default = configConstants;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _configConstants = _interopRequireDefault(require("./configConstants"));
|
|
9
|
-
var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
|
|
10
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
11
7
|
class ReporterConstants {
|
|
12
|
-
static DEFAULT_REPORTER_PATH =
|
|
13
|
-
static LAST_RUN_REPORTER_PATH =
|
|
14
|
-
static DEFAULT_UNIT_TEST_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/unit-test/unit_reports/report.html`;
|
|
8
|
+
static DEFAULT_REPORTER_PATH = 'uat/test-results/playwright-test-results.json';
|
|
9
|
+
static LAST_RUN_REPORTER_PATH = 'uat/test-results/.last-run.json';
|
|
15
10
|
}
|
|
16
11
|
exports.default = ReporterConstants;
|
|
@@ -34,12 +34,6 @@ Object.defineProperty(exports, "getRunMode", {
|
|
|
34
34
|
return _getUsers.getRunMode;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
Object.defineProperty(exports, "getRunStage", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _ConfigurationHelper.getRunStage;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
37
|
Object.defineProperty(exports, "getUserForSelectedEditionAndProfile", {
|
|
44
38
|
enumerable: true,
|
|
45
39
|
get: function () {
|
|
@@ -79,5 +73,4 @@ Object.defineProperty(exports, "verifyIfCookieFileExists", {
|
|
|
79
73
|
var _accountLogin = _interopRequireDefault(require("./accountLogin"));
|
|
80
74
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
81
75
|
var _getUsers = require("./getUsers");
|
|
82
|
-
var _loginSteps = _interopRequireDefault(require("./loginSteps"));
|
|
83
|
-
var _ConfigurationHelper = require("../../configuration/ConfigurationHelper");
|
|
76
|
+
var _loginSteps = _interopRequireDefault(require("./loginSteps"));
|
|
@@ -17,8 +17,6 @@ var _Configuration = _interopRequireDefault(require("./configuration/Configurati
|
|
|
17
17
|
var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
|
18
18
|
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
19
19
|
var _auth = require("./helpers/auth");
|
|
20
|
-
var _configConstants = _interopRequireDefault(require("./constants/configConstants"));
|
|
21
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
22
20
|
let cachedConfig = null;
|
|
23
21
|
function getPrimaryCookiePath() {
|
|
24
22
|
const {
|
|
@@ -26,12 +24,12 @@ function getPrimaryCookiePath() {
|
|
|
26
24
|
} = (0, _auth.getDefaultActor)();
|
|
27
25
|
const authFilePrefix = process.env.authFilePrefix;
|
|
28
26
|
let authFileName = authFilePrefix ? `${authFilePrefix}-${email}` : `${email}`;
|
|
29
|
-
return
|
|
27
|
+
return `uat/playwright/.auth/${authFileName}-cookies.json`;
|
|
30
28
|
}
|
|
31
29
|
function getDefaultConfig() {
|
|
32
30
|
return {
|
|
33
31
|
isTearDown: true,
|
|
34
|
-
uatDirectory: _path.default.join(process.cwd(),
|
|
32
|
+
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
35
33
|
headless: false,
|
|
36
34
|
browsers: ['Chrome'],
|
|
37
35
|
forbidOnly: false,
|
|
@@ -40,7 +38,7 @@ function getDefaultConfig() {
|
|
|
40
38
|
video: false,
|
|
41
39
|
isAuthMode: false,
|
|
42
40
|
openReportOn: 'never',
|
|
43
|
-
reportPath: _path.default.join(process.cwd(),
|
|
41
|
+
reportPath: _path.default.join(process.cwd(), 'uat', 'playwright-report'),
|
|
44
42
|
bddMode: false,
|
|
45
43
|
expectTimeout: 5 * 1000,
|
|
46
44
|
testTimeout: 60 * 1000,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = generateReport;
|
|
8
|
+
var _child_process = require("child_process");
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _logger = require("../../utils/logger");
|
|
11
|
+
var _rootPath = require("../../utils/rootPath");
|
|
12
|
+
var _readConfigFile = require("./readConfigFile");
|
|
13
|
+
async function generateReport() {
|
|
14
|
+
// await preProcessReport()
|
|
15
|
+
const userArgs = process.argv.slice(3);
|
|
16
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
17
|
+
const command = playwrightPath;
|
|
18
|
+
const {
|
|
19
|
+
reportPath: htmlPath
|
|
20
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
21
|
+
const args = ['show-report', htmlPath].concat(userArgs);
|
|
22
|
+
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
23
|
+
stdio: 'inherit'
|
|
24
|
+
});
|
|
25
|
+
childProcess.on('error', error => {
|
|
26
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
|
|
27
|
+
});
|
|
28
|
+
childProcess.on('exit', (code, signal) => {
|
|
29
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Child Process Exited with Code ${code} and Signal ${signal}`);
|
|
30
|
+
process.exit();
|
|
31
|
+
});
|
|
32
|
+
process.on('exit', () => {
|
|
33
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Terminating Playwright Process...');
|
|
34
|
+
childProcess.kill();
|
|
35
|
+
return;
|
|
36
|
+
});
|
|
37
|
+
process.on('SIGINT', () => {
|
|
38
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Cleaning up...');
|
|
39
|
+
childProcess.kill();
|
|
40
|
+
process.exit();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -11,9 +11,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
var _Project = require("./Project");
|
|
12
12
|
var _configUtils = require("./config-utils");
|
|
13
13
|
var _readConfigFile = require("../readConfigFile");
|
|
14
|
-
var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
|
|
15
|
-
var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
|
|
16
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
17
14
|
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
18
15
|
const {
|
|
19
16
|
isAuthMode,
|
|
@@ -28,7 +25,7 @@ const {
|
|
|
28
25
|
function setupConfig() {
|
|
29
26
|
const setupProject = new _Project.Project('setup');
|
|
30
27
|
setupProject.setTestMatch(/.*\.setup\.js/);
|
|
31
|
-
setupProject.setTestDir(_path.default.join(process.cwd(),
|
|
28
|
+
setupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
32
29
|
const isTearDown = JSON.parse(process.env.tearDown);
|
|
33
30
|
setupProject.setTearDown(isTearDown ? 'cleanup' : '');
|
|
34
31
|
const setupProjectConfig = [setupProject.getProperties()];
|
|
@@ -37,10 +34,10 @@ function setupConfig() {
|
|
|
37
34
|
function smokeTestConfig() {
|
|
38
35
|
const smokeTestProject = new _Project.Project('smokeTest');
|
|
39
36
|
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
40
|
-
featureFilesFolder: _path.default.join(process.cwd(),
|
|
41
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(),
|
|
42
|
-
outputDir: _path.default.join(process.cwd(),
|
|
43
|
-
uatPath: _path.default.join(process.cwd(),
|
|
37
|
+
featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
|
|
38
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
39
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
|
|
40
|
+
uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
|
|
44
41
|
});
|
|
45
42
|
const commonConfig = {
|
|
46
43
|
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
@@ -54,10 +51,30 @@ function smokeTestConfig() {
|
|
|
54
51
|
const smokeTestProjectConfig = [smokeTestProject.getProperties()];
|
|
55
52
|
return smokeTestProjectConfig;
|
|
56
53
|
}
|
|
54
|
+
function defaultConfig() {
|
|
55
|
+
const defaultProject = new _Project.Project('default');
|
|
56
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
57
|
+
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
58
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
59
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
60
|
+
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
61
|
+
});
|
|
62
|
+
const use = {
|
|
63
|
+
trace,
|
|
64
|
+
video,
|
|
65
|
+
viewport,
|
|
66
|
+
testIdAttribute
|
|
67
|
+
};
|
|
68
|
+
defaultProject.setUse(use);
|
|
69
|
+
defaultProject.setTestDir(testDir);
|
|
70
|
+
defaultProject.setDependencies(isSmokeTest ? ['smokeTest'] : []);
|
|
71
|
+
const defaultProjectConfig = [defaultProject.getProperties()];
|
|
72
|
+
return defaultProjectConfig;
|
|
73
|
+
}
|
|
57
74
|
function cleanupConfig() {
|
|
58
75
|
const cleanupProject = new _Project.Project('cleanup');
|
|
59
76
|
cleanupProject.setTestMatch(/.*\.teardown\.js/);
|
|
60
|
-
cleanupProject.setTestDir(_path.default.join(process.cwd(),
|
|
77
|
+
cleanupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
61
78
|
const cleanupProjectConfig = [cleanupProject.getProperties()];
|
|
62
79
|
return cleanupProjectConfig;
|
|
63
80
|
}
|
|
@@ -10,10 +10,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _readConfigFile = require("../readConfigFile");
|
|
11
11
|
var _configUtils = require("./config-utils");
|
|
12
12
|
var _ProjectConfiguration = require("./ProjectConfiguration");
|
|
13
|
-
var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
|
|
14
|
-
var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
|
|
15
13
|
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
16
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
17
14
|
const {
|
|
18
15
|
bddMode,
|
|
19
16
|
browsers,
|
|
@@ -44,7 +41,7 @@ let reporter = [['html', {
|
|
|
44
41
|
outputFolder: reportPath,
|
|
45
42
|
open: openReportOn
|
|
46
43
|
}], ['list'], ['json', {
|
|
47
|
-
outputFile: _path.default.join(process.cwd(),
|
|
44
|
+
outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'playwright-test-results.json')
|
|
48
45
|
}], ['./custom-reporter.js'], ['./qc-custom-reporter.js']];
|
|
49
46
|
if (customReporter) {
|
|
50
47
|
reporter = [customReporter, ...reporter];
|
|
@@ -64,9 +61,9 @@ const use = {
|
|
|
64
61
|
};
|
|
65
62
|
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
66
63
|
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
67
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(),
|
|
68
|
-
outputDir: _path.default.join(process.cwd(),
|
|
69
|
-
uatPath: _path.default.join(process.cwd(),
|
|
64
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
65
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
66
|
+
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
70
67
|
});
|
|
71
68
|
function getPlaywrightConfig() {
|
|
72
69
|
const smokeTestProject = isSmokeTest ? (0, _ProjectConfiguration.smokeTestConfig)() : [];
|
|
@@ -76,7 +73,7 @@ function getPlaywrightConfig() {
|
|
|
76
73
|
const playwrightConfig = {
|
|
77
74
|
testDir,
|
|
78
75
|
globalTimeout: globalTimeout || 3600000,
|
|
79
|
-
outputDir: _path.default.join(process.cwd(),
|
|
76
|
+
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
80
77
|
fullyParallel: true,
|
|
81
78
|
reporter,
|
|
82
79
|
timeout: testTimeout,
|
|
@@ -16,14 +16,11 @@ var _playwrightBdd = require("playwright-bdd");
|
|
|
16
16
|
var _logger = require("../../../utils/logger");
|
|
17
17
|
var _browserTypes = require("../constants/browserTypes");
|
|
18
18
|
var _fileUtils = require("../../../utils/fileUtils");
|
|
19
|
-
var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
|
|
20
|
-
var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
|
|
21
19
|
/**
|
|
22
20
|
** Playwright project configuration
|
|
23
21
|
* @returns {import('@playwright/test').Project}
|
|
24
22
|
*/
|
|
25
23
|
|
|
26
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
27
24
|
function getBrowserConfig({
|
|
28
25
|
browserName,
|
|
29
26
|
isAuthMode,
|
|
@@ -145,8 +142,7 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
145
142
|
const {
|
|
146
143
|
failed = []
|
|
147
144
|
} = JSON.parse(testSummary);
|
|
148
|
-
const casesToRun = failed.map(filePath => _path.default.join(cwd,
|
|
149
|
-
;
|
|
145
|
+
const casesToRun = failed.map(filePath => _path.default.join(cwd, 'uat', filePath.replace(/\.spec\.js$|\.js$/, '')));
|
|
150
146
|
return casesToRun;
|
|
151
147
|
} else {
|
|
152
148
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Unable to read test summary from the ${reportPath}. Verify If File Exists in the path`);
|
|
@@ -157,12 +153,12 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
157
153
|
let moduleList = modules.split(',');
|
|
158
154
|
return getModulePathForFeatureFiles(moduleList);
|
|
159
155
|
}
|
|
160
|
-
return [_path.default.join(cwd,
|
|
156
|
+
return [_path.default.join(cwd, 'uat', 'modules', '**', '*.feature')];
|
|
161
157
|
}
|
|
162
158
|
function getModulePathForFeatureFiles(moduleList) {
|
|
163
159
|
let validModuleList = [];
|
|
164
160
|
moduleList.forEach(moduleName => {
|
|
165
|
-
let modulePath = _path.default.join(process.cwd(),
|
|
161
|
+
let modulePath = _path.default.join(process.cwd(), 'uat', 'modules', '**', `${moduleName}`);
|
|
166
162
|
if ((0, _fileUtils.checkIfFolderExistsWithPattern)(modulePath)) {
|
|
167
163
|
validModuleList.push(_path.default.join(modulePath, '**', '*.feature'));
|
|
168
164
|
} else {
|
|
@@ -8,14 +8,11 @@ exports.default = void 0;
|
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var _codeFrame = require("@babel/code-frame");
|
|
11
|
-
var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
|
|
12
|
-
var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
|
|
13
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
14
11
|
class CustomJsonReporter {
|
|
15
12
|
constructor({
|
|
16
13
|
outputFile = 'test-results.json'
|
|
17
14
|
} = {}) {
|
|
18
|
-
this.outputFile = _path.default.resolve(process.cwd(),
|
|
15
|
+
this.outputFile = _path.default.resolve(process.cwd(), 'uat/test-results/', outputFile);
|
|
19
16
|
this.rootSuite = null;
|
|
20
17
|
this.report = {
|
|
21
18
|
config: {},
|
|
@@ -8,11 +8,15 @@ exports.default = void 0;
|
|
|
8
8
|
exports.runPreprocessing = runPreprocessing;
|
|
9
9
|
var _child_process = require("child_process");
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _customCommands = require("./custom-commands");
|
|
12
|
+
var _cliArgsToObject = require("../../utils/cliArgsToObject");
|
|
11
13
|
var _envInitializer = require("./env-initializer");
|
|
12
14
|
var _logger = require("../../utils/logger");
|
|
13
15
|
var _readConfigFile = require("./readConfigFile");
|
|
14
16
|
var _rootPath = require("../../utils/rootPath");
|
|
15
17
|
var _tagProcessor = _interopRequireDefault(require("./tagProcessor"));
|
|
18
|
+
var _configUtils = require("./setup/config-utils");
|
|
19
|
+
var _browserTypes = require("./constants/browserTypes");
|
|
16
20
|
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
17
21
|
var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
|
|
18
22
|
var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
package/build/index.js
CHANGED
|
@@ -40,12 +40,6 @@ Object.defineProperty(exports, "getRunMode", {
|
|
|
40
40
|
return _index.getRunMode;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
Object.defineProperty(exports, "getRunStage", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _index.getRunStage;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
43
|
Object.defineProperty(exports, "getUserForSelectedEditionAndProfile", {
|
|
50
44
|
enumerable: true,
|
|
51
45
|
get: function () {
|
package/build/lib/cli.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _testRunner = _interopRequireDefault(require("../core/playwright/test-runner"));
|
|
5
|
-
var
|
|
6
|
-
var _PlaywrightReporter = _interopRequireDefault(require("../core/playwright/reporter/PlaywrightReporter"));
|
|
7
|
-
var _UnitReporter = _interopRequireDefault(require("../core/playwright/reporter/UnitReporter"));
|
|
5
|
+
var _reportGenerator = _interopRequireDefault(require("../core/playwright/report-generator"));
|
|
8
6
|
var _codegen = _interopRequireDefault(require("../core/playwright/codegen"));
|
|
9
7
|
var _logger = require("../utils/logger");
|
|
10
8
|
var _setupProject = _interopRequireDefault(require("../setup-folder-structure/setupProject"));
|
|
@@ -13,25 +11,15 @@ var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-cach
|
|
|
13
11
|
var _helper = _interopRequireDefault(require("../setup-folder-structure/helper"));
|
|
14
12
|
var _parseUserArgs = _interopRequireDefault(require("../core/playwright/helpers/parseUserArgs"));
|
|
15
13
|
var _validateFeature = _interopRequireDefault(require("../core/playwright/validateFeature"));
|
|
16
|
-
|
|
14
|
+
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
15
|
+
|
|
17
16
|
const [,, option, ...otherOptions] = process.argv;
|
|
18
17
|
switch (option) {
|
|
19
18
|
case 'test':
|
|
20
19
|
{
|
|
21
20
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Tests..');
|
|
22
21
|
(0, _testRunner.default)();
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
case 'unit-test':
|
|
26
|
-
{
|
|
27
|
-
const testFile = process.argv[3];
|
|
28
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Unit Tests..');
|
|
29
|
-
const options = {};
|
|
30
|
-
if (testFile) {
|
|
31
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Filtering tests with pattern: ${testFile}`);
|
|
32
|
-
options.testPathPattern = testFile;
|
|
33
|
-
}
|
|
34
|
-
(0, _unitTestingFramework.createJestRunner)(options);
|
|
22
|
+
//createJestRunner();
|
|
35
23
|
break;
|
|
36
24
|
}
|
|
37
25
|
case 'validate':
|
|
@@ -52,14 +40,9 @@ switch (option) {
|
|
|
52
40
|
}
|
|
53
41
|
case 'report':
|
|
54
42
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
case 'ut-report':
|
|
60
|
-
{
|
|
61
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Generating Unit Test Reports...');
|
|
62
|
-
_UnitReporter.default.generate();
|
|
43
|
+
// console.log('\x1b[36mGenerating Reports...\x1b[0m');
|
|
44
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Generating Reports...');
|
|
45
|
+
(0, _reportGenerator.default)();
|
|
63
46
|
break;
|
|
64
47
|
}
|
|
65
48
|
case 'codegen':
|
|
@@ -86,12 +69,6 @@ switch (option) {
|
|
|
86
69
|
(0, _clearCaches.default)();
|
|
87
70
|
break;
|
|
88
71
|
}
|
|
89
|
-
case 'stepsGenerator':
|
|
90
|
-
{
|
|
91
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Created agents and prompts md files under .github folder...');
|
|
92
|
-
(0, _commonUtils.copyGithubFolder)();
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
72
|
case 'help':
|
|
96
73
|
default:
|
|
97
74
|
{
|
|
@@ -5,25 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.copyCommonSpecs = copyCommonSpecs;
|
|
8
|
-
exports.copyGithubFolder = copyGithubFolder;
|
|
9
8
|
var _fileUtils = require("./fileUtils");
|
|
10
9
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
var _configConstants = _interopRequireDefault(require("../core/playwright/constants/configConstants"));
|
|
12
|
-
var _ConfigurationHelper = require("../core/playwright/configuration/ConfigurationHelper");
|
|
13
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
14
10
|
function copyCommonSpecs() {
|
|
15
11
|
const libraryPath = require.resolve("@zohodesk/testinglibrary");
|
|
16
12
|
// libraryPath will be build/index.js to go to the common specs we need to go one level up
|
|
17
13
|
const commonSpecPath = _path.default.resolve(libraryPath, '../', 'common');
|
|
18
|
-
const destDirectory = _path.default.resolve(process.cwd(),
|
|
14
|
+
const destDirectory = _path.default.resolve(process.cwd(), 'uat', 'modules', '.testingLib-common');
|
|
19
15
|
(0, _fileUtils.deleteFolder)(destDirectory);
|
|
20
16
|
(0, _fileUtils.copyDirectory)(commonSpecPath, destDirectory);
|
|
21
|
-
}
|
|
22
|
-
function copyGithubFolder() {
|
|
23
|
-
const libraryPath = require.resolve("@zohodesk/testinglibrary");
|
|
24
|
-
// libraryPath will be build/index.js, go two levels up to reach the package root where .github lives
|
|
25
|
-
const githubSrcPath = _path.default.resolve(libraryPath, '../../', '.github');
|
|
26
|
-
const destDirectory = _path.default.resolve(process.cwd(), '../../', '.github');
|
|
27
|
-
(0, _fileUtils.deleteFolder)(destDirectory);
|
|
28
|
-
(0, _fileUtils.copyDirectory)(githubSrcPath, destDirectory);
|
|
29
17
|
}
|