@zohodesk/testinglibrary 4.0.2 → 4.0.4
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/.gitlab-ci.yml +16 -14
- package/README.md +31 -0
- package/build/common/searchFake/steps/searchFake.spec.js +3 -3
- package/build/core/jest/setup/index.js +1 -1
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +1 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +11 -5
- package/build/core/playwright/helpers/thirdPartyLib.js +13 -0
- package/build/core/playwright/readConfigFile.js +10 -1
- package/build/test/Test.js +13 -0
- package/build/utils/fileUtils.js +1 -1
- package/package.json +26 -24
- package/npm-shrinkwrap.json +0 -11393
package/.gitlab-ci.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
image:
|
|
1
|
+
image: zdesk-auto13.csez.zohocorpin.com/long-term-storage/node18-npm10:v2
|
|
2
2
|
|
|
3
3
|
workflow:
|
|
4
4
|
rules:
|
|
@@ -188,19 +188,21 @@ uat-data_generator:
|
|
|
188
188
|
paths:
|
|
189
189
|
- examples/uat/playwright-report
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
191
|
+
uat-search_indexing:
|
|
192
|
+
stage: uat
|
|
193
|
+
script:
|
|
194
|
+
- cd examples
|
|
195
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
196
|
+
- echo "Removing jsonpath from examples/node_modules to avoid conflicts"
|
|
197
|
+
- rm -rf node_modules/jsonpath || true
|
|
198
|
+
- output=$(npm run uat-search_indexing)
|
|
199
|
+
- echo "$output"
|
|
200
|
+
- node ../ValidateUATReport.js examples
|
|
201
|
+
|
|
202
|
+
artifacts:
|
|
203
|
+
when: always
|
|
204
|
+
paths:
|
|
205
|
+
- examples/uat/playwright-report
|
|
204
206
|
|
|
205
207
|
|
|
206
208
|
|
package/README.md
CHANGED
|
@@ -17,6 +17,37 @@
|
|
|
17
17
|
|
|
18
18
|
- npm run report
|
|
19
19
|
|
|
20
|
+
### v4.0.4/v3.2.20 - 19-12-2025
|
|
21
|
+
|
|
22
|
+
#### Enhancement
|
|
23
|
+
- New common step provided for search index with the data generated entity
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### v4.0.3/v3.2.19 - 17-12-2025
|
|
27
|
+
|
|
28
|
+
#### Enhancement
|
|
29
|
+
- Cookie storage prefix support is provided in this version.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### v4.0.2 - 16-12-2025
|
|
33
|
+
|
|
34
|
+
#### Bug Fixes
|
|
35
|
+
|
|
36
|
+
- Deprecated the react and react hooks from dependencies
|
|
37
|
+
- @cucumber/cucumber - 10.9.0 version downgraded due to Missing Step Definition Issue
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### v4.0.0 - 04-12-2025
|
|
41
|
+
|
|
42
|
+
#### Features
|
|
43
|
+
- Supported node 20 for the testing-framework
|
|
44
|
+
|
|
45
|
+
- Below package versions are updated in this release.
|
|
46
|
+
- playwright - 1.56.1,
|
|
47
|
+
- playwright-bdd - 8.4.2,
|
|
48
|
+
- @playwright/test - 1.56.1,
|
|
49
|
+
- @cucumber/cucumber - 12.2.0
|
|
50
|
+
|
|
20
51
|
### v3.2.15 - 14-11-2025
|
|
21
52
|
|
|
22
53
|
#### Enhancement
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {createBdd
|
|
1
|
+
import {createBdd} from '@zohodesk/testinglibrary';
|
|
2
|
+
import { jsonpath } from '@zohodesk/testinglibrary/thirdPartyHelper';
|
|
2
3
|
import { executeRpcRequest , entityIdReConstructor } from '../helpers/rpcRequestHelper';
|
|
3
|
-
// import jp from 'jsonpath';
|
|
4
4
|
|
|
5
5
|
const { Given } = createBdd();
|
|
6
6
|
|
|
@@ -54,7 +54,7 @@ Given('a search entity using {string}', async ({page,cacheLayer}, reference,data
|
|
|
54
54
|
entityIdValue = searchObj;
|
|
55
55
|
} else {
|
|
56
56
|
const jsonPath = searchEntity?.startsWith?.('$') ? searchEntity : `$.${searchEntity}`;
|
|
57
|
-
const result =
|
|
57
|
+
const result = jsonpath.query(searchObj, jsonPath);
|
|
58
58
|
|
|
59
59
|
if (!result || result.length === 0) {
|
|
60
60
|
throw new Error(`JSONPath query '${jsonPath}' returned no results from cache object for reference: ${reference}`);
|
|
@@ -41,6 +41,7 @@ async function executeDefaultLoginSteps(context, testInfo, testDetails, testPort
|
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
43
|
const projectName = testInfo.project.name;
|
|
44
|
+
testDetails.authFilePrefix = process.env.authFilePrefix;
|
|
44
45
|
if (testPortalDetails && projectName !== 'setup' && projectName !== 'cleanup') {
|
|
45
46
|
await context.clearCookies();
|
|
46
47
|
await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
|
|
@@ -18,14 +18,20 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
18
18
|
authFilePrefix,
|
|
19
19
|
email
|
|
20
20
|
} = testInfo;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
let authFileName;
|
|
22
|
+
if (authFilePrefix) {
|
|
23
|
+
authFileName = `${authFilePrefix}-${email}`;
|
|
24
|
+
process.env.authFilePrefix = authFilePrefix;
|
|
25
|
+
} else {
|
|
26
|
+
authFileName = `${email}`;
|
|
27
|
+
}
|
|
28
|
+
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFileName}-cookies.json`));
|
|
29
|
+
const lockFileName = `${authFileName}`.replace(/[@.]/g, '_');
|
|
24
30
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.fileDeletionTimeoutConfig);
|
|
25
31
|
let loginUsingCookie = false;
|
|
26
32
|
try {
|
|
27
33
|
if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
|
|
28
|
-
console.log(`${
|
|
34
|
+
console.log(`${authFileName} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
29
35
|
loginUsingCookie = true;
|
|
30
36
|
} else {
|
|
31
37
|
await fileMutex.acquire();
|
|
@@ -40,7 +46,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
40
46
|
});
|
|
41
47
|
}
|
|
42
48
|
} catch (error) {
|
|
43
|
-
console.error(`Error during login for ${
|
|
49
|
+
console.error(`Error during login for ${authFileName}:`, error);
|
|
44
50
|
} finally {
|
|
45
51
|
if (!loginUsingCookie) {
|
|
46
52
|
await fileMutex.release();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "jsonpath", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _jsonpath.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _jsonpath = _interopRequireDefault(require("jsonpath"));
|
|
@@ -16,7 +16,16 @@ 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 _auth = require("./helpers/auth");
|
|
19
20
|
let cachedConfig = null;
|
|
21
|
+
function getPrimaryCookiePath() {
|
|
22
|
+
const {
|
|
23
|
+
email
|
|
24
|
+
} = (0, _auth.getDefaultActor)();
|
|
25
|
+
const authFilePrefix = process.env.authFilePrefix;
|
|
26
|
+
let authFileName = authFilePrefix ? `${authFilePrefix}-${email}` : `${email}`;
|
|
27
|
+
return `uat/playwright/.auth/${authFileName}-cookies.json`;
|
|
28
|
+
}
|
|
20
29
|
function getDefaultConfig() {
|
|
21
30
|
return {
|
|
22
31
|
isTearDown: true,
|
|
@@ -33,7 +42,7 @@ function getDefaultConfig() {
|
|
|
33
42
|
bddMode: false,
|
|
34
43
|
expectTimeout: 5 * 1000,
|
|
35
44
|
testTimeout: 60 * 1000,
|
|
36
|
-
authFilePath:
|
|
45
|
+
authFilePath: getPrimaryCookiePath(),
|
|
37
46
|
viewport: {
|
|
38
47
|
width: 1280,
|
|
39
48
|
height: 720
|
|
@@ -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();
|
package/build/utils/fileUtils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,29 +15,30 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": "./build/index.js",
|
|
17
17
|
"./helpers": "./build/core/playwright/helpers/auth/index.js",
|
|
18
|
-
"./DataGenerator": "./build/core/dataGenerator/DataGenerator.js"
|
|
18
|
+
"./DataGenerator": "./build/core/dataGenerator/DataGenerator.js",
|
|
19
|
+
"./thirdPartyHelper": "./build/core/playwright/helpers/thirdPartyLib.js"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [],
|
|
21
22
|
"author": "",
|
|
22
23
|
"license": "ISC",
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@babel/code-frame": "7.27.1",
|
|
25
|
-
"@babel/preset-react": "7.
|
|
26
|
-
"@cucumber/cucumber": "
|
|
27
|
-
"@playwright/test": "1.
|
|
28
|
-
"@reportportal/agent-js-playwright": "5.
|
|
29
|
-
"@testing-library/jest-dom": "
|
|
30
|
-
"babel-jest": "
|
|
26
|
+
"@babel/preset-react": "7.22.5",
|
|
27
|
+
"@cucumber/cucumber": "11.3.0",
|
|
28
|
+
"@playwright/test": "1.53.2",
|
|
29
|
+
"@reportportal/agent-js-playwright": "5.1.11",
|
|
30
|
+
"@testing-library/jest-dom": "5.11.9",
|
|
31
|
+
"babel-jest": "29.6.2",
|
|
31
32
|
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
32
|
-
"fast-glob": "3.3.
|
|
33
|
-
"jest": "
|
|
34
|
-
"jest-environment-jsdom": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"playwright": "
|
|
38
|
-
"playwright-bdd": "8.4.2",
|
|
33
|
+
"fast-glob": "3.3.1",
|
|
34
|
+
"jest": "29.6.2",
|
|
35
|
+
"jest-environment-jsdom": "29.6.2",
|
|
36
|
+
"msw": "1.2.3",
|
|
37
|
+
"playwright": "1.53.2",
|
|
38
|
+
"playwright-bdd": "8.3.1",
|
|
39
39
|
"properties-reader": "2.3.0",
|
|
40
|
-
"supports-color": "
|
|
40
|
+
"supports-color": "8.1.1",
|
|
41
|
+
"jsonpath": "^1.1.1"
|
|
41
42
|
},
|
|
42
43
|
"bin": {
|
|
43
44
|
"ZDTestingFramework": "./bin/cli.js"
|
|
@@ -48,13 +49,14 @@
|
|
|
48
49
|
"react-dom": "*"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@babel/cli": "7.
|
|
52
|
-
"@babel/core": "7.
|
|
53
|
-
"@babel/node": "7.
|
|
54
|
-
"@babel/plugin-transform-runtime": "7.
|
|
55
|
-
"@babel/
|
|
56
|
-
"@babel/
|
|
57
|
-
"
|
|
58
|
-
"
|
|
52
|
+
"@babel/cli": "7.22.15",
|
|
53
|
+
"@babel/core": "7.22.17",
|
|
54
|
+
"@babel/node": "7.22.15",
|
|
55
|
+
"@babel/plugin-transform-runtime": "7.22.15",
|
|
56
|
+
"@babel/polyfill": "7.12.1",
|
|
57
|
+
"@babel/preset-env": "7.22.15",
|
|
58
|
+
"@babel/runtime": "7.22.15",
|
|
59
|
+
"commander": "11.0.0",
|
|
60
|
+
"jest-html-reporter": "3.10.2"
|
|
59
61
|
}
|
|
60
62
|
}
|