@zohodesk/testinglibrary 0.4.94-n18-experimental → 0.4.96-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 +5 -13
- package/build/common/data-generator/steps/DataGenerator.spec.js +4 -4
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +4 -2
- package/build/core/dataGenerator/DataGenerator.js +0 -9
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/helpers/auth/index.js +7 -0
- package/build/core/playwright/readConfigFile.js +0 -1
- package/build/core/playwright/setup/config-creator.js +51 -23
- package/build/core/playwright/test-runner.js +0 -2
- package/build/test/Test.js +13 -0
- package/npm-shrinkwrap.json +287 -354
- package/package.json +1 -3
- package/build/core/playwright/setup/Project.js +0 -35
- package/build/core/playwright/setup/ProjectConfiguration.js +0 -80
package/README.md
CHANGED
|
@@ -17,20 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
- npm run report
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
## Version History
|
|
21
|
+
|
|
22
|
+
### Unpublished release
|
|
23
|
+
|
|
22
24
|
### Feature
|
|
23
|
-
|
|
24
|
-
- 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
|
|
25
|
-
|
|
26
|
-
### Issue fix
|
|
27
|
-
- Custom teardown comment provided
|
|
28
|
-
|
|
29
|
-
### v3.2.10 - 09-10-2025
|
|
30
|
-
|
|
31
|
-
#### Enhancement
|
|
32
|
-
- A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
|
|
33
25
|
|
|
26
|
+
- 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
|
|
34
27
|
|
|
35
28
|
### v3.2.9 - 26-09-2025
|
|
36
29
|
|
|
@@ -39,7 +32,6 @@
|
|
|
39
32
|
- Authentication deatils for data generation can be configured in org level
|
|
40
33
|
- reference link : https://learn.zoho.in/portal/zohocorp/knowledge/manual/client-uat/article/data-generation#_Tocpd3n7yt9ngeg
|
|
41
34
|
|
|
42
|
-
|
|
43
35
|
### v3.2.8 - 18-09-2025
|
|
44
36
|
|
|
45
37
|
### Bug fix
|
|
@@ -10,10 +10,10 @@ Given('generate a {string} entity {string} with generator {string}', async ({ pa
|
|
|
10
10
|
Given('generate a {string} entity {string} with API {string}', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, dataTable) => {
|
|
11
11
|
await generateAndCacheTestData(executionContext, "API", operationId, dataTable, cacheLayer, entityName);
|
|
12
12
|
});
|
|
13
|
-
Given('generate a {string} entity {string} with generator {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, profile, dataTable) => {
|
|
14
|
-
await generateAndCacheTestData(executionContext, "template", generatorName, dataTable, cacheLayer, entityName, profile);
|
|
13
|
+
Given('generate a {string} entity {string} with generator {string} using {string} profile', async ({ $tags, page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, profile, dataTable) => {
|
|
14
|
+
await generateAndCacheTestData(executionContext, "template", generatorName, dataTable, cacheLayer, entityName, profile,$tags);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
Given('generate a {string} entity {string} with API {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, profile, dataTable) => {
|
|
18
|
-
await generateAndCacheTestData(executionContext, "API", operationId, dataTable, cacheLayer, entityName, profile);
|
|
17
|
+
Given('generate a {string} entity {string} with API {string} using {string} profile', async ({ $tags,page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, profile, dataTable) => {
|
|
18
|
+
await generateAndCacheTestData(executionContext, "API", operationId, dataTable, cacheLayer, entityName, profile, $tags);
|
|
19
19
|
});
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { test } from '@zohodesk/testinglibrary';
|
|
2
2
|
import DataGenerator from '@zohodesk/testinglibrary/DataGenerator';
|
|
3
|
+
import {extractTagInfo, getUserForSelectedEditionAndProfile} from '@zohodesk/testinglibrary/helpers'
|
|
3
4
|
|
|
4
5
|
const dataGenerator = new DataGenerator();
|
|
5
6
|
|
|
6
|
-
export async function generateAndCacheTestData(executionContext, type, identifier, dataTable, cacheLayer, entityName, profile = null) {
|
|
7
|
+
export async function generateAndCacheTestData(executionContext, type, identifier, dataTable, cacheLayer, entityName, profile = null, tags = null) {
|
|
7
8
|
let actorInfo;
|
|
8
9
|
const testInfo = test.info();
|
|
9
10
|
const scenarioName = testInfo.title.split('/').pop() || 'Unknown Scenario';
|
|
10
11
|
|
|
11
12
|
if (profile) {
|
|
12
|
-
|
|
13
|
+
const { portalInfo, betaFeature } = extractTagInfo(tags);
|
|
14
|
+
actorInfo = await getUserForSelectedEditionAndProfile(executionContext.actorInfo.edition, profile ,betaFeature, portalInfo)
|
|
13
15
|
} else {
|
|
14
16
|
actorInfo = executionContext.actorInfo;
|
|
15
17
|
}
|
|
@@ -47,15 +47,6 @@ 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
|
-
}
|
|
59
50
|
}
|
|
60
51
|
async function _getGenerator(testInfo, generatorName) {
|
|
61
52
|
let generator = null;
|
|
@@ -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 = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules'];
|
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "accountLogin", {
|
|
|
10
10
|
return _accountLogin.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "extractTagInfo", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _customFixturesHelper.extractTagInfo;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "getDefaultActor", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function () {
|
|
@@ -73,4 +79,5 @@ Object.defineProperty(exports, "verifyIfCookieFileExists", {
|
|
|
73
79
|
var _accountLogin = _interopRequireDefault(require("./accountLogin"));
|
|
74
80
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
75
81
|
var _getUsers = require("./getUsers");
|
|
82
|
+
var _customFixturesHelper = require("../customFixturesHelper");
|
|
76
83
|
var _loginSteps = _interopRequireDefault(require("./loginSteps"));
|
|
@@ -19,7 +19,6 @@ var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
|
19
19
|
let cachedConfig = null;
|
|
20
20
|
function getDefaultConfig() {
|
|
21
21
|
return {
|
|
22
|
-
isTearDown: true,
|
|
23
22
|
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
24
23
|
headless: false,
|
|
25
24
|
browsers: ['Chrome'],
|
|
@@ -9,24 +9,25 @@ 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");
|
|
13
12
|
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
14
13
|
const {
|
|
15
|
-
bddMode,
|
|
16
14
|
browsers,
|
|
17
15
|
isSmokeTest,
|
|
16
|
+
trace,
|
|
17
|
+
video,
|
|
18
18
|
isAuthMode,
|
|
19
19
|
openReportOn,
|
|
20
20
|
reportPath,
|
|
21
|
+
bddMode,
|
|
21
22
|
expectTimeout,
|
|
22
23
|
testTimeout,
|
|
23
24
|
authFilePath,
|
|
24
25
|
viewport,
|
|
26
|
+
featureFilesFolder,
|
|
27
|
+
stepDefinitionsFolder,
|
|
28
|
+
testIdAttribute,
|
|
25
29
|
globalTimeout,
|
|
26
|
-
customReporter
|
|
27
|
-
trace,
|
|
28
|
-
video,
|
|
29
|
-
testIdAttribute
|
|
30
|
+
customReporter
|
|
30
31
|
} = uatConfig;
|
|
31
32
|
const projects = (0, _configUtils.getProjects)({
|
|
32
33
|
browsers,
|
|
@@ -37,6 +38,18 @@ const projects = (0, _configUtils.getProjects)({
|
|
|
37
38
|
testTimeout,
|
|
38
39
|
viewport
|
|
39
40
|
});
|
|
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
|
+
};
|
|
40
53
|
let reporter = [['html', {
|
|
41
54
|
outputFolder: reportPath,
|
|
42
55
|
open: openReportOn
|
|
@@ -53,23 +66,29 @@ if (customReporter) {
|
|
|
53
66
|
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
54
67
|
*/
|
|
55
68
|
|
|
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
|
-
});
|
|
68
69
|
function getPlaywrightConfig() {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
70
|
+
const commonConfig = {
|
|
71
|
+
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
72
|
+
};
|
|
73
|
+
const dependencies = isAuthMode ? ['setup'] : [];
|
|
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
|
+
}
|
|
73
92
|
const playwrightConfig = {
|
|
74
93
|
testDir,
|
|
75
94
|
globalTimeout: globalTimeout || 3600000,
|
|
@@ -81,7 +100,16 @@ function getPlaywrightConfig() {
|
|
|
81
100
|
timeout: expectTimeout
|
|
82
101
|
},
|
|
83
102
|
use,
|
|
84
|
-
projects:
|
|
103
|
+
projects: isAuthMode ? [{
|
|
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],
|
|
85
113
|
...uatConfig
|
|
86
114
|
};
|
|
87
115
|
return playwrightConfig;
|
|
@@ -90,11 +90,9 @@ function main() {
|
|
|
90
90
|
// overriding the user config's from CLI
|
|
91
91
|
uatConfig.addAll(userArgConfig);
|
|
92
92
|
const modules = uatConfig.get('modules');
|
|
93
|
-
const tearDown = uatConfig.get('isTearDown');
|
|
94
93
|
|
|
95
94
|
//We need to change this process.env variable to pass the module name in future.
|
|
96
95
|
process.env.modules = modules;
|
|
97
|
-
process.env.tearDown = tearDown;
|
|
98
96
|
const {
|
|
99
97
|
isAuthMode,
|
|
100
98
|
editionOrder,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
delete require.cache[require.resolve('../core/playwright/runner/Runner')];
|
|
4
|
+
function test() {
|
|
5
|
+
const inputString = "@hc";
|
|
6
|
+
const selectedTag = ["@hc_1234"].reverse().find(tag => tag.startsWith(inputString));
|
|
7
|
+
let tagInput = null;
|
|
8
|
+
if (selectedTag) {
|
|
9
|
+
tagInput = selectedTag.split(`${inputString}_`).pop().toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
console.log(tagInput);
|
|
12
|
+
}
|
|
13
|
+
test();
|