@zohodesk/testinglibrary 0.4.83-n18-experimental → 0.4.84-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.
@@ -15,9 +15,10 @@ class actorContext {
15
15
  this.userPages = [];
16
16
  this.actorsList = {};
17
17
  }
18
- async setupAllActors(browser, $tags, testInfo, defaultPage, defaultContext) {
18
+ async setupAdditionalActors(browser, $tags, testInfo, defaultPage, defaultContext) {
19
19
  const actorInfoMap = (0, _customFixturesHelper.getCustomAccountDetails)($tags);
20
- await Promise.all(Object.entries(actorInfoMap).map(async ([role, actorInfo], index) => {
20
+ const currentActor = actorInfoMap.additional;
21
+ await Promise.all(Object.entries(currentActor).map(async ([role, actorInfo], index) => {
21
22
  let context, page;
22
23
  if (index === 0) {
23
24
  context = defaultContext;
@@ -81,7 +82,7 @@ var _default = exports.default = {
81
82
  page
82
83
  }, use, testInfo) => {
83
84
  const ctxObject = new actorContext();
84
- await ctxObject.setupAllActors(browser, $tags, testInfo, page, context);
85
+ await ctxObject.setupAdditionalActors(browser, $tags, testInfo, page, context);
85
86
  await use(ctxObject);
86
87
  await ctxObject.cleanup();
87
88
  }
@@ -9,9 +9,8 @@ var _default = exports.default = {
9
9
  executionContext: async ({
10
10
  $tags
11
11
  }, use) => {
12
- const actorInfo = (0, _customFixturesHelper.getCustomAccountDetails)($tags);
13
- await use({
14
- actorInfo
15
- });
12
+ const allActorsObj = (0, _customFixturesHelper.getCustomAccountDetails)($tags);
13
+ const currentActor = allActorsObj.main;
14
+ await use(currentActor);
16
15
  }
17
16
  };
@@ -13,7 +13,7 @@ var _default = exports.default = {
13
13
  page,
14
14
  executionContext
15
15
  }, use, testInfo) => {
16
- let testPortalDetails = executionContext.actorInfo[Object.keys(executionContext.actorInfo)[0]];
16
+ let testPortalDetails = executionContext;
17
17
  let testDetails = {
18
18
  page,
19
19
  $tags,
@@ -27,29 +27,34 @@ function getTagInputFromSelectedTags(tags, inputString) {
27
27
  return tagInput;
28
28
  }
29
29
  function getCustomAccountDetails(tags) {
30
- const tagsTobeFiltered = ['@profile', '@edition', '@beta', '@portal', '@additional_profile'];
31
- const filteredTags = tags.filter(tag => tagsTobeFiltered.some(prefix => tag.startsWith(prefix)));
32
- if (filteredTags && filteredTags.length > 0) {
33
- const portalInfo = getTagInputFromSelectedTags(filteredTags, '@portal');
34
- const betaFeature = getTagInputFromSelectedTags(filteredTags, '@beta');
35
- const profileInfo = getTagInputFromSelectedTags(filteredTags, '@profile');
36
- const editionInfo = getTagInputFromSelectedTags(filteredTags, '@edition');
37
- const defaultActor = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
38
- const actors = {
39
- [defaultActor.profile]: defaultActor
30
+ try {
31
+ const tagsTobeFiltered = ['@profile', '@edition', '@beta', '@portal', '@additional_profile'];
32
+ const filteredTags = tags.filter(tag => tagsTobeFiltered.some(prefix => tag.startsWith(prefix)));
33
+ if (filteredTags && filteredTags.length > 0) {
34
+ const portalInfo = getTagInputFromSelectedTags(filteredTags, '@portal');
35
+ const betaFeature = getTagInputFromSelectedTags(filteredTags, '@beta');
36
+ const profileInfo = getTagInputFromSelectedTags(filteredTags, '@profile');
37
+ const editionInfo = getTagInputFromSelectedTags(filteredTags, '@edition');
38
+ const mainActor = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
39
+ const additionalProfileActors = (0, _additionalProfiles.additionProfiles)(tags, editionInfo, betaFeature, portalInfo);
40
+ const additionalProfileTags = tags.filter(tag => tag.startsWith('@additional_profile_'));
41
+ const additionalActors = {};
42
+ additionalProfileTags.forEach((tag, index) => {
43
+ const profileName = tag.replace('@additional_profile_', '');
44
+ additionalActors[profileName] = additionalProfileActors[index];
45
+ });
46
+ return {
47
+ main: mainActor,
48
+ additional: additionalActors
49
+ };
50
+ }
51
+ return {
52
+ main: (0, _auth.getDefaultActor)(),
53
+ additional: {}
40
54
  };
41
- const additionalProfileActors = (0, _additionalProfiles.additionProfiles)(tags, editionInfo, betaFeature, portalInfo);
42
- const additionalProfileTags = tags.filter(tag => tag.startsWith('@additional_profile_'));
43
- additionalProfileTags.forEach((tag, index) => {
44
- const profileName = tag.replace('@additional_profile_', '');
45
- actors[`${profileName}`] = additionalProfileActors[index];
46
- });
47
- return actors;
55
+ } catch (err) {
56
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error while getting custom account details:', err);
48
57
  }
49
- const actiorInfoDetail = (0, _auth.getDefaultActor)();
50
- return {
51
- [actiorInfoDetail.profile]: actiorInfoDetail
52
- };
53
58
  }
54
59
  async function loginSteps(pageDetail) {
55
60
  const {
@@ -7,21 +7,23 @@ jest.mock('../../../../../core/playwright/helpers/customFixturesHelper');
7
7
  describe('executionContext', () => {
8
8
  test('should pass actorInfo with details from getCustomAccountDetails to use', async () => {
9
9
  const mockTags = ['tag1', 'tag2'];
10
- const mockActorInfo = {
10
+ const mockMainActorInfo = {
11
11
  id: '1',
12
12
  edition: 'enterprise',
13
13
  orgName: 'orgName',
14
14
  profile: 'admin',
15
15
  email: 'xxx.x+uat@zohotest.com'
16
16
  };
17
+ const mockActorInfo = {
18
+ main: mockMainActorInfo,
19
+ additional: {}
20
+ };
17
21
  _customFixturesHelper.getCustomAccountDetails.mockReturnValue(mockActorInfo);
18
22
  const use = jest.fn();
19
23
  await _executionContext.default.executionContext({
20
24
  $tags: mockTags
21
25
  }, use);
22
26
  expect(_customFixturesHelper.getCustomAccountDetails).toHaveBeenCalledWith(mockTags);
23
- expect(use).toHaveBeenCalledWith({
24
- actorInfo: mockActorInfo
25
- });
27
+ expect(use).toHaveBeenCalledWith(mockMainActorInfo);
26
28
  });
27
29
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.83-n18-experimental",
3
+ "version": "0.4.84-n18-experimental",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/testinglibrary",
9
- "version": "0.4.83-n18-experimental",
9
+ "version": "0.4.84-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.4.83-n18-experimental",
3
+ "version": "0.4.84-n18-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -257,4 +257,4 @@ header {
257
257
  font-size: 1rem;
258
258
  padding: 0 0.5rem;
259
259
  }
260
- </style></head><body><div class="jesthtml-content"><header><h1 id="title">Unit Report</h1></header><div id="metadata-container"><div id="timestamp">Started: 2025-09-02 12:03:02</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed ">1 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (1)</div><div class="summary-passed ">1 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></div><div id="suite-1" class="suite-container"><input id="collapsible-0" type="checkbox" class="toggle" checked="checked"/><label for="collapsible-0"><div class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js</div><div class="suite-time">1.144s</div></div></label><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">executionContext</div><div class="test-title">should pass actorInfo with details from getCustomAccountDetails to use</div><div class="test-status">passed</div><div class="test-duration">0.002s</div></div></div></div></div></div></body></html>
260
+ </style></head><body><div class="jesthtml-content"><header><h1 id="title">Unit Report</h1></header><div id="metadata-container"><div id="timestamp">Started: 2025-09-02 21:21:37</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed ">1 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (1)</div><div class="summary-passed ">1 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></div><div id="suite-1" class="suite-container"><input id="collapsible-0" type="checkbox" class="toggle" checked="checked"/><label for="collapsible-0"><div class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js</div><div class="suite-time">0.729s</div></div></label><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">executionContext</div><div class="test-title">should pass actorInfo with details from getCustomAccountDetails to use</div><div class="test-status">passed</div><div class="test-duration">0.004s</div></div></div></div></div></div></body></html>