@zohodesk/testinglibrary 0.5.8-n18-experimental → 0.5.9-n18-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/core/playwright/builtInFixtures/page.js +1 -2
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +2 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +12 -7
- package/build/core/playwright/readConfigFile.js +2 -2
- package/build/core/playwright/setup/config-utils.js +0 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -26,8 +26,7 @@ var _default = exports.default = {
|
|
|
26
26
|
await context.clearCookies();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
// await executeDefaultLoginSteps(context, testInfo , testDetails, testPortalDetails);
|
|
29
|
+
await (0, _loginDefaultStepsHelper.executeDefaultLoginSteps)(context, testInfo, testDetails, testPortalDetails);
|
|
31
30
|
} catch (e) {
|
|
32
31
|
console.error('Error during page', e);
|
|
33
32
|
} finally {
|
|
@@ -41,6 +41,8 @@ async function executeDefaultLoginSteps(context, testInfo, testDetails, testPort
|
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
43
|
const projectName = testInfo.project.name;
|
|
44
|
+
const authFileName = process.env.authFileName;
|
|
45
|
+
testDetails.authFilePrefix = authFileName;
|
|
44
46
|
if (testPortalDetails && projectName !== 'setup' && projectName !== 'cleanup') {
|
|
45
47
|
await context.clearCookies();
|
|
46
48
|
await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
|
|
@@ -18,16 +18,21 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
18
18
|
authFilePrefix,
|
|
19
19
|
email
|
|
20
20
|
} = testInfo;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
if (!authFilePrefix) {
|
|
22
|
+
authFileName = email;
|
|
23
|
+
} else if (authFilePrefix.includes(email)) {
|
|
24
|
+
authFileName = authFilePrefix;
|
|
25
|
+
} else {
|
|
26
|
+
authFileName = authFilePrefix + email;
|
|
27
|
+
}
|
|
28
|
+
process.env.authFileName = authFileName;
|
|
29
|
+
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFileName}-cookies.json`));
|
|
30
|
+
const lockFileName = authFileName.replace(/[@.]/g, '_');
|
|
26
31
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.fileDeletionTimeoutConfig);
|
|
27
32
|
let loginUsingCookie = false;
|
|
28
33
|
try {
|
|
29
34
|
if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
|
|
30
|
-
console.log(`${
|
|
35
|
+
console.log(`${authFileName} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
31
36
|
loginUsingCookie = true;
|
|
32
37
|
} else {
|
|
33
38
|
await fileMutex.acquire();
|
|
@@ -42,7 +47,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
42
47
|
});
|
|
43
48
|
}
|
|
44
49
|
} catch (error) {
|
|
45
|
-
console.error(`Error during login for ${
|
|
50
|
+
console.error(`Error during login for ${authFileName}:`, error);
|
|
46
51
|
} finally {
|
|
47
52
|
if (!loginUsingCookie) {
|
|
48
53
|
await fileMutex.release();
|
|
@@ -18,8 +18,8 @@ var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
|
|
18
18
|
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
19
19
|
let cachedConfig = null;
|
|
20
20
|
function getPrimaryCookiePath() {
|
|
21
|
-
const
|
|
22
|
-
return `uat/playwright/.auth/${
|
|
21
|
+
const authFileName = process.env.authFileName;
|
|
22
|
+
return `uat/playwright/.auth/${authFileName}-cookies.json`;
|
|
23
23
|
}
|
|
24
24
|
function getDefaultConfig() {
|
|
25
25
|
return {
|
|
@@ -35,7 +35,6 @@ function getBrowserConfig({
|
|
|
35
35
|
viewport,
|
|
36
36
|
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
37
37
|
};
|
|
38
|
-
console.log("authFilePath", authFilePath);
|
|
39
38
|
// Determine dependencies based on the mode and smoke test status
|
|
40
39
|
let dependencies = isAuthMode ? ['setup'] : [];
|
|
41
40
|
dependencies = isSmokeTest ? [...dependencies, 'smokeTest'] : dependencies;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9-n18-experimental",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@zohodesk/testinglibrary",
|
|
9
|
-
"version": "0.5.
|
|
9
|
+
"version": "0.5.9-n18-experimental",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|