@zohodesk/testinglibrary 0.5.8-n18-experimental → 0.5.10-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.
@@ -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,22 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
18
18
  authFilePrefix,
19
19
  email
20
20
  } = testInfo;
21
- authFilePrefix = authFilePrefix ? authFilePrefix + email : email;
22
- console.log("authFilePrefix", authFilePrefix);
23
- process.env.authFilePrefix = authFilePrefix;
24
- const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
25
- const lockFileName = authFilePrefix.replace(/[@.]/g, '_');
21
+ let authFileName;
22
+ if (!authFilePrefix) {
23
+ authFileName = email;
24
+ } else if (authFilePrefix.includes(email)) {
25
+ authFileName = authFilePrefix;
26
+ } else {
27
+ authFileName = authFilePrefix + email;
28
+ }
29
+ process.env.authFileName = authFileName;
30
+ const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFileName}-cookies.json`));
31
+ const lockFileName = authFileName.replace(/[@.]/g, '_');
26
32
  const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.fileDeletionTimeoutConfig);
27
33
  let loginUsingCookie = false;
28
34
  try {
29
35
  if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
30
- console.log(`${authFilePrefix} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
36
+ console.log(`${authFileName} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
31
37
  loginUsingCookie = true;
32
38
  } else {
33
39
  await fileMutex.acquire();
@@ -42,7 +48,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
42
48
  });
43
49
  }
44
50
  } catch (error) {
45
- console.error(`Error during login for ${authFilePrefix}:`, error);
51
+ console.error(`Error during login for ${authFileName}:`, error);
46
52
  } finally {
47
53
  if (!loginUsingCookie) {
48
54
  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 authFilePrefix = process.env.authFilePrefix;
22
- return `uat/playwright/.auth/${authFilePrefix}-cookies.json`;
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;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.5.8-n18-experimental",
3
+ "version": "0.5.10-n18-experimental",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/testinglibrary",
9
- "version": "0.5.8-n18-experimental",
9
+ "version": "0.5.10-n18-experimental",
10
10
  "hasInstallScript": true,
11
11
  "license": "ISC",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.5.8-n18-experimental",
3
+ "version": "0.5.10-n18-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {