@zohodesk/testinglibrary 0.4.18-experimental → 0.4.19-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,6 +10,7 @@ var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
|
10
10
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
11
11
|
var _accountLogin = _interopRequireDefault(require("./accountLogin"));
|
|
12
12
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
13
|
+
var _checkAuthDirectory = require("../checkAuthDirectory");
|
|
13
14
|
/* eslint-disable no-console */
|
|
14
15
|
|
|
15
16
|
async function performLoginSteps({
|
|
@@ -20,7 +21,7 @@ async function performLoginSteps({
|
|
|
20
21
|
}, isLoggedIn) {
|
|
21
22
|
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
|
|
22
23
|
const lockFileName = useremail.replace(/[@.]/g, '_');
|
|
23
|
-
const fileMutex = new _fileMutex.default((0,
|
|
24
|
+
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
|
|
24
25
|
try {
|
|
25
26
|
await fileMutex.acquire();
|
|
26
27
|
await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.createAuthDirectoryIfNotExist = createAuthDirectoryIfNotExist;
|
|
8
|
+
exports.getLockDirectoryPath = getLockDirectoryPath;
|
|
7
9
|
var _fs = require("fs");
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
11
|
var _checkAuthCookies = require("./auth/checkAuthCookies");
|
|
12
|
+
var _readConfigFile = require("../readConfigFile");
|
|
9
13
|
function createAuthDirectoryIfNotExist() {
|
|
10
14
|
const authDirectory = (0, _checkAuthCookies.getAuthFileDirectory)();
|
|
11
15
|
if (!(0, _fs.existsSync)(authDirectory)) {
|
|
@@ -14,4 +18,10 @@ function createAuthDirectoryIfNotExist() {
|
|
|
14
18
|
recursive: true
|
|
15
19
|
});
|
|
16
20
|
}
|
|
21
|
+
}
|
|
22
|
+
function getLockDirectoryPath() {
|
|
23
|
+
const {
|
|
24
|
+
uatDirectory
|
|
25
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
26
|
+
return _path.default.resolve(_path.default.join(uatDirectory, 'playwright', '.lock'));
|
|
17
27
|
}
|
|
@@ -26,7 +26,7 @@ class FileMutex {
|
|
|
26
26
|
const lockFilePath = _path.default.resolve(this.directory, this.lockFileName);
|
|
27
27
|
try {
|
|
28
28
|
if (!(0, _fs.existsSync)(lockFilePath)) {
|
|
29
|
-
console.warn(`[DEBUG]
|
|
29
|
+
console.warn(`[DEBUG] Creating missing lock file:`, this.lockFileName);
|
|
30
30
|
(0, _fs.writeFileSync)(lockFilePath, 'locked');
|
|
31
31
|
}
|
|
32
32
|
await _properLockfile.default.lock(_classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this), this.options);
|
package/npm-shrinkwrap.json
CHANGED