@zohodesk/testinglibrary 0.4.45-experimental → 0.4.46-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/.gitlab-ci.yml +12 -20
- package/build/core/playwright/builtInFixtures/page.js +46 -64
- package/build/core/playwright/constants/fileMutexConfig.js +3 -3
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/helpers/auth/loginSteps.js +14 -17
- package/build/core/playwright/helpers/fileMutex.js +2 -2
- package/build/core/playwright/tagProcessor.js +7 -5
- package/build/core/playwright/test-runner.js +1 -1
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +19 -18
- package/package.json +4 -4
- package/unit_reports/unit-report.html +260 -0
- package/nobdd/README.md +0 -1
- package/nobdd/package.json +0 -17
- package/nobdd/src/App.js +0 -7
- package/nobdd/uat/conf/default/actors/editions/enterprise.json +0 -24
- package/nobdd/uat/conf/default/actors/editions/index.js +0 -4
- package/nobdd/uat/conf/default/actors/index.js +0 -2
- package/nobdd/uat/conf/default/settings.json +0 -6
- package/nobdd/uat/conf/nobdd/uat.config.js +0 -36
- package/nobdd/uat/env-config.json +0 -20
- package/nobdd/uat/fixtures/auth.setup.js +0 -44
- package/nobdd/uat/fixtures/setup.teardown.js +0 -33
- package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +0 -16
- package/nobdd/uat/shared/commands/_index-custom-fixtures.js +0 -9
- package/nobdd/uat/shared/commands/i18n.js +0 -25
- package/nobdd/uat/shared/commands/unauthenticatedPage.js +0 -8
- package/nobdd/uat/shared/index.js +0 -7
- package/nobdd/uat/shared/onboardings/onboardingUpdate.js +0 -44
- package/nobdd/uat/shared/url-helpers/getUrlOrigin.js +0 -6
- package/nobdd/uat.config.js +0 -37
- package/npm-shrinkwrap.json +0 -6524
package/.gitlab-ci.yml
CHANGED
|
@@ -14,18 +14,23 @@ stages:
|
|
|
14
14
|
|
|
15
15
|
default:
|
|
16
16
|
cache:
|
|
17
|
-
key: build-cache
|
|
17
|
+
key: node14-build-cache
|
|
18
18
|
paths:
|
|
19
19
|
- node_modules
|
|
20
20
|
- build
|
|
21
|
+
- npm-shrinkwrap.json
|
|
21
22
|
|
|
22
23
|
# Install dependencies stage
|
|
23
24
|
build:
|
|
24
25
|
stage: build
|
|
25
26
|
script:
|
|
27
|
+
- npm -v
|
|
28
|
+
- node -v
|
|
26
29
|
- npm install --ignore-scripts
|
|
27
30
|
- npm run build
|
|
28
31
|
- npm install
|
|
32
|
+
- npm shrinkwrap
|
|
33
|
+
- npm run build
|
|
29
34
|
|
|
30
35
|
# Unit tests stage
|
|
31
36
|
unit:
|
|
@@ -45,9 +50,7 @@ uat-auth:
|
|
|
45
50
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
46
51
|
- output=$(npm run uatauth)
|
|
47
52
|
- echo "$output"
|
|
48
|
-
-
|
|
49
|
-
- exit 1
|
|
50
|
-
- fi
|
|
53
|
+
- node ../ValidateUATReport.js examples
|
|
51
54
|
|
|
52
55
|
artifacts:
|
|
53
56
|
when: always
|
|
@@ -61,9 +64,7 @@ uat-noauth:
|
|
|
61
64
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
62
65
|
- output=$(npm run uatnoauth)
|
|
63
66
|
- echo "$output"
|
|
64
|
-
-
|
|
65
|
-
- exit 1
|
|
66
|
-
- fi
|
|
67
|
+
- node ../ValidateUATReport.js examples
|
|
67
68
|
|
|
68
69
|
artifacts:
|
|
69
70
|
when: always
|
|
@@ -77,9 +78,7 @@ uat-profile:
|
|
|
77
78
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
78
79
|
- output=$(npm run uatprofile)
|
|
79
80
|
- echo "$output"
|
|
80
|
-
-
|
|
81
|
-
- exit 1
|
|
82
|
-
- fi
|
|
81
|
+
- node ../ValidateUATReport.js examples
|
|
83
82
|
|
|
84
83
|
artifacts:
|
|
85
84
|
when: always
|
|
@@ -89,17 +88,12 @@ uat-profile:
|
|
|
89
88
|
|
|
90
89
|
uat-unauth:
|
|
91
90
|
stage: uat
|
|
92
|
-
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v2
|
|
93
91
|
script:
|
|
94
|
-
- npm install
|
|
95
|
-
- npm run build
|
|
96
92
|
- cd examples
|
|
97
93
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
98
94
|
- output=$(npm run uatunauth)
|
|
99
95
|
- echo "$output"
|
|
100
|
-
-
|
|
101
|
-
- exit 1
|
|
102
|
-
- fi
|
|
96
|
+
- node ../ValidateUATReport.js examples
|
|
103
97
|
|
|
104
98
|
|
|
105
99
|
artifacts:
|
|
@@ -112,11 +106,9 @@ uat-nobdd:
|
|
|
112
106
|
script:
|
|
113
107
|
- cd nobdd
|
|
114
108
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
115
|
-
- output=$(npm run uatnobdd)
|
|
109
|
+
- output=$(npm run uatnobdd -- --headless)
|
|
116
110
|
- echo "$output"
|
|
117
|
-
-
|
|
118
|
-
- exit 1
|
|
119
|
-
- fi
|
|
111
|
+
- node ../ValidateUATReport.js nobdd
|
|
120
112
|
|
|
121
113
|
|
|
122
114
|
artifacts:
|
|
@@ -1,12 +1,10 @@
|
|
|
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
7
|
var _auth = require("../helpers/auth");
|
|
9
|
-
var _getUrlOrigin = _interopRequireDefault(require("../helpers/auth/getUrlOrigin"));
|
|
10
8
|
var _readConfigFile = require("../readConfigFile");
|
|
11
9
|
/* eslint-disable global-require */
|
|
12
10
|
|
|
@@ -29,84 +27,68 @@ function getCustomAccountDetails(tags) {
|
|
|
29
27
|
const user = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
|
|
30
28
|
return user;
|
|
31
29
|
}
|
|
32
|
-
return
|
|
30
|
+
return (0, _auth.getDefaultActor)();
|
|
33
31
|
}
|
|
34
32
|
const {
|
|
35
33
|
testSetup
|
|
36
34
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
37
|
-
async function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
await testSetup.page({
|
|
44
|
-
context,
|
|
45
|
-
$tags,
|
|
46
|
-
page
|
|
47
|
-
});
|
|
35
|
+
async function loginSteps(pageDetail) {
|
|
36
|
+
const {
|
|
37
|
+
page
|
|
38
|
+
} = pageDetail;
|
|
39
|
+
if (testSetup.loginSteps && typeof testSetup.loginSteps === 'function') {
|
|
40
|
+
return await testSetup.loginSteps(pageDetail);
|
|
48
41
|
} else {
|
|
49
42
|
await page.goto(process.env.domain);
|
|
50
43
|
}
|
|
51
44
|
}
|
|
52
|
-
async function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
async function performDefaultPageSteps(testInfo) {
|
|
46
|
+
if (testSetup.page && typeof testSetup.page === 'function') {
|
|
47
|
+
await testSetup.page(testInfo);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function verifyPageIsLoaded(testInfo) {
|
|
51
|
+
if (testSetup.validateLogin && typeof testSetup.validateLogin === 'function') {
|
|
52
|
+
return await testSetup.validateLogin(testInfo);
|
|
57
53
|
}
|
|
58
|
-
return
|
|
54
|
+
return true;
|
|
59
55
|
}
|
|
60
56
|
var _default = exports.default = {
|
|
61
57
|
page: async ({
|
|
62
58
|
context,
|
|
63
59
|
$tags,
|
|
64
60
|
page
|
|
65
|
-
}, use) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
const testPortalDetails = getCustomAccountDetails($tags);
|
|
81
|
-
if (testPortalDetails === null) {
|
|
82
|
-
await performDefaultPageSteps({
|
|
83
|
-
context,
|
|
84
|
-
$tags,
|
|
85
|
-
page
|
|
86
|
-
});
|
|
87
|
-
const user = (0, _auth.getDefaultActor)();
|
|
88
|
-
process.env.actorInfo = JSON.stringify(user);
|
|
89
|
-
await use(page);
|
|
90
|
-
} else {
|
|
91
|
-
await context.clearCookies();
|
|
61
|
+
}, use, testInfo) => {
|
|
62
|
+
let testPortalDetails = getCustomAccountDetails($tags);
|
|
63
|
+
let testDetails = {
|
|
64
|
+
page,
|
|
65
|
+
$tags,
|
|
66
|
+
context,
|
|
67
|
+
...testPortalDetails
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
//This block is used to skip the login process if the @unauthenticated tag is added to the script
|
|
71
|
+
if ($tags.includes('@unauthenticated')) {
|
|
72
|
+
await context.clearCookies();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
92
75
|
const {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
76
|
+
isAuthMode
|
|
77
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
78
|
+
if (!isAuthMode) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (testPortalDetails && testInfo.project.name !== 'setup') {
|
|
82
|
+
await context.clearCookies();
|
|
83
|
+
await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
|
|
84
|
+
return await verifyPageIsLoaded(testInfo);
|
|
85
|
+
}, loginSteps);
|
|
86
|
+
process.env.actorInfo = JSON.stringify(testPortalDetails);
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error('Error during page', e);
|
|
90
|
+
} finally {
|
|
91
|
+
await performDefaultPageSteps(testDetails);
|
|
110
92
|
await use(page);
|
|
111
93
|
await context.close();
|
|
112
94
|
}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.LOGIN_MUTEX_TIMEOUT = void 0;
|
|
7
7
|
const LOGIN_MUTEX_TIMEOUT = exports.LOGIN_MUTEX_TIMEOUT = {
|
|
8
|
-
stale:
|
|
8
|
+
stale: 30000,
|
|
9
9
|
retries: {
|
|
10
|
-
retries:
|
|
10
|
+
retries: 15,
|
|
11
11
|
factor: 1,
|
|
12
|
-
minTimeout:
|
|
12
|
+
minTimeout: 2000
|
|
13
13
|
}
|
|
14
14
|
};
|
|
@@ -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'];
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless'];
|
|
@@ -9,45 +9,42 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
var _fs = require("fs");
|
|
10
10
|
var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
11
11
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
12
|
-
var _accountLogin = _interopRequireDefault(require("./accountLogin"));
|
|
13
12
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
14
13
|
var _checkAuthDirectory = require("../checkAuthDirectory");
|
|
15
14
|
/* eslint-disable no-console */
|
|
16
15
|
|
|
17
|
-
async function performLoginSteps({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
16
|
+
async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
17
|
+
let {
|
|
18
|
+
page,
|
|
19
|
+
authFilePrefix,
|
|
20
|
+
email
|
|
21
|
+
} = testInfo;
|
|
22
|
+
authFilePrefix = authFilePrefix || email;
|
|
23
23
|
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
|
|
24
|
-
const lockFileName =
|
|
24
|
+
const lockFileName = email.replace(/[@.]/g, '_');
|
|
25
25
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
|
|
26
26
|
try {
|
|
27
27
|
await fileMutex.acquire();
|
|
28
28
|
if ((0, _fs.existsSync)(authFile)) {
|
|
29
|
-
console.log(`[DEBUG] Cookies file already exists for ${
|
|
29
|
+
console.log(`[DEBUG] Cookies file already exists for ${lockFileName}. Loading cookies.`);
|
|
30
30
|
await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
|
|
31
31
|
} else {
|
|
32
|
-
await
|
|
33
|
-
await Promise.race([page.waitForNavigation(), page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]);
|
|
34
|
-
const isAlreadyLoggedIn = await isLoggedIn(page);
|
|
32
|
+
const isAlreadyLoggedIn = await isLoggedIn(testInfo);
|
|
35
33
|
if (!isAlreadyLoggedIn) {
|
|
36
|
-
await (
|
|
37
|
-
await
|
|
38
|
-
await isLoggedIn(page);
|
|
34
|
+
await loginSteps(testInfo);
|
|
35
|
+
await isLoggedIn(testInfo);
|
|
39
36
|
await page.context().storageState({
|
|
40
37
|
path: authFile
|
|
41
38
|
});
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
} catch (error) {
|
|
45
|
-
console.error(`Error during login for ${
|
|
42
|
+
console.error(`Error during login for ${email}:`, error);
|
|
46
43
|
} finally {
|
|
47
44
|
try {
|
|
48
45
|
await fileMutex.release();
|
|
49
46
|
} catch (releaseError) {
|
|
50
|
-
console.error(`Error releasing lock for ${
|
|
47
|
+
console.error(`Error releasing lock for ${email}:`, releaseError);
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
}
|
|
@@ -23,13 +23,13 @@ class FileMutex {
|
|
|
23
23
|
}
|
|
24
24
|
async acquire() {
|
|
25
25
|
_classPrivateMethodGet(this, _createDirectoryIfNotExist, _createDirectoryIfNotExist2).call(this);
|
|
26
|
-
const lockFilePath =
|
|
26
|
+
const lockFilePath = _classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this);
|
|
27
27
|
try {
|
|
28
28
|
if (!(0, _fs.existsSync)(lockFilePath)) {
|
|
29
29
|
console.log(`[DEBUG] Creating missing lock file:`, this.lockFileName);
|
|
30
30
|
(0, _fs.writeFileSync)(lockFilePath, 'locked');
|
|
31
31
|
}
|
|
32
|
-
await _properLockfile.default.lock(
|
|
32
|
+
await _properLockfile.default.lock(lockFilePath, this.options);
|
|
33
33
|
} catch (err) {
|
|
34
34
|
throw new Error(`Failed to acquire lock after ${this.options.retries.retries} attempts: ${err.message}`);
|
|
35
35
|
}
|
|
@@ -20,12 +20,14 @@ class TagProcessor {
|
|
|
20
20
|
_classPrivateMethodInitSpec(this, _buildTagsString);
|
|
21
21
|
this.editionOrder = editionOrder;
|
|
22
22
|
}
|
|
23
|
-
processTags(
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
processTags(config) {
|
|
24
|
+
const {
|
|
25
|
+
tags,
|
|
26
|
+
edition
|
|
27
|
+
} = config.getAll();
|
|
28
|
+
if (!edition) return tags;
|
|
27
29
|
const editionsArray = edition.split(',');
|
|
28
|
-
const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0],
|
|
30
|
+
const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0], tags) : _classPrivateMethodGet(this, _processMultipleEditions, _processMultipleEditions2).call(this, editionsArray, tags);
|
|
29
31
|
return editionTags;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -104,7 +104,7 @@ function main() {
|
|
|
104
104
|
//This is only used for pass the user arguments to need places in legacy code. We need to rewamp that also.
|
|
105
105
|
const userArgsObject = userArgConfig.getAll();
|
|
106
106
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
107
|
-
const tagArgs = tagProcessor.processTags(
|
|
107
|
+
const tagArgs = tagProcessor.processTags(uatConfig);
|
|
108
108
|
const runnerObj = new _Runner.default();
|
|
109
109
|
runnerObj.setTagArgs(tagArgs);
|
|
110
110
|
runnerObj.setUserArgs(userArgsObject);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _tagProcessor = _interopRequireDefault(require("../../../../../src/core/playwright/tagProcessor"));
|
|
5
|
+
var _Configuration = _interopRequireDefault(require("../../../../../src/core/playwright/configuration/Configuration.js"));
|
|
5
6
|
var _logger = require("../../../../utils/logger");
|
|
6
7
|
jest.mock('../../../../utils/logger');
|
|
7
8
|
describe('TagProcessor', () => {
|
|
@@ -11,83 +12,83 @@ describe('TagProcessor', () => {
|
|
|
11
12
|
});
|
|
12
13
|
test('should return tagArgs if no edition is provided', () => {
|
|
13
14
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
14
|
-
const userArgs = {
|
|
15
|
+
const userArgs = new _Configuration.default({
|
|
15
16
|
tags: 'tag1',
|
|
16
17
|
edition: null
|
|
17
|
-
};
|
|
18
|
+
});
|
|
18
19
|
const result = tagProcessor.processTags(userArgs);
|
|
19
20
|
expect(result).toBe('tag1');
|
|
20
21
|
});
|
|
21
22
|
test('should handle a single edition with <= operator', () => {
|
|
22
23
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
23
|
-
const userArgs = {
|
|
24
|
+
const userArgs = new _Configuration.default({
|
|
24
25
|
tags: 'tag1',
|
|
25
26
|
edition: '<=edition2'
|
|
26
|
-
};
|
|
27
|
+
});
|
|
27
28
|
const result = tagProcessor.processTags(userArgs);
|
|
28
29
|
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
29
30
|
});
|
|
30
31
|
test('should handle a single edition with >= operator', () => {
|
|
31
32
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
32
|
-
const userArgs = {
|
|
33
|
+
const userArgs = new _Configuration.default({
|
|
33
34
|
tags: 'tag1',
|
|
34
35
|
edition: '>=edition2'
|
|
35
|
-
};
|
|
36
|
+
});
|
|
36
37
|
const result = tagProcessor.processTags(userArgs);
|
|
37
38
|
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
38
39
|
});
|
|
39
40
|
test('should handle a single edition with < operator', () => {
|
|
40
41
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
41
|
-
const userArgs = {
|
|
42
|
+
const userArgs = new _Configuration.default({
|
|
42
43
|
tags: 'tag1',
|
|
43
44
|
edition: '<edition3'
|
|
44
|
-
};
|
|
45
|
+
});
|
|
45
46
|
const result = tagProcessor.processTags(userArgs);
|
|
46
47
|
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
47
48
|
});
|
|
48
49
|
test('should handle a single edition with > operator', () => {
|
|
49
50
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
50
|
-
const userArgs = {
|
|
51
|
+
const userArgs = new _Configuration.default({
|
|
51
52
|
tags: 'tag1',
|
|
52
53
|
edition: '>edition1'
|
|
53
|
-
};
|
|
54
|
+
});
|
|
54
55
|
const result = tagProcessor.processTags(userArgs);
|
|
55
56
|
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
56
57
|
});
|
|
57
58
|
test('should handle a single edition with no operator', () => {
|
|
58
59
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
59
|
-
const userArgs = {
|
|
60
|
+
const userArgs = new _Configuration.default({
|
|
60
61
|
tags: 'tag1',
|
|
61
62
|
edition: 'edition2'
|
|
62
|
-
};
|
|
63
|
+
});
|
|
63
64
|
const result = tagProcessor.processTags(userArgs);
|
|
64
65
|
expect(result).toBe('tag1 and not (@edition_edition1 or @edition_edition3 or @edition_edition4)');
|
|
65
66
|
});
|
|
66
67
|
test('should log a message if edition is not found', () => {
|
|
67
68
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
68
|
-
const userArgs = {
|
|
69
|
+
const userArgs = new _Configuration.default({
|
|
69
70
|
tags: 'tag1',
|
|
70
71
|
edition: 'nonexistentEdition'
|
|
71
|
-
};
|
|
72
|
+
});
|
|
72
73
|
const result = tagProcessor.processTags(userArgs);
|
|
73
74
|
expect(result).toBe('tag1');
|
|
74
75
|
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.INFO_TYPE, expect.stringContaining('No matching editions for nonexistentEdition found.'));
|
|
75
76
|
});
|
|
76
77
|
test('should handle multiple editions', () => {
|
|
77
78
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
78
|
-
const userArgs = {
|
|
79
|
+
const userArgs = new _Configuration.default({
|
|
79
80
|
tags: 'tag1',
|
|
80
81
|
edition: 'edition1,edition3'
|
|
81
|
-
};
|
|
82
|
+
});
|
|
82
83
|
const result = tagProcessor.processTags(userArgs);
|
|
83
84
|
expect(result).toBe('tag1 and not (@edition_edition2 or @edition_edition4)');
|
|
84
85
|
});
|
|
85
86
|
test('should build tags correctly when tags are empty', () => {
|
|
86
87
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
87
|
-
const userArgs = {
|
|
88
|
+
const userArgs = new _Configuration.default({
|
|
88
89
|
tags: '',
|
|
89
90
|
edition: 'edition1'
|
|
90
|
-
};
|
|
91
|
+
});
|
|
91
92
|
const result = tagProcessor.processTags(userArgs);
|
|
92
93
|
expect(result).toBe('not (@edition_edition2 or @edition_edition3 or @edition_edition4)');
|
|
93
94
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.46-experimental",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@babel/polyfill": "7.12.1",
|
|
54
54
|
"@babel/preset-env": "7.22.15",
|
|
55
55
|
"@babel/runtime": "7.22.15",
|
|
56
|
-
"commander": "
|
|
57
|
-
"jest-html-reporter": "
|
|
58
|
-
"typescript": "
|
|
56
|
+
"commander": "11.0.0",
|
|
57
|
+
"jest-html-reporter": "3.10.2",
|
|
58
|
+
"typescript": "5.4.2"
|
|
59
59
|
}
|
|
60
60
|
}
|