@zohodesk/testinglibrary 0.4.44-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/build/bdd-framework/cucumber/formatter/EventDataCollector.js +1 -1
- package/build/bdd-framework/reporter/cucumber/json.js +1 -1
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +1 -1
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +1 -1
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +1 -1
- package/build/core/playwright/constants/fileMutexConfig.js +3 -4
- package/build/core/playwright/helpers/auth/loginSteps.js +13 -8
- package/build/core/playwright/helpers/fileMutex.js +12 -10
- package/build/core/playwright/tagProcessor.js +28 -18
- package/package.json +2 -3
- package/npm-shrinkwrap.json +0 -6684
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var messages = _interopRequireWildcard(require("@cucumber/messages"));
|
|
8
8
|
var _valueChecker = require("../valueChecker");
|
|
9
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
11
|
/**
|
|
12
12
|
* Groups Cucumber messages for easier access.
|
|
13
13
|
* Based on Cucumber, with some changes due to strictNullChecks errors.
|
|
@@ -16,7 +16,7 @@ var _locationHelpers = require("../../cucumber/formatter/locationHelpers");
|
|
|
16
16
|
var _GherkinDocument = require("./messagesBuilder/GherkinDocument");
|
|
17
17
|
var _Projects = require("./messagesBuilder/Projects");
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
20
|
/**
|
|
21
21
|
* Cucumber json reporter.
|
|
22
22
|
* Based on: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/json_formatter.ts
|
|
@@ -9,7 +9,7 @@ var _os = _interopRequireDefault(require("os"));
|
|
|
9
9
|
var messages = _interopRequireWildcard(require("@cucumber/messages"));
|
|
10
10
|
var _utils = require("../../../utils");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
/**
|
|
14
14
|
* Builds meta message.
|
|
15
15
|
* See: https://github.com/cucumber/cucumber-js/blob/main/src/cli/helpers.ts#L100
|
|
@@ -9,7 +9,7 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
9
9
|
var messages = _interopRequireWildcard(require("@cucumber/messages"));
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
/**
|
|
14
14
|
* Class for getting attachment messages for a particular step.
|
|
15
15
|
*/
|
|
@@ -9,7 +9,7 @@ var _stripAnsiEscapes = require("../../../utils/stripAnsiEscapes");
|
|
|
9
9
|
var _timing = require("./timing");
|
|
10
10
|
var _TestStepAttachments = require("./TestStepAttachments");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
class TestStepRun {
|
|
14
14
|
testCaseRun;
|
|
15
15
|
testStep;
|
|
@@ -5,11 +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:
|
|
13
|
-
maxTimeout: 20000
|
|
12
|
+
minTimeout: 2000
|
|
14
13
|
}
|
|
15
14
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _fs = require("fs");
|
|
9
10
|
var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
10
11
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
11
12
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
@@ -24,14 +25,18 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
24
25
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
|
|
25
26
|
try {
|
|
26
27
|
await fileMutex.acquire();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
await isLoggedIn(testInfo);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if ((0, _fs.existsSync)(authFile)) {
|
|
29
|
+
console.log(`[DEBUG] Cookies file already exists for ${lockFileName}. Loading cookies.`);
|
|
30
|
+
await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
|
|
31
|
+
} else {
|
|
32
|
+
const isAlreadyLoggedIn = await isLoggedIn(testInfo);
|
|
33
|
+
if (!isAlreadyLoggedIn) {
|
|
34
|
+
await loginSteps(testInfo);
|
|
35
|
+
await isLoggedIn(testInfo);
|
|
36
|
+
await page.context().storageState({
|
|
37
|
+
path: authFile
|
|
38
|
+
});
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
} catch (error) {
|
|
37
42
|
console.error(`Error during login for ${email}:`, error);
|
|
@@ -8,20 +8,22 @@ exports.default = void 0;
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _properLockfile = _interopRequireDefault(require("proper-lockfile"));
|
|
10
10
|
var _fs = require("fs");
|
|
11
|
-
function _classPrivateMethodInitSpec(
|
|
12
|
-
function _checkPrivateRedeclaration(
|
|
13
|
-
function
|
|
14
|
-
var
|
|
11
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
12
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
13
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
14
|
+
var _getLockFilePath = /*#__PURE__*/new WeakSet();
|
|
15
|
+
var _createDirectoryIfNotExist = /*#__PURE__*/new WeakSet();
|
|
15
16
|
class FileMutex {
|
|
16
17
|
constructor(directory, lockFileName, options = {}) {
|
|
17
|
-
_classPrivateMethodInitSpec(this,
|
|
18
|
+
_classPrivateMethodInitSpec(this, _createDirectoryIfNotExist);
|
|
19
|
+
_classPrivateMethodInitSpec(this, _getLockFilePath);
|
|
18
20
|
this.directory = directory;
|
|
19
21
|
this.lockFileName = lockFileName + ".lock";
|
|
20
22
|
this.options = options;
|
|
21
23
|
}
|
|
22
24
|
async acquire() {
|
|
23
|
-
|
|
24
|
-
const lockFilePath =
|
|
25
|
+
_classPrivateMethodGet(this, _createDirectoryIfNotExist, _createDirectoryIfNotExist2).call(this);
|
|
26
|
+
const lockFilePath = _classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this);
|
|
25
27
|
try {
|
|
26
28
|
if (!(0, _fs.existsSync)(lockFilePath)) {
|
|
27
29
|
console.log(`[DEBUG] Creating missing lock file:`, this.lockFileName);
|
|
@@ -34,16 +36,16 @@ class FileMutex {
|
|
|
34
36
|
}
|
|
35
37
|
async release() {
|
|
36
38
|
try {
|
|
37
|
-
await _properLockfile.default.unlock(
|
|
39
|
+
await _properLockfile.default.unlock(_classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this));
|
|
38
40
|
} catch (err) {
|
|
39
41
|
throw new Error(`Failed to release lock: ${err.message}`);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
function
|
|
45
|
+
function _getLockFilePath2() {
|
|
44
46
|
return _path.default.resolve(_path.default.join(this.directory, this.lockFileName));
|
|
45
47
|
}
|
|
46
|
-
function
|
|
48
|
+
function _createDirectoryIfNotExist2() {
|
|
47
49
|
if (!(0, _fs.existsSync)(this.directory)) {
|
|
48
50
|
(0, _fs.mkdirSync)(this.directory, {
|
|
49
51
|
recursive: true
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _logger = require("../../utils/logger");
|
|
4
|
-
function _classPrivateMethodInitSpec(
|
|
5
|
-
function _checkPrivateRedeclaration(
|
|
6
|
-
function
|
|
7
|
-
var
|
|
4
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
5
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
7
|
+
var _buildTagsString = /*#__PURE__*/new WeakSet();
|
|
8
|
+
var _parseEdition = /*#__PURE__*/new WeakSet();
|
|
9
|
+
var _processSingleEdition = /*#__PURE__*/new WeakSet();
|
|
10
|
+
var _processMultipleEditions = /*#__PURE__*/new WeakSet();
|
|
11
|
+
var _getEditionArgs = /*#__PURE__*/new WeakSet();
|
|
12
|
+
var _buildEditionTags = /*#__PURE__*/new WeakSet();
|
|
8
13
|
class TagProcessor {
|
|
9
14
|
constructor(editionOrder) {
|
|
10
|
-
_classPrivateMethodInitSpec(this,
|
|
15
|
+
_classPrivateMethodInitSpec(this, _buildEditionTags);
|
|
16
|
+
_classPrivateMethodInitSpec(this, _getEditionArgs);
|
|
17
|
+
_classPrivateMethodInitSpec(this, _processMultipleEditions);
|
|
18
|
+
_classPrivateMethodInitSpec(this, _processSingleEdition);
|
|
19
|
+
_classPrivateMethodInitSpec(this, _parseEdition);
|
|
20
|
+
_classPrivateMethodInitSpec(this, _buildTagsString);
|
|
11
21
|
this.editionOrder = editionOrder;
|
|
12
22
|
}
|
|
13
23
|
processTags(config) {
|
|
@@ -17,36 +27,36 @@ class TagProcessor {
|
|
|
17
27
|
} = config.getAll();
|
|
18
28
|
if (!edition) return tags;
|
|
19
29
|
const editionsArray = edition.split(',');
|
|
20
|
-
const editionTags = editionsArray.length === 1 ?
|
|
30
|
+
const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0], tags) : _classPrivateMethodGet(this, _processMultipleEditions, _processMultipleEditions2).call(this, editionsArray, tags);
|
|
21
31
|
return editionTags;
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
|
-
function
|
|
34
|
+
function _buildTagsString2(tags, editionTags) {
|
|
25
35
|
return tags && tags !== '' ? `${tags} and not (${editionTags})` : `not (${editionTags})`;
|
|
26
36
|
}
|
|
27
|
-
function
|
|
37
|
+
function _parseEdition2(edition) {
|
|
28
38
|
if (edition.startsWith('<=')) return ['<=', edition.slice(2)];
|
|
29
39
|
if (edition.startsWith('>=')) return ['>=', edition.slice(2)];
|
|
30
40
|
if (edition.startsWith('<')) return ['<', edition.slice(1)];
|
|
31
41
|
if (edition.startsWith('>')) return ['>', edition.slice(1)];
|
|
32
42
|
return [null, edition];
|
|
33
43
|
}
|
|
34
|
-
function
|
|
35
|
-
const editionArgs =
|
|
44
|
+
function _processSingleEdition2(selectedEdition, tagArgs) {
|
|
45
|
+
const editionArgs = _classPrivateMethodGet(this, _getEditionArgs, _getEditionArgs2).call(this, selectedEdition);
|
|
36
46
|
if (editionArgs && editionArgs.length > 0) {
|
|
37
|
-
const editionTags =
|
|
38
|
-
return
|
|
47
|
+
const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, editionArgs, 'or');
|
|
48
|
+
return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
|
|
39
49
|
}
|
|
40
50
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
|
|
41
51
|
return tagArgs;
|
|
42
52
|
}
|
|
43
|
-
function
|
|
53
|
+
function _processMultipleEditions2(editionsArray, tagArgs) {
|
|
44
54
|
const filteredEditions = this.editionOrder.filter(edition => !editionsArray.includes(edition));
|
|
45
|
-
const editionTags =
|
|
46
|
-
return
|
|
55
|
+
const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, filteredEditions, 'or');
|
|
56
|
+
return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
|
|
47
57
|
}
|
|
48
|
-
function
|
|
49
|
-
const [operator, editionValue] =
|
|
58
|
+
function _getEditionArgs2(selectedEdition) {
|
|
59
|
+
const [operator, editionValue] = _classPrivateMethodGet(this, _parseEdition, _parseEdition2).call(this, selectedEdition.toLowerCase());
|
|
50
60
|
const index = this.editionOrder.findIndex(edition => edition.toLowerCase() === editionValue);
|
|
51
61
|
if (index === -1) {
|
|
52
62
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
|
|
@@ -65,7 +75,7 @@ function _getEditionArgs(selectedEdition) {
|
|
|
65
75
|
return this.editionOrder.filter((_, i) => i !== index);
|
|
66
76
|
}
|
|
67
77
|
}
|
|
68
|
-
function
|
|
78
|
+
function _buildEditionTags2(editionArgs, operator = 'or') {
|
|
69
79
|
return editionArgs.map(edition => `@edition_${edition}`).join(` ${operator} `);
|
|
70
80
|
}
|
|
71
81
|
module.exports = TagProcessor;
|
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": {
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"msw": "1.2.3",
|
|
36
36
|
"playwright": "1.42.1",
|
|
37
37
|
"proper-lockfile": "4.1.2",
|
|
38
|
-
"supports-color": "8.1.1"
|
|
39
|
-
"yaml": "2.2.0"
|
|
38
|
+
"supports-color": "8.1.1"
|
|
40
39
|
},
|
|
41
40
|
"bin": {
|
|
42
41
|
"ZDTestingFramework": "./bin/cli.js"
|