@zohodesk/testinglibrary 0.4.97-n18-experimental → 0.4.98-n18-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/README.md +14 -4
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +1 -3
- package/build/core/dataGenerator/DataGenerator.js +9 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +7 -5
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/env-initializer.js +9 -4
- package/build/core/playwright/helpers/auth/getUsers.js +14 -16
- package/build/core/playwright/helpers/configFileNameProvider.js +13 -7
- package/build/core/playwright/helpers/resolvePropertiesFile.js +29 -0
- package/build/core/playwright/helpers/resolveStageConfigPath.js +18 -0
- package/build/core/playwright/readConfigFile.js +4 -2
- package/build/core/playwright/setup/Project.js +35 -0
- package/build/core/playwright/setup/ProjectConfiguration.js +80 -0
- package/build/core/playwright/setup/config-creator.js +23 -51
- package/build/core/playwright/test-runner.js +6 -2
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +54 -13
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +29 -26
- package/build/test/core/playwright/helpers/__tests__/resolvePropertiesFile.test.js +58 -0
- package/build/test/core/playwright/helpers/__tests__/resolveStageConfigPath.test.js +44 -0
- package/npm-shrinkwrap.json +471 -368
- package/package.json +5 -3
- package/test-results/.last-run.json +4 -0
- package/unit_reports/unit-report.html +1 -1
- package/build/test/Test.js +0 -13
package/README.md
CHANGED
|
@@ -17,13 +17,22 @@
|
|
|
17
17
|
|
|
18
18
|
- npm run report
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### v3.2.13 - 30-10-2025
|
|
21
|
+
|
|
22
|
+
#### Enhancement
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
- A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
|
|
23
25
|
|
|
24
|
-
###
|
|
26
|
+
### Issue fix
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
- Custom teardown comment provided
|
|
29
|
+
|
|
30
|
+
### v3.2.11 - 13-10-2025
|
|
31
|
+
|
|
32
|
+
### Feature
|
|
33
|
+
|
|
34
|
+
- New step a search entity using {string} provided for search indexing, This step will use run time data generation response as input for the indexing
|
|
35
|
+
|
|
27
36
|
|
|
28
37
|
### v3.2.9 - 26-09-2025
|
|
29
38
|
|
|
@@ -32,6 +41,7 @@
|
|
|
32
41
|
- Authentication deatils for data generation can be configured in org level
|
|
33
42
|
- reference link : https://learn.zoho.in/portal/zohocorp/knowledge/manual/client-uat/article/data-generation#_Tocpd3n7yt9ngeg
|
|
34
43
|
|
|
44
|
+
|
|
35
45
|
### v3.2.8 - 18-09-2025
|
|
36
46
|
|
|
37
47
|
### Bug fix
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { test } from '@zohodesk/testinglibrary';
|
|
2
2
|
import DataGenerator from '@zohodesk/testinglibrary/DataGenerator';
|
|
3
|
-
import {getUserForSelectedEditionAndProfile} from '@zohodesk/testinglibrary/helpers'
|
|
4
3
|
|
|
5
4
|
const dataGenerator = new DataGenerator();
|
|
6
5
|
|
|
@@ -10,8 +9,7 @@ export async function generateAndCacheTestData(executionContext, type, identifie
|
|
|
10
9
|
const scenarioName = testInfo.title.split('/').pop() || 'Unknown Scenario';
|
|
11
10
|
|
|
12
11
|
if (profile) {
|
|
13
|
-
|
|
14
|
-
actorInfo = await getUserForSelectedEditionAndProfile(edition, profile, beta, portal);
|
|
12
|
+
actorInfo = await dataGenerator.getDataGenUserExecutionContext(executionContext.actorInfo.edition, profile);
|
|
15
13
|
} else {
|
|
16
14
|
actorInfo = executionContext.actorInfo;
|
|
17
15
|
}
|
|
@@ -47,6 +47,15 @@ class DataGenerator {
|
|
|
47
47
|
throw error;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
async getDataGenUserExecutionContext(edition, profile) {
|
|
51
|
+
try {
|
|
52
|
+
const dataGenUserDetails = await (0, _helpers.getUserForSelectedEditionAndProfile)(edition, profile);
|
|
53
|
+
return dataGenUserDetails;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('Error occurred while fetching data generation user details: ', error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
async function _getGenerator(testInfo, generatorName) {
|
|
52
61
|
let generator = null;
|
|
@@ -1,17 +1,15 @@
|
|
|
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.combineConfiguration = combineConfiguration;
|
|
8
7
|
exports.getApplicationConfig = getApplicationConfig;
|
|
9
|
-
|
|
8
|
+
exports.getRunStage = getRunStage;
|
|
10
9
|
var _logger = require("../../../utils/logger");
|
|
11
10
|
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
12
11
|
var _mergeObjects = require("../helpers/mergeObjects");
|
|
13
12
|
var _fs = require("fs");
|
|
14
|
-
const Configuration = require("./Configuration");
|
|
15
13
|
function combineConfiguration(defaultConfig, userConfiguration) {
|
|
16
14
|
let configurationObj = {};
|
|
17
15
|
Object.keys(userConfiguration).forEach(configKey => {
|
|
@@ -26,10 +24,10 @@ function combineConfiguration(defaultConfig, userConfiguration) {
|
|
|
26
24
|
});
|
|
27
25
|
return (0, _mergeObjects.mergeObjects)(defaultConfig, configurationObj);
|
|
28
26
|
}
|
|
29
|
-
function getApplicationConfig(mode) {
|
|
27
|
+
function getApplicationConfig(stage, mode) {
|
|
30
28
|
let filePath = "";
|
|
31
29
|
try {
|
|
32
|
-
filePath =
|
|
30
|
+
filePath = (0, _configFileNameProvider.getUATFileName)(stage, mode);
|
|
33
31
|
if (!(0, _fs.existsSync)(filePath)) {
|
|
34
32
|
throw new Error("Exception while getting the uat file from the application - " + filePath);
|
|
35
33
|
}
|
|
@@ -40,4 +38,8 @@ function getApplicationConfig(mode) {
|
|
|
40
38
|
_logger.Logger.error(err);
|
|
41
39
|
return {};
|
|
42
40
|
}
|
|
41
|
+
}
|
|
42
|
+
function getRunStage() {
|
|
43
|
+
const stage = process.env.stage;
|
|
44
|
+
return stage || 'uat';
|
|
43
45
|
}
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CUSTOM_COMMANDS = void 0;
|
|
7
|
-
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules'];
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['stage', 'mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules', 'isTearDown'];
|
|
@@ -17,19 +17,24 @@ function setEnvironmentVariables(configJSON) {
|
|
|
17
17
|
}
|
|
18
18
|
function addHelperLogsForEnvInitialization() {
|
|
19
19
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Mode under which test cases should run has not been specified in args.`);
|
|
20
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Please specify --mode='dev/
|
|
20
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Please specify --mode='dev/ci/cd/devautomation' while running ZDTestingFramework test`);
|
|
21
21
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Going to use default mode as dev`);
|
|
22
22
|
}
|
|
23
|
-
function initializeEnvConfig(mode, isAuthMode) {
|
|
23
|
+
function initializeEnvConfig(stage, mode, isAuthMode) {
|
|
24
24
|
try {
|
|
25
25
|
if (!mode) {
|
|
26
26
|
addHelperLogsForEnvInitialization();
|
|
27
27
|
mode = 'dev';
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
if (!stage) {
|
|
30
|
+
stage = 'uat';
|
|
31
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `No stage specified. Using default stage as 'uat'`);
|
|
32
|
+
}
|
|
33
|
+
const configFile = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)(stage, mode)}`));
|
|
30
34
|
const configJSON = JSON.parse(configFile);
|
|
31
35
|
setEnvironmentVariables({
|
|
32
36
|
...configJSON,
|
|
37
|
+
stage,
|
|
33
38
|
mode
|
|
34
39
|
});
|
|
35
40
|
if (isAuthMode) {
|
|
@@ -38,6 +43,6 @@ function initializeEnvConfig(mode, isAuthMode) {
|
|
|
38
43
|
}
|
|
39
44
|
} catch (err) {
|
|
40
45
|
_logger.Logger.error(err);
|
|
41
|
-
throw new Error(`Config File Not Exists. Please provide a config file
|
|
46
|
+
throw new Error(`Config File Not Exists. Please provide a config file to initialize the environment variables`);
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -13,7 +13,8 @@ exports.isCI = isCI;
|
|
|
13
13
|
exports.isDevelopmentSetup = isDevelopmentSetup;
|
|
14
14
|
var _path = _interopRequireDefault(require("path"));
|
|
15
15
|
var _fs = require("fs");
|
|
16
|
-
var
|
|
16
|
+
var _resolveStageConfigPath = require("./../resolveStageConfigPath");
|
|
17
|
+
var _ConfigurationHelper = require("./../../configuration/ConfigurationHelper");
|
|
17
18
|
/* eslint-disable global-require */
|
|
18
19
|
function getRunMode() {
|
|
19
20
|
let {
|
|
@@ -30,19 +31,18 @@ function isDevelopmentSetup() {
|
|
|
30
31
|
return mode === 'DEV' || mode === 'dev';
|
|
31
32
|
}
|
|
32
33
|
function getDefaultActorConf() {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const filePath = _path.default.join(uatDirectory, modeSettingsFile);
|
|
34
|
+
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
35
|
+
const stageConfig = (0, _resolveStageConfigPath.resolveStageConfigPath)(stage);
|
|
36
|
+
const modeSettingsFile = `${stageConfig}/${getRunMode()}/settings.json`;
|
|
37
|
+
const filePath = _path.default.join(_path.default.resolve(process.cwd(), modeSettingsFile));
|
|
38
38
|
try {
|
|
39
39
|
if (!(0, _fs.existsSync)(filePath)) {
|
|
40
|
-
const defaultSettingsFile = _path.default.join(
|
|
40
|
+
const defaultSettingsFile = _path.default.join(_path.default.resolve(process.cwd(), `${stage}/conf/default/settings.json`));
|
|
41
41
|
return require(defaultSettingsFile);
|
|
42
42
|
}
|
|
43
43
|
return require(filePath);
|
|
44
44
|
} catch (error) {
|
|
45
|
-
throw new Error(`${
|
|
45
|
+
throw new Error(`${filePath} file missing.`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
function getDefaultActor() {
|
|
@@ -53,18 +53,17 @@ function getDefaultActor() {
|
|
|
53
53
|
return getUserForSelectedEditionAndProfile(edition, profile);
|
|
54
54
|
}
|
|
55
55
|
function getListOfActors(betaFeature) {
|
|
56
|
-
const {
|
|
57
|
-
uatDirectory
|
|
58
|
-
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
59
56
|
const mode = getRunMode();
|
|
60
|
-
|
|
57
|
+
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
58
|
+
const stageConfig = (0, _resolveStageConfigPath.resolveStageConfigPath)(stage);
|
|
59
|
+
let configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stageConfig}/${mode}/actors/index.js`));
|
|
61
60
|
let betaReference = mode;
|
|
62
61
|
if (!(0, _fs.existsSync)(configFile)) {
|
|
63
|
-
configFile = _path.default.join(
|
|
62
|
+
configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stage}/conf/default/actors/index.js`));
|
|
64
63
|
betaReference = "default";
|
|
65
64
|
}
|
|
66
65
|
if (betaFeature) {
|
|
67
|
-
configFile = _path.default.join(
|
|
66
|
+
configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stageConfig}/${betaReference}/actors/beta/${betaFeature}/index.js`));
|
|
68
67
|
if (!(0, _fs.existsSync)(configFile)) {
|
|
69
68
|
throw new Error(`There is no beta feature configured with the name "${betaFeature}"`);
|
|
70
69
|
}
|
|
@@ -113,7 +112,6 @@ function getUserForSelectedEditionAndProfile(preferedEdition, preferredProfile,
|
|
|
113
112
|
}
|
|
114
113
|
return {
|
|
115
114
|
...editionData,
|
|
116
|
-
...selectedProfile
|
|
117
|
-
'beta': betaFeature
|
|
115
|
+
...selectedProfile
|
|
118
116
|
};
|
|
119
117
|
}
|
|
@@ -10,21 +10,27 @@ exports.getUATFileName = getUATFileName;
|
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
var _fs = _interopRequireDefault(require("fs"));
|
|
12
12
|
var _auth = require("./auth");
|
|
13
|
-
|
|
13
|
+
var _ConfigurationHelper = require("./../configuration/ConfigurationHelper");
|
|
14
|
+
var _resolveStageConfigPath = require("./resolveStageConfigPath");
|
|
15
|
+
function getUATFileName(stage, mode) {
|
|
16
|
+
stage = stage || (0, _ConfigurationHelper.getRunStage)();
|
|
14
17
|
mode = mode || (0, _auth.getRunMode)();
|
|
15
|
-
const
|
|
18
|
+
const stageConfig = (0, _resolveStageConfigPath.resolveStageConfigPath)(stage);
|
|
19
|
+
const uatConfFilePath = _path.default.resolve(process.cwd(), `${stageConfig}/${mode}/uat.config.js`);
|
|
16
20
|
if (_fs.default.existsSync(uatConfFilePath)) {
|
|
17
21
|
return uatConfFilePath;
|
|
18
22
|
}
|
|
19
|
-
|
|
23
|
+
;
|
|
24
|
+
return _path.default.resolve(process.cwd(), `${stage}/conf/default/uat.config.js`);
|
|
20
25
|
}
|
|
21
|
-
function getEnvConfigFilePath(mode) {
|
|
22
|
-
const
|
|
26
|
+
function getEnvConfigFilePath(stage, mode) {
|
|
27
|
+
const stageConfig = (0, _resolveStageConfigPath.resolveStageConfigPath)(stage);
|
|
28
|
+
const confFilePath = `${stageConfig}/${mode}/settings.json`;
|
|
23
29
|
// TODO: Actors Mode as config
|
|
24
30
|
if (_fs.default.existsSync(confFilePath)) {
|
|
25
|
-
return
|
|
31
|
+
return confFilePath;
|
|
26
32
|
}
|
|
27
|
-
return
|
|
33
|
+
return `${stage}/conf/default/settings.json`;
|
|
28
34
|
}
|
|
29
35
|
function getReportFileName() {
|
|
30
36
|
return `test-summary.json`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.readPropertiesFile = readPropertiesFile;
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
//This function reads a properties file and returns an object with key-value pairs
|
|
11
|
+
|
|
12
|
+
function readPropertiesFile(relativeFilePath) {
|
|
13
|
+
const filePath = _path.default.resolve(process.cwd(), relativeFilePath);
|
|
14
|
+
if (!_fs.default.existsSync(filePath)) {
|
|
15
|
+
return {
|
|
16
|
+
uat: 'uat/conf'
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const fileContent = _fs.default.readFileSync(filePath, 'utf-8');
|
|
20
|
+
const properties = {};
|
|
21
|
+
const lines = fileContent.split('\n');
|
|
22
|
+
lines.forEach(line => {
|
|
23
|
+
const [key, value] = line.split('=');
|
|
24
|
+
if (key && value) {
|
|
25
|
+
properties[key.trim()] = value.trim();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return properties;
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveStageConfigPath = resolveStageConfigPath;
|
|
7
|
+
var _logger = require("../../../utils/logger");
|
|
8
|
+
var _resolvePropertiesFile = require("./resolvePropertiesFile");
|
|
9
|
+
// This function resolves the config path for a given stage
|
|
10
|
+
|
|
11
|
+
function resolveStageConfigPath(stage) {
|
|
12
|
+
const props = (0, _resolvePropertiesFile.readPropertiesFile)('uat/conf-path-map.properties');
|
|
13
|
+
const stageConfig = props[stage];
|
|
14
|
+
if (!stageConfig) {
|
|
15
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `No config mapping found for stage: "${stage}"`);
|
|
16
|
+
}
|
|
17
|
+
return stageConfig;
|
|
18
|
+
}
|
|
@@ -19,6 +19,7 @@ var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
|
19
19
|
let cachedConfig = null;
|
|
20
20
|
function getDefaultConfig() {
|
|
21
21
|
return {
|
|
22
|
+
isTearDown: true,
|
|
22
23
|
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
23
24
|
headless: false,
|
|
24
25
|
browsers: ['Chrome'],
|
|
@@ -110,15 +111,16 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
110
111
|
*/
|
|
111
112
|
|
|
112
113
|
function getConfigFilePath() {
|
|
113
|
-
return
|
|
114
|
+
return (0, _configFileNameProvider.getUATFileName)();
|
|
114
115
|
}
|
|
115
116
|
function generateConfigFromFile() {
|
|
116
117
|
if (cachedConfig === null) {
|
|
117
118
|
// Getting the default config's from framework
|
|
118
119
|
const uatConfig = new _Configuration.default(getDefaultConfig());
|
|
119
120
|
// overriding the application config's from project
|
|
120
|
-
const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
|
|
121
121
|
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
122
|
+
const stage = userArgConfig.get("stage");
|
|
123
|
+
const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(stage));
|
|
122
124
|
// overriding the user config's from CLI
|
|
123
125
|
uatConfig.addAll(appConfig);
|
|
124
126
|
uatConfig.addAll(userArgConfig);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class Project {
|
|
4
|
+
constructor(name) {
|
|
5
|
+
this.properties = {};
|
|
6
|
+
this.properties.name = name;
|
|
7
|
+
}
|
|
8
|
+
setTestDir(value) {
|
|
9
|
+
this.properties.testDir = value;
|
|
10
|
+
}
|
|
11
|
+
setTestMatch(value) {
|
|
12
|
+
this.properties.testMatch = value;
|
|
13
|
+
}
|
|
14
|
+
setRetries(value) {
|
|
15
|
+
this.properties.retries = value;
|
|
16
|
+
}
|
|
17
|
+
setUse(value) {
|
|
18
|
+
this.properties.use = value;
|
|
19
|
+
}
|
|
20
|
+
setTearDown(value) {
|
|
21
|
+
this.properties.teardown = value;
|
|
22
|
+
}
|
|
23
|
+
setDependencies(value) {
|
|
24
|
+
this.properties.dependencies = value;
|
|
25
|
+
}
|
|
26
|
+
setProperty(key, value) {
|
|
27
|
+
this.properties[key] = value;
|
|
28
|
+
}
|
|
29
|
+
getProperties() {
|
|
30
|
+
return this.properties;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
module.exports = {
|
|
34
|
+
Project
|
|
35
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.cleanupConfig = cleanupConfig;
|
|
8
|
+
exports.setupConfig = setupConfig;
|
|
9
|
+
exports.smokeTestConfig = smokeTestConfig;
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _Project = require("./Project");
|
|
12
|
+
var _configUtils = require("./config-utils");
|
|
13
|
+
var _readConfigFile = require("../readConfigFile");
|
|
14
|
+
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
15
|
+
const {
|
|
16
|
+
isAuthMode,
|
|
17
|
+
isSmokeTest,
|
|
18
|
+
bddMode,
|
|
19
|
+
authFilePath,
|
|
20
|
+
trace,
|
|
21
|
+
video,
|
|
22
|
+
testIdAttribute,
|
|
23
|
+
viewport
|
|
24
|
+
} = uatConfig;
|
|
25
|
+
function setupConfig() {
|
|
26
|
+
const setupProject = new _Project.Project('setup');
|
|
27
|
+
setupProject.setTestMatch(/.*\.setup\.js/);
|
|
28
|
+
setupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
29
|
+
const isTearDown = JSON.parse(process.env.tearDown);
|
|
30
|
+
setupProject.setTearDown(isTearDown ? 'cleanup' : '');
|
|
31
|
+
const setupProjectConfig = [setupProject.getProperties()];
|
|
32
|
+
return setupProjectConfig;
|
|
33
|
+
}
|
|
34
|
+
function smokeTestConfig() {
|
|
35
|
+
const smokeTestProject = new _Project.Project('smokeTest');
|
|
36
|
+
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
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')
|
|
41
|
+
});
|
|
42
|
+
const commonConfig = {
|
|
43
|
+
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
44
|
+
};
|
|
45
|
+
smokeTestProject.setTestDir(smokeTestDir);
|
|
46
|
+
smokeTestProject.setRetries(0);
|
|
47
|
+
smokeTestProject.setUse({
|
|
48
|
+
...commonConfig
|
|
49
|
+
});
|
|
50
|
+
smokeTestProject.setDependencies(isAuthMode ? ['setup'] : []);
|
|
51
|
+
const smokeTestProjectConfig = [smokeTestProject.getProperties()];
|
|
52
|
+
return smokeTestProjectConfig;
|
|
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
|
+
}
|
|
74
|
+
function cleanupConfig() {
|
|
75
|
+
const cleanupProject = new _Project.Project('cleanup');
|
|
76
|
+
cleanupProject.setTestMatch(/.*\.teardown\.js/);
|
|
77
|
+
cleanupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
78
|
+
const cleanupProjectConfig = [cleanupProject.getProperties()];
|
|
79
|
+
return cleanupProjectConfig;
|
|
80
|
+
}
|
|
@@ -9,25 +9,24 @@ var _test = require("@playwright/test");
|
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var _readConfigFile = require("../readConfigFile");
|
|
11
11
|
var _configUtils = require("./config-utils");
|
|
12
|
+
var _ProjectConfiguration = require("./ProjectConfiguration");
|
|
12
13
|
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
13
14
|
const {
|
|
15
|
+
bddMode,
|
|
14
16
|
browsers,
|
|
15
17
|
isSmokeTest,
|
|
16
|
-
trace,
|
|
17
|
-
video,
|
|
18
18
|
isAuthMode,
|
|
19
19
|
openReportOn,
|
|
20
20
|
reportPath,
|
|
21
|
-
bddMode,
|
|
22
21
|
expectTimeout,
|
|
23
22
|
testTimeout,
|
|
24
23
|
authFilePath,
|
|
25
24
|
viewport,
|
|
26
|
-
featureFilesFolder,
|
|
27
|
-
stepDefinitionsFolder,
|
|
28
|
-
testIdAttribute,
|
|
29
25
|
globalTimeout,
|
|
30
|
-
customReporter
|
|
26
|
+
customReporter,
|
|
27
|
+
trace,
|
|
28
|
+
video,
|
|
29
|
+
testIdAttribute
|
|
31
30
|
} = uatConfig;
|
|
32
31
|
const projects = (0, _configUtils.getProjects)({
|
|
33
32
|
browsers,
|
|
@@ -38,18 +37,6 @@ const projects = (0, _configUtils.getProjects)({
|
|
|
38
37
|
testTimeout,
|
|
39
38
|
viewport
|
|
40
39
|
});
|
|
41
|
-
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
42
|
-
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
43
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
44
|
-
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
45
|
-
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
46
|
-
});
|
|
47
|
-
const use = {
|
|
48
|
-
trace,
|
|
49
|
-
video,
|
|
50
|
-
viewport,
|
|
51
|
-
testIdAttribute
|
|
52
|
-
};
|
|
53
40
|
let reporter = [['html', {
|
|
54
41
|
outputFolder: reportPath,
|
|
55
42
|
open: openReportOn
|
|
@@ -66,29 +53,23 @@ if (customReporter) {
|
|
|
66
53
|
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
67
54
|
*/
|
|
68
55
|
|
|
56
|
+
const use = {
|
|
57
|
+
trace,
|
|
58
|
+
video,
|
|
59
|
+
viewport,
|
|
60
|
+
testIdAttribute
|
|
61
|
+
};
|
|
62
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
63
|
+
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(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')
|
|
67
|
+
});
|
|
69
68
|
function getPlaywrightConfig() {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const smokeTestProject = isSmokeTest ? smokeTestConfig() : [];
|
|
75
|
-
function smokeTestConfig() {
|
|
76
|
-
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
77
|
-
featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
|
|
78
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
79
|
-
outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
|
|
80
|
-
uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
|
|
81
|
-
});
|
|
82
|
-
return [{
|
|
83
|
-
name: 'smokeTest',
|
|
84
|
-
testDir: smokeTestDir,
|
|
85
|
-
use: {
|
|
86
|
-
...commonConfig
|
|
87
|
-
},
|
|
88
|
-
dependencies: dependencies,
|
|
89
|
-
retries: 0
|
|
90
|
-
}];
|
|
91
|
-
}
|
|
69
|
+
const smokeTestProject = isSmokeTest ? (0, _ProjectConfiguration.smokeTestConfig)() : [];
|
|
70
|
+
const setupProject = isAuthMode ? (0, _ProjectConfiguration.setupConfig)() : [];
|
|
71
|
+
const isTearDown = JSON.parse(process.env.tearDown);
|
|
72
|
+
const cleanupProject = isTearDown ? (0, _ProjectConfiguration.cleanupConfig)() : [];
|
|
92
73
|
const playwrightConfig = {
|
|
93
74
|
testDir,
|
|
94
75
|
globalTimeout: globalTimeout || 3600000,
|
|
@@ -100,16 +81,7 @@ function getPlaywrightConfig() {
|
|
|
100
81
|
timeout: expectTimeout
|
|
101
82
|
},
|
|
102
83
|
use,
|
|
103
|
-
projects:
|
|
104
|
-
name: 'setup',
|
|
105
|
-
testMatch: /.*\.setup\.js/,
|
|
106
|
-
testDir: _path.default.join(process.cwd(), 'uat'),
|
|
107
|
-
teardown: 'cleanup'
|
|
108
|
-
}, ...smokeTestProject, {
|
|
109
|
-
name: 'cleanup',
|
|
110
|
-
testMatch: /.*\.teardown\.js/,
|
|
111
|
-
testDir: _path.default.join(process.cwd(), 'uat')
|
|
112
|
-
}, ...projects] : [...projects, ...smokeTestProject],
|
|
84
|
+
projects: [...setupProject, ...smokeTestProject, ...projects, ...cleanupProject],
|
|
113
85
|
...uatConfig
|
|
114
86
|
};
|
|
115
87
|
return playwrightConfig;
|
|
@@ -86,13 +86,17 @@ function main() {
|
|
|
86
86
|
// overriding the application config's from project
|
|
87
87
|
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
88
88
|
const mode = userArgConfig.get("mode");
|
|
89
|
-
|
|
89
|
+
const stage = userArgConfig.get("stage");
|
|
90
|
+
uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(stage, mode)));
|
|
90
91
|
// overriding the user config's from CLI
|
|
91
92
|
uatConfig.addAll(userArgConfig);
|
|
92
93
|
const modules = uatConfig.get('modules');
|
|
94
|
+
const tearDown = uatConfig.get('isTearDown');
|
|
93
95
|
|
|
94
96
|
//We need to change this process.env variable to pass the module name in future.
|
|
95
97
|
process.env.modules = modules;
|
|
98
|
+
process.env.tearDown = tearDown;
|
|
99
|
+
process.env.stage = stage;
|
|
96
100
|
const {
|
|
97
101
|
isAuthMode,
|
|
98
102
|
editionOrder,
|
|
@@ -100,7 +104,7 @@ function main() {
|
|
|
100
104
|
bddMode = false,
|
|
101
105
|
headless = false
|
|
102
106
|
} = uatConfig.getAll();
|
|
103
|
-
(0, _envInitializer.initializeEnvConfig)(mode, isAuthMode);
|
|
107
|
+
(0, _envInitializer.initializeEnvConfig)(stage, mode, isAuthMode);
|
|
104
108
|
|
|
105
109
|
//This is only used for pass the user arguments to need places in legacy code. We need to rewamp that also.
|
|
106
110
|
const userArgsObject = userArgConfig.getAll();
|