@zohodesk/testinglibrary 0.5.3-n18-experimental → 0.5.5-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 +8 -0
- package/build/core/playwright/builtInFixtures/page.js +2 -1
- package/build/core/playwright/clear-caches.js +2 -5
- package/build/core/playwright/configuration/ConfigurationHelper.js +5 -7
- package/build/core/playwright/constants/reporterConstants.js +2 -6
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/env-initializer.js +9 -10
- package/build/core/playwright/helpers/auth/getUsers.js +14 -14
- package/build/core/playwright/helpers/auth/index.js +1 -8
- package/build/core/playwright/helpers/auth/loginSteps.js +6 -4
- package/build/core/playwright/helpers/configFileNameProvider.js +8 -15
- package/build/core/playwright/readConfigFile.js +9 -8
- 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 +4 -7
- package/build/core/playwright/setup/qc-custom-reporter.js +1 -4
- package/build/core/playwright/test-runner.js +6 -4
- package/build/index.js +0 -6
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +13 -54
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +26 -29
- package/build/utils/commonUtils.js +1 -4
- package/npm-shrinkwrap.json +211 -125
- package/package.json +2 -2
- package/playwright.config.js +7 -10
- package/build/core/playwright/constants/configConstants.js +0 -14
- package/build/core/playwright/helpers/configPathResolver.js +0 -38
- package/build/test/core/playwright/helpers/__tests__/configPathResolver.test.js +0 -55
- package/unit_reports/unit-report.html +0 -260
package/README.md
CHANGED
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
|
|
41
41
|
- 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
|
|
42
42
|
|
|
43
|
+
### Issue fix
|
|
44
|
+
- Custom teardown comment provided
|
|
45
|
+
|
|
46
|
+
### v3.2.10 - 09-10-2025
|
|
47
|
+
|
|
48
|
+
#### Enhancement
|
|
49
|
+
- A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
|
|
50
|
+
|
|
43
51
|
|
|
44
52
|
### v3.2.9 - 26-09-2025
|
|
45
53
|
|
|
@@ -26,7 +26,8 @@ var _default = exports.default = {
|
|
|
26
26
|
await context.clearCookies();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
// await executeDefaultLoginSteps(context, testInfo , testDetails, testPortalDetails);
|
|
30
31
|
} catch (e) {
|
|
31
32
|
console.error('Error during page', e);
|
|
32
33
|
} finally {
|
|
@@ -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,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.combineConfiguration = combineConfiguration;
|
|
7
8
|
exports.getApplicationConfig = getApplicationConfig;
|
|
8
|
-
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
var _logger = require("../../../utils/logger");
|
|
10
11
|
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
11
12
|
var _mergeObjects = require("../helpers/mergeObjects");
|
|
12
13
|
var _fs = require("fs");
|
|
14
|
+
const Configuration = require("./Configuration");
|
|
13
15
|
function combineConfiguration(defaultConfig, userConfiguration) {
|
|
14
16
|
let configurationObj = {};
|
|
15
17
|
Object.keys(userConfiguration).forEach(configKey => {
|
|
@@ -24,10 +26,10 @@ function combineConfiguration(defaultConfig, userConfiguration) {
|
|
|
24
26
|
});
|
|
25
27
|
return (0, _mergeObjects.mergeObjects)(defaultConfig, configurationObj);
|
|
26
28
|
}
|
|
27
|
-
function getApplicationConfig(
|
|
29
|
+
function getApplicationConfig(mode) {
|
|
28
30
|
let filePath = "";
|
|
29
31
|
try {
|
|
30
|
-
filePath = (0, _configFileNameProvider.getUATFileName)(
|
|
32
|
+
filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)(mode));
|
|
31
33
|
if (!(0, _fs.existsSync)(filePath)) {
|
|
32
34
|
throw new Error("Exception while getting the uat file from the application - " + filePath);
|
|
33
35
|
}
|
|
@@ -38,8 +40,4 @@ function getApplicationConfig(stage, mode) {
|
|
|
38
40
|
_logger.Logger.error(err);
|
|
39
41
|
return {};
|
|
40
42
|
}
|
|
41
|
-
}
|
|
42
|
-
function getRunStage() {
|
|
43
|
-
const stage = process.env.stage;
|
|
44
|
-
return stage || 'uat';
|
|
45
43
|
}
|
|
@@ -1,15 +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 =
|
|
8
|
+
static DEFAULT_REPORTER_PATH = 'uat/test-results/playwright-test-results.json';
|
|
9
|
+
static LAST_RUN_REPORTER_PATH = 'uat/test-results/.last-run.json';
|
|
14
10
|
}
|
|
15
11
|
exports.default = ReporterConstants;
|
|
@@ -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 = ['
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules', 'isTearDown'];
|
|
@@ -17,20 +17,19 @@ 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/prod' 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(
|
|
24
|
-
if (!mode) {
|
|
25
|
-
addHelperLogsForEnvInitialization();
|
|
26
|
-
mode = 'dev';
|
|
27
|
-
}
|
|
28
|
-
const configFilePath = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)(stage, mode)}`));
|
|
23
|
+
function initializeEnvConfig(mode, isAuthMode) {
|
|
29
24
|
try {
|
|
30
|
-
|
|
25
|
+
if (!mode) {
|
|
26
|
+
addHelperLogsForEnvInitialization();
|
|
27
|
+
mode = 'dev';
|
|
28
|
+
}
|
|
29
|
+
const configFile = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)(mode)}`));
|
|
30
|
+
const configJSON = JSON.parse(configFile);
|
|
31
31
|
setEnvironmentVariables({
|
|
32
32
|
...configJSON,
|
|
33
|
-
stage,
|
|
34
33
|
mode
|
|
35
34
|
});
|
|
36
35
|
if (isAuthMode) {
|
|
@@ -39,6 +38,6 @@ function initializeEnvConfig(stage, mode, isAuthMode) {
|
|
|
39
38
|
}
|
|
40
39
|
} catch (err) {
|
|
41
40
|
_logger.Logger.error(err);
|
|
42
|
-
throw new Error(`Config File Not Exists. Please provide a ${
|
|
41
|
+
throw new Error(`Config File Not Exists. Please provide a config file ${(0, _configFileNameProvider.getEnvConfigFilePath)(mode)} to intiailize the environment variables `);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
@@ -13,9 +13,7 @@ exports.isCI = isCI;
|
|
|
13
13
|
exports.isDevelopmentSetup = isDevelopmentSetup;
|
|
14
14
|
var _path = _interopRequireDefault(require("path"));
|
|
15
15
|
var _fs = require("fs");
|
|
16
|
-
var
|
|
17
|
-
var _ConfigurationHelper = require("./../../configuration/ConfigurationHelper");
|
|
18
|
-
var _configConstants = _interopRequireDefault(require("../../constants/configConstants"));
|
|
16
|
+
var _readConfigFile = require("../../readConfigFile");
|
|
19
17
|
/* eslint-disable global-require */
|
|
20
18
|
function getRunMode() {
|
|
21
19
|
let {
|
|
@@ -32,18 +30,19 @@ function isDevelopmentSetup() {
|
|
|
32
30
|
return mode === 'DEV' || mode === 'dev';
|
|
33
31
|
}
|
|
34
32
|
function getDefaultActorConf() {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
33
|
+
const {
|
|
34
|
+
uatDirectory
|
|
35
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
36
|
+
const modeSettingsFile = `conf/${getRunMode()}/settings.json`;
|
|
37
|
+
const filePath = _path.default.join(uatDirectory, modeSettingsFile);
|
|
39
38
|
try {
|
|
40
39
|
if (!(0, _fs.existsSync)(filePath)) {
|
|
41
|
-
const defaultSettingsFile = _path.default.join(
|
|
40
|
+
const defaultSettingsFile = _path.default.join(uatDirectory, `conf/default/settings.json`);
|
|
42
41
|
return require(defaultSettingsFile);
|
|
43
42
|
}
|
|
44
43
|
return require(filePath);
|
|
45
44
|
} catch (error) {
|
|
46
|
-
throw new Error(`${filePath}
|
|
45
|
+
throw new Error(`${defaultSettingFile} ${filePath} both files are missing.`);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
function getDefaultActor() {
|
|
@@ -54,17 +53,18 @@ function getDefaultActor() {
|
|
|
54
53
|
return getUserForSelectedEditionAndProfile(edition, profile);
|
|
55
54
|
}
|
|
56
55
|
function getListOfActors(betaFeature) {
|
|
56
|
+
const {
|
|
57
|
+
uatDirectory
|
|
58
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
57
59
|
const mode = getRunMode();
|
|
58
|
-
|
|
59
|
-
const stagePath = (0, _configPathResolver.getConfigPath)(stage);
|
|
60
|
-
let configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stagePath}/${mode}/${_configConstants.default.ACTOR_DIR}/${_configConstants.default.INDEX_FILE}`));
|
|
60
|
+
let configFile = _path.default.join(uatDirectory, `conf/${mode}/actors/index.js`);
|
|
61
61
|
let betaReference = mode;
|
|
62
62
|
if (!(0, _fs.existsSync)(configFile)) {
|
|
63
|
-
configFile = _path.default.join(
|
|
63
|
+
configFile = _path.default.join(uatDirectory, `conf/default/actors/index.js`);
|
|
64
64
|
betaReference = "default";
|
|
65
65
|
}
|
|
66
66
|
if (betaFeature) {
|
|
67
|
-
configFile = _path.default.join(
|
|
67
|
+
configFile = _path.default.join(uatDirectory, `conf/${betaReference}/actors/beta/${betaFeature}/index.js`);
|
|
68
68
|
if (!(0, _fs.existsSync)(configFile)) {
|
|
69
69
|
throw new Error(`There is no beta feature configured with the name "${betaFeature}"`);
|
|
70
70
|
}
|
|
@@ -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"));
|
|
@@ -18,14 +18,16 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
18
18
|
authFilePrefix,
|
|
19
19
|
email
|
|
20
20
|
} = testInfo;
|
|
21
|
-
authFilePrefix = authFilePrefix
|
|
21
|
+
authFilePrefix = authFilePrefix ? authFilePrefix + email : email;
|
|
22
|
+
console.log("authFilePrefix", authFilePrefix);
|
|
23
|
+
process.env.authFilePrefix = authFilePrefix;
|
|
22
24
|
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
|
|
23
|
-
const lockFileName =
|
|
25
|
+
const lockFileName = authFilePrefix.replace(/[@.]/g, '_');
|
|
24
26
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.fileDeletionTimeoutConfig);
|
|
25
27
|
let loginUsingCookie = false;
|
|
26
28
|
try {
|
|
27
29
|
if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
|
|
28
|
-
console.log(`${
|
|
30
|
+
console.log(`${authFilePrefix} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
29
31
|
loginUsingCookie = true;
|
|
30
32
|
} else {
|
|
31
33
|
await fileMutex.acquire();
|
|
@@ -40,7 +42,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
} catch (error) {
|
|
43
|
-
console.error(`Error during login for ${
|
|
45
|
+
console.error(`Error during login for ${authFilePrefix}:`, error);
|
|
44
46
|
} finally {
|
|
45
47
|
if (!loginUsingCookie) {
|
|
46
48
|
await fileMutex.release();
|
|
@@ -10,29 +10,22 @@ exports.getUATFileName = getUATFileName;
|
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
var _fs = _interopRequireDefault(require("fs"));
|
|
12
12
|
var _auth = require("./auth");
|
|
13
|
-
|
|
14
|
-
var _configPathResolver = require("./configPathResolver");
|
|
15
|
-
var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
|
|
16
|
-
function getUATFileName(stage, mode) {
|
|
17
|
-
stage = stage || (0, _ConfigurationHelper.getRunStage)();
|
|
13
|
+
function getUATFileName(mode) {
|
|
18
14
|
mode = mode || (0, _auth.getRunMode)();
|
|
19
|
-
const
|
|
20
|
-
const uatConfFilePath = _path.default.resolve(process.cwd(), `${stagePath}/${mode}/${_configConstants.default.UAT_CONFIG_FILE}`);
|
|
15
|
+
const uatConfFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/uat.config.js`);
|
|
21
16
|
if (_fs.default.existsSync(uatConfFilePath)) {
|
|
22
17
|
return uatConfFilePath;
|
|
23
18
|
}
|
|
24
|
-
;
|
|
25
|
-
return _path.default.resolve(process.cwd(), `${stagePath}/${_configConstants.default.DEFAULT_CONFIG_DIR}/${_configConstants.default.UAT_CONFIG_FILE}`);
|
|
19
|
+
return _path.default.resolve(process.cwd(), `uat/conf/default/uat.config.js`);
|
|
26
20
|
}
|
|
27
|
-
function getEnvConfigFilePath(
|
|
28
|
-
const
|
|
29
|
-
const confFilePath = `${stagePath}/${mode}/${_configConstants.default.SETTINGS_FILE}`;
|
|
21
|
+
function getEnvConfigFilePath(mode) {
|
|
22
|
+
const confFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/settings.json`);
|
|
30
23
|
// TODO: Actors Mode as config
|
|
31
24
|
if (_fs.default.existsSync(confFilePath)) {
|
|
32
|
-
return
|
|
25
|
+
return `uat/conf/${mode}/settings.json`;
|
|
33
26
|
}
|
|
34
|
-
return
|
|
27
|
+
return `uat/conf/default/settings.json`;
|
|
35
28
|
}
|
|
36
29
|
function getReportFileName() {
|
|
37
|
-
return
|
|
30
|
+
return `test-summary.json`;
|
|
38
31
|
}
|
|
@@ -16,13 +16,15 @@ var _mergeObjects = require("./helpers/mergeObjects");
|
|
|
16
16
|
var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
|
|
17
17
|
var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
|
18
18
|
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
19
|
-
var _configConstants = _interopRequireDefault(require("./constants/configConstants"));
|
|
20
|
-
const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
21
19
|
let cachedConfig = null;
|
|
20
|
+
function getPrimaryCookiePath() {
|
|
21
|
+
const authFilePrefix = process.env.authFilePrefix;
|
|
22
|
+
return `uat/playwright/.auth/${authFilePrefix}-cookies.json`;
|
|
23
|
+
}
|
|
22
24
|
function getDefaultConfig() {
|
|
23
25
|
return {
|
|
24
26
|
isTearDown: true,
|
|
25
|
-
uatDirectory: _path.default.join(process.cwd(),
|
|
27
|
+
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
26
28
|
headless: false,
|
|
27
29
|
browsers: ['Chrome'],
|
|
28
30
|
forbidOnly: false,
|
|
@@ -31,11 +33,11 @@ function getDefaultConfig() {
|
|
|
31
33
|
video: false,
|
|
32
34
|
isAuthMode: false,
|
|
33
35
|
openReportOn: 'never',
|
|
34
|
-
reportPath: _path.default.join(process.cwd(),
|
|
36
|
+
reportPath: _path.default.join(process.cwd(), 'uat', 'playwright-report'),
|
|
35
37
|
bddMode: false,
|
|
36
38
|
expectTimeout: 5 * 1000,
|
|
37
39
|
testTimeout: 60 * 1000,
|
|
38
|
-
authFilePath:
|
|
40
|
+
authFilePath: getPrimaryCookiePath(),
|
|
39
41
|
viewport: {
|
|
40
42
|
width: 1280,
|
|
41
43
|
height: 720
|
|
@@ -113,16 +115,15 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
113
115
|
*/
|
|
114
116
|
|
|
115
117
|
function getConfigFilePath() {
|
|
116
|
-
return (0, _configFileNameProvider.getUATFileName)();
|
|
118
|
+
return _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
117
119
|
}
|
|
118
120
|
function generateConfigFromFile() {
|
|
119
121
|
if (cachedConfig === null) {
|
|
120
122
|
// Getting the default config's from framework
|
|
121
123
|
const uatConfig = new _Configuration.default(getDefaultConfig());
|
|
122
124
|
// overriding the application config's from project
|
|
125
|
+
const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
|
|
123
126
|
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
124
|
-
const stage = userArgConfig.get("stage");
|
|
125
|
-
const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(stage));
|
|
126
127
|
// overriding the user config's from CLI
|
|
127
128
|
uatConfig.addAll(appConfig);
|
|
128
129
|
uatConfig.addAll(userArgConfig);
|
|
@@ -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,
|
|
@@ -38,6 +35,7 @@ function getBrowserConfig({
|
|
|
38
35
|
viewport,
|
|
39
36
|
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
40
37
|
};
|
|
38
|
+
console.log("authFilePath", authFilePath);
|
|
41
39
|
// Determine dependencies based on the mode and smoke test status
|
|
42
40
|
let dependencies = isAuthMode ? ['setup'] : [];
|
|
43
41
|
dependencies = isSmokeTest ? [...dependencies, 'smokeTest'] : dependencies;
|
|
@@ -145,8 +143,7 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
145
143
|
const {
|
|
146
144
|
failed = []
|
|
147
145
|
} = JSON.parse(testSummary);
|
|
148
|
-
const casesToRun = failed.map(filePath => _path.default.join(cwd,
|
|
149
|
-
;
|
|
146
|
+
const casesToRun = failed.map(filePath => _path.default.join(cwd, 'uat', filePath.replace(/\.spec\.js$|\.js$/, '')));
|
|
150
147
|
return casesToRun;
|
|
151
148
|
} else {
|
|
152
149
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Unable to read test summary from the ${reportPath}. Verify If File Exists in the path`);
|
|
@@ -157,12 +154,12 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
157
154
|
let moduleList = modules.split(',');
|
|
158
155
|
return getModulePathForFeatureFiles(moduleList);
|
|
159
156
|
}
|
|
160
|
-
return [_path.default.join(cwd,
|
|
157
|
+
return [_path.default.join(cwd, 'uat', 'modules', '**', '*.feature')];
|
|
161
158
|
}
|
|
162
159
|
function getModulePathForFeatureFiles(moduleList) {
|
|
163
160
|
let validModuleList = [];
|
|
164
161
|
moduleList.forEach(moduleName => {
|
|
165
|
-
let modulePath = _path.default.join(process.cwd(),
|
|
162
|
+
let modulePath = _path.default.join(process.cwd(), 'uat', 'modules', '**', `${moduleName}`);
|
|
166
163
|
if ((0, _fileUtils.checkIfFolderExistsWithPattern)(modulePath)) {
|
|
167
164
|
validModuleList.push(_path.default.join(modulePath, '**', '*.feature'));
|
|
168
165
|
} 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"));
|
|
@@ -82,8 +86,7 @@ function main() {
|
|
|
82
86
|
// overriding the application config's from project
|
|
83
87
|
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
84
88
|
const mode = userArgConfig.get("mode");
|
|
85
|
-
|
|
86
|
-
uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(stage, mode)));
|
|
89
|
+
uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(mode)));
|
|
87
90
|
// overriding the user config's from CLI
|
|
88
91
|
uatConfig.addAll(userArgConfig);
|
|
89
92
|
const modules = uatConfig.get('modules');
|
|
@@ -92,7 +95,6 @@ function main() {
|
|
|
92
95
|
//We need to change this process.env variable to pass the module name in future.
|
|
93
96
|
process.env.modules = modules;
|
|
94
97
|
process.env.tearDown = tearDown;
|
|
95
|
-
process.env.stage = stage;
|
|
96
98
|
const {
|
|
97
99
|
isAuthMode,
|
|
98
100
|
editionOrder,
|
|
@@ -100,7 +102,7 @@ function main() {
|
|
|
100
102
|
bddMode = false,
|
|
101
103
|
headless = false
|
|
102
104
|
} = uatConfig.getAll();
|
|
103
|
-
(0, _envInitializer.initializeEnvConfig)(
|
|
105
|
+
(0, _envInitializer.initializeEnvConfig)(mode, isAuthMode);
|
|
104
106
|
|
|
105
107
|
//This is only used for pass the user arguments to need places in legacy code. We need to rewamp that also.
|
|
106
108
|
const userArgsObject = userArgConfig.getAll();
|
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 () {
|