@zohodesk/testinglibrary 0.2.4 → 0.2.5
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.
|
@@ -63,6 +63,13 @@ var _default = exports.default = {
|
|
|
63
63
|
$tags,
|
|
64
64
|
page
|
|
65
65
|
}, use) => {
|
|
66
|
+
const {
|
|
67
|
+
isAuthMode
|
|
68
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
69
|
+
if (!isAuthMode) {
|
|
70
|
+
await use(page);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
66
73
|
const testPortalDetails = getCustomAccountDetails($tags);
|
|
67
74
|
if (testPortalDetails === null) {
|
|
68
75
|
await performDefaultPageSteps({
|
|
@@ -10,6 +10,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
11
11
|
var _logger = require("../../utils/logger");
|
|
12
12
|
var _getUsers = require("./helpers/auth/getUsers");
|
|
13
|
+
var _readConfigFile = require("./readConfigFile");
|
|
13
14
|
function setEnvironmentVariables(configJSON) {
|
|
14
15
|
for (const key in configJSON) {
|
|
15
16
|
process.env[key] = configJSON[key];
|
|
@@ -32,8 +33,13 @@ function initializeEnvConfig(mode) {
|
|
|
32
33
|
...configJSON,
|
|
33
34
|
mode
|
|
34
35
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
36
|
+
const {
|
|
37
|
+
isAuthMode
|
|
38
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
39
|
+
if (isAuthMode) {
|
|
40
|
+
const defaultActorConfiguration = (0, _getUsers.getDefaultActorConf)();
|
|
41
|
+
setEnvironmentVariables(defaultActorConfiguration);
|
|
42
|
+
}
|
|
37
43
|
} catch (err) {
|
|
38
44
|
_logger.Logger.error(err);
|
|
39
45
|
throw new Error(`Config File Not Exists. Please provide a config file ${(0, _configFileNameProvider.getEnvConfigFilePath)(mode)} to intiailize the environment variables `);
|
|
@@ -31,8 +31,12 @@ function isDevelopmentSetup() {
|
|
|
31
31
|
}
|
|
32
32
|
function getDefaultActorConf() {
|
|
33
33
|
const {
|
|
34
|
-
uatDirectory
|
|
34
|
+
uatDirectory,
|
|
35
|
+
isAuthMode
|
|
35
36
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
37
|
+
if (!isAuthMode) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
36
40
|
const defaultSettingFile = `conf/${getRunMode()}/settings.json`;
|
|
37
41
|
const filePath = _path.default.join(uatDirectory, defaultSettingFile);
|
|
38
42
|
if (!(0, _fs.existsSync)(filePath)) {
|
|
@@ -49,8 +53,15 @@ function getDefaultActor() {
|
|
|
49
53
|
}
|
|
50
54
|
function getListOfActors() {
|
|
51
55
|
const {
|
|
52
|
-
uatDirectory
|
|
56
|
+
uatDirectory,
|
|
57
|
+
isAuthMode
|
|
53
58
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
59
|
+
if (!isAuthMode) {
|
|
60
|
+
return {
|
|
61
|
+
editions: [],
|
|
62
|
+
beta: []
|
|
63
|
+
};
|
|
64
|
+
}
|
|
54
65
|
const mode = getRunMode();
|
|
55
66
|
const configFile = `conf/${mode}/actors/index`;
|
|
56
67
|
const filePath = _path.default.join(uatDirectory, configFile);
|
|
@@ -60,6 +71,12 @@ function getListOfActors() {
|
|
|
60
71
|
return require(filePath);
|
|
61
72
|
}
|
|
62
73
|
function getUserForSelectedEditionAndProfile(preferedEdition, preferredProfile, betaFeature, testDataPortal = null) {
|
|
74
|
+
const {
|
|
75
|
+
isAuthMode
|
|
76
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
77
|
+
if (!isAuthMode) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
63
80
|
const {
|
|
64
81
|
editions: userdata,
|
|
65
82
|
beta: betaPortals
|
|
@@ -22,26 +22,16 @@ var _test = require("@playwright/test");
|
|
|
22
22
|
var _readConfigFile = require("./readConfigFile");
|
|
23
23
|
var _builtInFixtures = _interopRequireDefault(require("./builtInFixtures"));
|
|
24
24
|
var _getUserFixtures = _interopRequireDefault(require("./helpers/getUserFixtures"));
|
|
25
|
-
// import {
|
|
26
|
-
// accountLogin,
|
|
27
|
-
// getRunMode,
|
|
28
|
-
// isCI,
|
|
29
|
-
// isDevelopmentSetup,
|
|
30
|
-
// getListOfActors,
|
|
31
|
-
// getDefaultActor,
|
|
32
|
-
// getUserForSelectedEditionAndProfile,
|
|
33
|
-
// loadCookiesIfPresent,
|
|
34
|
-
// performLoginSteps,
|
|
35
|
-
// verifyIfCookieFileExists
|
|
36
|
-
// } from './helpers/auth/index';
|
|
37
|
-
|
|
38
25
|
const {
|
|
39
26
|
bddMode
|
|
40
27
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
41
28
|
let base = bddMode ? _bddFramework.test : _test.test;
|
|
42
29
|
const buildInFixtures = (0, _builtInFixtures.default)(bddMode);
|
|
30
|
+
const buildInFixturesTest = base.extend({
|
|
31
|
+
...buildInFixtures
|
|
32
|
+
});
|
|
43
33
|
const userFixtures = (0, _getUserFixtures.default)();
|
|
44
|
-
const
|
|
45
|
-
...buildInFixtures,
|
|
34
|
+
const userFixturesTest = base.extend({
|
|
46
35
|
...userFixtures
|
|
47
|
-
});
|
|
36
|
+
});
|
|
37
|
+
const test = exports.test = (0, _test.mergeTests)(buildInFixturesTest, userFixturesTest);
|