@zohodesk/testinglibrary 0.4.79-n18-experimental → 0.4.81-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/build/common/searchFake/helpers/rpcRequestHelper.js +37 -0
- package/build/common/searchFake/steps/searchFake.spec.js +30 -0
- package/build/core/playwright/setup/config-creator.js +3 -2
- package/build/core/playwright/setup/config-utils.js +2 -3
- package/build/test/Test.js +13 -0
- package/npm-shrinkwrap.json +316 -336
- package/package.json +2 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _testinglibrary = require("@zohodesk/testinglibrary");
|
|
4
|
+
async function executeRpcRequest(page, payload) {
|
|
5
|
+
const url = new URL(page.url());
|
|
6
|
+
const baseUrl = `${url.protocol}//${url.host}`;
|
|
7
|
+
const invokeURL = `${baseUrl}/api/testing/acceptanceTest/rpc/invoke`;
|
|
8
|
+
try {
|
|
9
|
+
const response = await page.request.post(invokeURL, {
|
|
10
|
+
headers: {
|
|
11
|
+
'Content-Type': 'application/json'
|
|
12
|
+
},
|
|
13
|
+
data: payload
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok()) {
|
|
16
|
+
throw new Error(`HTTP ${response.status()}: ${response.statusText()}`);
|
|
17
|
+
}
|
|
18
|
+
const responseData = await response.json();
|
|
19
|
+
(0, _testinglibrary.expect)(responseData.data).toHaveProperty('status', 'success');
|
|
20
|
+
} catch (error) {
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function entityIdReConstructor(payload) {
|
|
25
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
26
|
+
throw new Error('Invalid payload. It must be a non-null object.');
|
|
27
|
+
}
|
|
28
|
+
if (!payload.arguments || typeof payload.arguments.entityId !== 'string') {
|
|
29
|
+
throw new Error('Invalid payload.arguments.entityId. It must be a non-empty string.');
|
|
30
|
+
}
|
|
31
|
+
payload.arguments.entityId = payload.arguments.entityId.split(',').map(id => id.trim());
|
|
32
|
+
return payload;
|
|
33
|
+
}
|
|
34
|
+
module.exports = {
|
|
35
|
+
executeRpcRequest,
|
|
36
|
+
entityIdReConstructor
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _testinglibrary = require("@zohodesk/testinglibrary");
|
|
4
|
+
var _rpcRequestHelper = require("../helpers/rpcRequestHelper");
|
|
5
|
+
const {
|
|
6
|
+
Given
|
|
7
|
+
} = (0, _testinglibrary.createBdd)();
|
|
8
|
+
Given('a search entity', async ({
|
|
9
|
+
page
|
|
10
|
+
}, dataTable) => {
|
|
11
|
+
const data = dataTable.hashes();
|
|
12
|
+
for (const row of data) {
|
|
13
|
+
const {
|
|
14
|
+
moduleName,
|
|
15
|
+
entityId,
|
|
16
|
+
searchString
|
|
17
|
+
} = row;
|
|
18
|
+
const payload = {
|
|
19
|
+
className: 'applicationDriver.rpc.desk.integrations.search.SearchFakeDataPopulator',
|
|
20
|
+
methodName: 'populateSearchData',
|
|
21
|
+
arguments: {
|
|
22
|
+
module: moduleName,
|
|
23
|
+
searchString: searchString,
|
|
24
|
+
entityId: entityId
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
await (0, _rpcRequestHelper.entityIdReConstructor)(payload);
|
|
28
|
+
await (0, _rpcRequestHelper.executeRpcRequest)(page, payload);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -75,7 +75,7 @@ function getPlaywrightConfig() {
|
|
|
75
75
|
function smokeTestConfig() {
|
|
76
76
|
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
77
77
|
featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
|
|
78
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '
|
|
78
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
79
79
|
outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
|
|
80
80
|
uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
|
|
81
81
|
});
|
|
@@ -85,7 +85,8 @@ function getPlaywrightConfig() {
|
|
|
85
85
|
use: {
|
|
86
86
|
...commonConfig
|
|
87
87
|
},
|
|
88
|
-
dependencies: dependencies
|
|
88
|
+
dependencies: dependencies,
|
|
89
|
+
retries: 0
|
|
89
90
|
}];
|
|
90
91
|
}
|
|
91
92
|
const playwrightConfig = {
|
|
@@ -153,7 +153,7 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
153
153
|
let moduleList = modules.split(',');
|
|
154
154
|
return getModulePathForFeatureFiles(moduleList);
|
|
155
155
|
}
|
|
156
|
-
return [_path.default.join(cwd, 'uat', '**', '*.feature')];
|
|
156
|
+
return [_path.default.join(cwd, 'uat', 'modules', '**', '*.feature')];
|
|
157
157
|
}
|
|
158
158
|
function getModulePathForFeatureFiles(moduleList) {
|
|
159
159
|
let validModuleList = [];
|
|
@@ -162,9 +162,8 @@ function getModulePathForFeatureFiles(moduleList) {
|
|
|
162
162
|
if ((0, _fileUtils.checkIfFolderExistsWithPattern)(modulePath)) {
|
|
163
163
|
validModuleList.push(_path.default.join(modulePath, '**', '*.feature'));
|
|
164
164
|
} else {
|
|
165
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Module ${moduleName} does not exist, Please check the module name`);
|
|
166
165
|
validModuleList = [];
|
|
167
|
-
|
|
166
|
+
throw new Error(`Module ${moduleName} does not exist. We have not triggered the execution for this module`);
|
|
168
167
|
}
|
|
169
168
|
});
|
|
170
169
|
return validModuleList;
|
|
@@ -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();
|