@zohodesk/testinglibrary 0.0.7-n20-experimental → 0.0.8-n20-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.
|
@@ -10,7 +10,6 @@ var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
|
10
10
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
11
11
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
12
12
|
var _checkAuthDirectory = require("../checkAuthDirectory");
|
|
13
|
-
var _logger = require("../../../../utils/logger");
|
|
14
13
|
/* eslint-disable no-console */
|
|
15
14
|
|
|
16
15
|
async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
@@ -26,7 +25,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
26
25
|
let loginUsingCookie = false;
|
|
27
26
|
try {
|
|
28
27
|
if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
|
|
29
|
-
|
|
28
|
+
console.log(`${email} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
30
29
|
loginUsingCookie = true;
|
|
31
30
|
} else {
|
|
32
31
|
await fileMutex.acquire();
|
|
@@ -41,7 +40,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
} catch (error) {
|
|
44
|
-
|
|
43
|
+
console.error(`Error during login for ${email}:`, error);
|
|
45
44
|
} finally {
|
|
46
45
|
if (!loginUsingCookie) {
|
|
47
46
|
await fileMutex.release();
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _fs = require("fs");
|
|
10
|
-
var _logger = require("../../../utils/logger");
|
|
11
10
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
12
11
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
13
12
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
@@ -25,7 +24,7 @@ class FileMutex {
|
|
|
25
24
|
return new Promise((resolve, reject) => {
|
|
26
25
|
if (!(0, _fs.existsSync)(this.lockFilePath)) {
|
|
27
26
|
(0, _fs.writeFileSync)(this.lockFilePath, 'locked');
|
|
28
|
-
|
|
27
|
+
console.log(`Lock file created: ${this.lockFilePath}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
29
28
|
return resolve();
|
|
30
29
|
}
|
|
31
30
|
const timeout = setTimeout(() => {
|
|
@@ -36,12 +35,12 @@ class FileMutex {
|
|
|
36
35
|
try {
|
|
37
36
|
if (eventType === 'rename' && filename === this.lockFileName) {
|
|
38
37
|
clearTimeout(timeout);
|
|
39
|
-
|
|
38
|
+
console.log(`Lock file deleted! Proceeding, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
40
39
|
watcher.close();
|
|
41
40
|
resolve();
|
|
42
41
|
}
|
|
43
42
|
} catch (err) {
|
|
44
|
-
|
|
43
|
+
console.error(`Error watching for lock file deletion: ${err.message}`);
|
|
45
44
|
watcher.close();
|
|
46
45
|
}
|
|
47
46
|
});
|
|
@@ -51,10 +50,10 @@ class FileMutex {
|
|
|
51
50
|
try {
|
|
52
51
|
if ((0, _fs.existsSync)(this.lockFilePath)) {
|
|
53
52
|
(0, _fs.unlinkSync)(this.lockFilePath);
|
|
54
|
-
|
|
53
|
+
console.log(`Lock file deleted: ${this.lockFilePath}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
55
54
|
}
|
|
56
55
|
} catch (err) {
|
|
57
|
-
|
|
56
|
+
console.error(`Error deleting lock file: ${err.message}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
58
57
|
throw err;
|
|
59
58
|
}
|
|
60
59
|
}
|