@zohodesk/testinglibrary 0.4.86-n18-experimental → 0.4.87-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/.babelrc +2 -1
- package/.gitlab-ci.yml +16 -1
- package/README.md +2 -56
- package/build/common/data-generator/steps/DataGenerator.spec.js +18 -42
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +21 -20
- package/build/common/searchFake/helpers/rpcRequestHelper.js +35 -31
- package/build/common/searchFake/steps/searchFake.spec.js +25 -29
- package/build/core/dataGenerator/DataGenerator.js +2 -0
- package/build/core/playwright/builtInFixtures/executionContext.js +5 -4
- package/build/core/playwright/builtInFixtures/index.js +0 -2
- package/build/core/playwright/builtInFixtures/page.js +67 -4
- package/build/core/playwright/helpers/additionalProfiles.js +3 -4
- package/build/test/Test.js +13 -0
- package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +8 -10
- package/npm-shrinkwrap.json +325 -360
- package/package.json +2 -1
- package/build/common/multi-actor/steps/additionalContext.spec.js +0 -29
- package/build/core/playwright/builtInFixtures/actorCtx.js +0 -61
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +0 -53
- package/build/core/playwright/helpers/customFixturesHelper.js +0 -43
- package/test-results/.last-run.json +0 -4
- package/unit_reports/unit-report.html +0 -260
package/.babelrc
CHANGED
package/.gitlab-ci.yml
CHANGED
|
@@ -160,4 +160,19 @@ uat-smoketest:
|
|
|
160
160
|
paths:
|
|
161
161
|
- examples/uat/playwright-report
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
uat-data_generator:
|
|
164
|
+
stage: uat
|
|
165
|
+
script:
|
|
166
|
+
- cd examples
|
|
167
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
168
|
+
- output=$(npm run uat-data_generator)
|
|
169
|
+
- echo "$output"
|
|
170
|
+
- node ../ValidateUATReport.js examples
|
|
171
|
+
|
|
172
|
+
artifacts:
|
|
173
|
+
when: always
|
|
174
|
+
paths:
|
|
175
|
+
- examples/uat/playwright-report
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
package/README.md
CHANGED
|
@@ -12,68 +12,12 @@
|
|
|
12
12
|
### Run TestCase
|
|
13
13
|
|
|
14
14
|
- npm run test
|
|
15
|
-
|
|
16
15
|
### Generate Report
|
|
17
16
|
|
|
18
17
|
- npm run report
|
|
19
18
|
|
|
20
19
|
## Version History
|
|
21
20
|
|
|
22
|
-
### v3.2.6 - 02-09-2025
|
|
23
|
-
|
|
24
|
-
#### Feature
|
|
25
|
-
|
|
26
|
-
- Multi-actor execution support – now possible to switch between multiple profile agents within scenarios using the new `actorCtx` custom fixture.
|
|
27
|
-
|
|
28
|
-
### v3.2.5 - 28-08-2025
|
|
29
|
-
|
|
30
|
-
#### Enhancement
|
|
31
|
-
|
|
32
|
-
- Removed the searchFake dependency from the project level and adopted it inside the framework, reducing project-side maintenance.
|
|
33
|
-
|
|
34
|
-
### v3.2.4 - 29-07-2025
|
|
35
|
-
|
|
36
|
-
#### Feature
|
|
37
|
-
- Data Generator steps are now supported directly via the framework.
|
|
38
|
-
|
|
39
|
-
### Bug fix
|
|
40
|
-
- Feature File Root Directory not found issue fixed
|
|
41
|
-
|
|
42
|
-
### v3.2.3 - 29-07-2025
|
|
43
|
-
|
|
44
|
-
#### Feature
|
|
45
|
-
- Added support for running Smoke Tests in the UAT stage.
|
|
46
|
-
|
|
47
|
-
### v3.2.0 - 22-06-2025
|
|
48
|
-
|
|
49
|
-
#### Feature
|
|
50
|
-
- Default required spec files are now auto-imported from the library into the project.
|
|
51
|
-
|
|
52
|
-
### v3.1.13 - 02-07-2025
|
|
53
|
-
|
|
54
|
-
#### Enhancement
|
|
55
|
-
- Below package versions are updated in this release.
|
|
56
|
-
- @cucumber/Cucumber - 11.3.0
|
|
57
|
-
- Playwright/test - 1.53.2
|
|
58
|
-
- Playwright - 1.53.2
|
|
59
|
-
- Playwright-bdd - 8.3.1
|
|
60
|
-
- QC custom reporter changes have been adopted into the framework.
|
|
61
|
-
|
|
62
|
-
### v3.1.5 - 22-05-2025
|
|
63
|
-
|
|
64
|
-
#### Feature
|
|
65
|
-
- Added support for Module Based Execution UAT stage.
|
|
66
|
-
|
|
67
|
-
### v3.1.4 - 12-05-2025
|
|
68
|
-
|
|
69
|
-
#### Enhancement
|
|
70
|
-
- Playwright version 1.52.0 adopted in testing framework
|
|
71
|
-
|
|
72
|
-
### v3.1.3 - 25-04-2025
|
|
73
|
-
|
|
74
|
-
#### Enhancement
|
|
75
|
-
- Playwright version 1.51.0 adopted in testing framework
|
|
76
|
-
|
|
77
21
|
### v0.2.8 - 26-09-2024
|
|
78
22
|
|
|
79
23
|
#### Feature
|
|
@@ -83,6 +27,8 @@
|
|
|
83
27
|
- Updated the custom-reported to include the errors in tests during the executions. It will help us avoid the stage passed without the actual test execution.
|
|
84
28
|
|
|
85
29
|
|
|
30
|
+
## Version History
|
|
31
|
+
|
|
86
32
|
### v3.0.8 - 25-12-2024
|
|
87
33
|
|
|
88
34
|
#### Enhancement
|
|
@@ -1,46 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
// const { createBdd } = require("@zohodesk/testinglibrary");
|
|
2
|
+
// const { generateAndCacheTestData } = require("./DataGeneratorStepsHelper");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const dataGenerator = new _DataGenerator.default();
|
|
11
|
-
Given('generate a {string} entity {string} with generator {string}', async ({
|
|
12
|
-
page,
|
|
13
|
-
context,
|
|
14
|
-
i18N,
|
|
15
|
-
cacheLayer,
|
|
16
|
-
executionContext
|
|
17
|
-
}, module, entityName, generatorName, dataTable) => {
|
|
18
|
-
await (0, _DataGeneratorStepsHelper.generateAndCacheTestData)(executionContext, "template", generatorName, dataTable, cacheLayer, entityName);
|
|
4
|
+
import { createBdd , test } from '@zohodesk/testinglibrary';
|
|
5
|
+
import { generateAndCacheTestData } from './DataGeneratorStepsHelper';
|
|
6
|
+
|
|
7
|
+
const { Given } = createBdd();
|
|
8
|
+
|
|
9
|
+
Given('generate a {string} entity {string} with generator {string}', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, dataTable) => {
|
|
10
|
+
await generateAndCacheTestData(executionContext, "template", generatorName, dataTable, cacheLayer, entityName);
|
|
19
11
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
i18N,
|
|
24
|
-
cacheLayer,
|
|
25
|
-
executionContext
|
|
26
|
-
}, module, entityName, operationId, dataTable) => {
|
|
27
|
-
await (0, _DataGeneratorStepsHelper.generateAndCacheTestData)(executionContext, "API", operationId, dataTable, cacheLayer, entityName);
|
|
12
|
+
|
|
13
|
+
Given('generate a {string} entity {string} with API {string}', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, dataTable) => {
|
|
14
|
+
await generateAndCacheTestData(executionContext, "API", operationId, dataTable, cacheLayer, entityName);
|
|
28
15
|
});
|
|
29
|
-
Given('generate a {string} entity {string} with generator {string} using {string} profile', async ({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, module, entityName, generatorName, profile, dataTable) => {
|
|
36
|
-
await (0, _DataGeneratorStepsHelper.generateAndCacheTestData)(executionContext, "template", generatorName, dataTable, cacheLayer, entityName, profile);
|
|
16
|
+
Given('generate a {string} entity {string} with generator {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, profile, dataTable) => {
|
|
17
|
+
await generateAndCacheTestData(executionContext, "template", generatorName, dataTable, cacheLayer, entityName, profile);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Given('generate a {string} entity {string} with API {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, profile, dataTable) => {
|
|
21
|
+
await generateAndCacheTestData(executionContext, "API", operationId, dataTable, cacheLayer, entityName, profile);
|
|
37
22
|
});
|
|
38
|
-
Given('generate a {string} entity {string} with API {string} using {string} profile', async ({
|
|
39
|
-
page,
|
|
40
|
-
context,
|
|
41
|
-
i18N,
|
|
42
|
-
cacheLayer,
|
|
43
|
-
executionContext
|
|
44
|
-
}, module, entityName, operationId, profile, dataTable) => {
|
|
45
|
-
await (0, _DataGeneratorStepsHelper.generateAndCacheTestData)(executionContext, "API", operationId, dataTable, cacheLayer, entityName, profile);
|
|
46
|
-
});
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
// import { test } from '@zohodesk/testinglibrary';
|
|
2
|
+
// const DataGenerator = require("@zohodesk/testinglibrary/DataGenerator").default;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
import { test } from '@zohodesk/testinglibrary';
|
|
5
|
+
import DataGenerator from '@zohodesk/testinglibrary/DataGenerator';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const dataGenerator = new DataGenerator();
|
|
9
|
+
|
|
10
|
+
export async function generateAndCacheTestData(executionContext, type, identifier, dataTable, cacheLayer, entityName, profile = null) {
|
|
11
|
+
let actorInfo;
|
|
12
|
+
const testInfo = test.info();
|
|
13
|
+
const scenarioName = testInfo.title.split('/').pop() || 'Unknown Scenario';
|
|
14
|
+
|
|
15
|
+
if (profile) {
|
|
16
|
+
actorInfo = await dataGenerator.getDataGenUserExecutionContext(executionContext.actorInfo.edition, profile);
|
|
17
|
+
} else {
|
|
18
|
+
actorInfo = executionContext.actorInfo;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const generatedData = await dataGenerator.generate(testInfo, actorInfo, type, identifier, scenarioName, dataTable ? dataTable.hashes() : []);
|
|
22
|
+
await cacheLayer.set(entityName, generatedData.data);
|
|
22
23
|
}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { expect } from '@zohodesk/testinglibrary';
|
|
2
2
|
|
|
3
|
-
var _testinglibrary = require("@zohodesk/testinglibrary");
|
|
4
3
|
async function executeRpcRequest(page, payload) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
|
|
5
|
+
const url = new URL(page.url());
|
|
6
|
+
const baseUrl = `${url.protocol}//${url.host}`;
|
|
7
|
+
const invokeURL = `${baseUrl}/api/testing/acceptanceTest/rpc/invoke`;
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const response = await page.request.post(invokeURL, {
|
|
11
|
+
headers: {'Content-Type': 'application/json'},
|
|
12
|
+
data: payload
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (!response.ok()) {
|
|
16
|
+
throw new Error(`HTTP ${response.status()}: ${response.statusText()}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const responseData = await response.json();
|
|
20
|
+
expect(responseData.data).toHaveProperty('status', 'success');
|
|
21
|
+
|
|
22
|
+
} catch (error) {
|
|
23
|
+
throw error;
|
|
17
24
|
}
|
|
18
|
-
const responseData = await response.json();
|
|
19
|
-
(0, _testinglibrary.expect)(responseData.data).toHaveProperty('status', 'success');
|
|
20
|
-
} catch (error) {
|
|
21
|
-
throw error;
|
|
22
|
-
}
|
|
23
25
|
}
|
|
26
|
+
|
|
27
|
+
|
|
24
28
|
async function entityIdReConstructor(payload) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
|
|
30
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
31
|
+
throw new Error('Invalid payload. It must be a non-null object.');
|
|
32
|
+
}
|
|
33
|
+
if (!payload.arguments || typeof payload.arguments.entityId !== 'string') {
|
|
34
|
+
throw new Error('Invalid payload.arguments.entityId. It must be a non-empty string.');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
payload.arguments.entityId = payload.arguments.entityId.split(',').map(id => id.trim());
|
|
38
|
+
return payload;
|
|
33
39
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
entityIdReConstructor
|
|
37
|
-
};
|
|
40
|
+
|
|
41
|
+
module.exports = { executeRpcRequest, entityIdReConstructor };
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import {createBdd } from '@zohodesk/testinglibrary';
|
|
2
|
+
import { executeRpcRequest , entityIdReConstructor } from '../helpers/rpcRequestHelper';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
await (0, _rpcRequestHelper.entityIdReConstructor)(payload);
|
|
28
|
-
await (0, _rpcRequestHelper.executeRpcRequest)(page, payload);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
4
|
+
const { Given } = createBdd();
|
|
5
|
+
|
|
6
|
+
Given('a search entity', async ({page}, dataTable)=>{
|
|
7
|
+
const data = dataTable.hashes();
|
|
8
|
+
|
|
9
|
+
for (const row of data) {
|
|
10
|
+
|
|
11
|
+
const { moduleName, entityId, searchString } = row;
|
|
12
|
+
const payload = {
|
|
13
|
+
className: 'applicationDriver.rpc.desk.integrations.search.SearchFakeDataPopulator',
|
|
14
|
+
methodName: 'populateSearchData',
|
|
15
|
+
arguments: {
|
|
16
|
+
module: moduleName,
|
|
17
|
+
searchString: searchString,
|
|
18
|
+
entityId: entityId
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
await entityIdReConstructor(payload);
|
|
22
|
+
|
|
23
|
+
await executeRpcRequest(page, payload);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
});
|
|
@@ -71,7 +71,9 @@ async function _generateAPIGenerator(operationId) {
|
|
|
71
71
|
}];
|
|
72
72
|
}
|
|
73
73
|
async function _constructApiPayload(scenarioName, processedGenerators, actorInfo) {
|
|
74
|
+
const orgOauth = actorInfo['org_oauth'] || {};
|
|
74
75
|
const dataGeneratorConfig = actorInfo['data-generator'] || {};
|
|
76
|
+
dataGeneratorConfig.account.org_oauth = orgOauth;
|
|
75
77
|
const apiPayload = {
|
|
76
78
|
scenario_name: scenarioName,
|
|
77
79
|
data_generation_templates: processedGenerators,
|
|
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _page = require("./page");
|
|
8
8
|
var _default = exports.default = {
|
|
9
9
|
executionContext: async ({
|
|
10
10
|
$tags
|
|
11
11
|
}, use) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let testPortalActorDetails = {
|
|
13
|
+
actorInfo: (0, _page.getCustomAccountDetails)($tags)
|
|
14
|
+
};
|
|
15
|
+
await use(testPortalActorDetails);
|
|
15
16
|
}
|
|
16
17
|
};
|
|
@@ -12,14 +12,12 @@ var _addTags = _interopRequireDefault(require("./addTags"));
|
|
|
12
12
|
var _i18N = _interopRequireDefault(require("./i18N"));
|
|
13
13
|
var _unauthenticatedPage = _interopRequireDefault(require("./unauthenticatedPage"));
|
|
14
14
|
var _executionContext = _interopRequireDefault(require("./executionContext"));
|
|
15
|
-
var _actorCtx = _interopRequireDefault(require("./actorCtx"));
|
|
16
15
|
function extractTagsFromTitle(text) {
|
|
17
16
|
return text.match(/@\w+/g) || [];
|
|
18
17
|
}
|
|
19
18
|
function getBuiltInFixtures(bddMode) {
|
|
20
19
|
let builtInFixtures = {
|
|
21
20
|
..._page.default,
|
|
22
|
-
..._actorCtx.default,
|
|
23
21
|
..._context.default,
|
|
24
22
|
..._cacheLayer.default,
|
|
25
23
|
..._i18N.default,
|
|
@@ -4,8 +4,58 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
exports.getCustomAccountDetails = getCustomAccountDetails;
|
|
8
|
+
var _auth = require("../helpers/auth");
|
|
9
|
+
var _readConfigFile = require("../readConfigFile");
|
|
8
10
|
/* eslint-disable global-require */
|
|
11
|
+
|
|
12
|
+
//import { additionProfiles } from '../helpers/additionalProfiles';
|
|
13
|
+
|
|
14
|
+
function getTagInputFromSelectedTags(tags, inputString) {
|
|
15
|
+
const selectedTag = [...tags].reverse().find(tag => tag.startsWith(inputString));
|
|
16
|
+
let tagInput = null;
|
|
17
|
+
if (selectedTag) {
|
|
18
|
+
tagInput = selectedTag.split(`${inputString}_`).pop().toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
return tagInput;
|
|
21
|
+
}
|
|
22
|
+
function getCustomAccountDetails(tags) {
|
|
23
|
+
const tagsTobeFiltered = ['@profile', '@edition', '@beta', '@portal', '@additional_profile'];
|
|
24
|
+
const filteredTags = tags.filter(tag => tagsTobeFiltered.some(prefix => tag.startsWith(prefix)));
|
|
25
|
+
if (filteredTags && filteredTags.length > 0) {
|
|
26
|
+
const portalInfo = getTagInputFromSelectedTags(filteredTags, '@portal');
|
|
27
|
+
const betaFeature = getTagInputFromSelectedTags(filteredTags, '@beta');
|
|
28
|
+
const profileInfo = getTagInputFromSelectedTags(filteredTags, '@profile');
|
|
29
|
+
const editionInfo = getTagInputFromSelectedTags(filteredTags, '@edition');
|
|
30
|
+
const user = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
|
|
31
|
+
return user;
|
|
32
|
+
}
|
|
33
|
+
return (0, _auth.getDefaultActor)();
|
|
34
|
+
}
|
|
35
|
+
const {
|
|
36
|
+
testSetup
|
|
37
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
38
|
+
async function loginSteps(pageDetail) {
|
|
39
|
+
const {
|
|
40
|
+
page
|
|
41
|
+
} = pageDetail;
|
|
42
|
+
if (testSetup.loginSteps && typeof testSetup.loginSteps === 'function') {
|
|
43
|
+
return await testSetup.loginSteps(pageDetail);
|
|
44
|
+
} else {
|
|
45
|
+
await page.goto(process.env.domain);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function performDefaultPageSteps(testInfo) {
|
|
49
|
+
if (testSetup.page && typeof testSetup.page === 'function') {
|
|
50
|
+
await testSetup.page(testInfo);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function verifyPageIsLoaded(testInfo) {
|
|
54
|
+
if (testSetup.validateLogin && typeof testSetup.validateLogin === 'function') {
|
|
55
|
+
return await testSetup.validateLogin(testInfo);
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
9
59
|
var _default = exports.default = {
|
|
10
60
|
page: async ({
|
|
11
61
|
context,
|
|
@@ -13,7 +63,7 @@ var _default = exports.default = {
|
|
|
13
63
|
page,
|
|
14
64
|
executionContext
|
|
15
65
|
}, use, testInfo) => {
|
|
16
|
-
let testPortalDetails = executionContext;
|
|
66
|
+
let testPortalDetails = executionContext.actorInfo;
|
|
17
67
|
let testDetails = {
|
|
18
68
|
page,
|
|
19
69
|
$tags,
|
|
@@ -26,11 +76,24 @@ var _default = exports.default = {
|
|
|
26
76
|
await context.clearCookies();
|
|
27
77
|
return;
|
|
28
78
|
}
|
|
29
|
-
|
|
79
|
+
const {
|
|
80
|
+
isAuthMode
|
|
81
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
82
|
+
if (!isAuthMode) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const projectName = testInfo.project.name;
|
|
86
|
+
if (testPortalDetails && projectName !== 'setup' && projectName !== 'cleanup') {
|
|
87
|
+
await context.clearCookies();
|
|
88
|
+
await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
|
|
89
|
+
return await verifyPageIsLoaded(testInfo);
|
|
90
|
+
}, loginSteps);
|
|
91
|
+
process.env.actorInfo = JSON.stringify(testPortalDetails);
|
|
92
|
+
}
|
|
30
93
|
} catch (e) {
|
|
31
94
|
console.error('Error during page', e);
|
|
32
95
|
} finally {
|
|
33
|
-
await
|
|
96
|
+
await performDefaultPageSteps(testDetails);
|
|
34
97
|
await use(page);
|
|
35
98
|
await context.close();
|
|
36
99
|
}
|
|
@@ -7,12 +7,11 @@ exports.additionProfiles = additionProfiles;
|
|
|
7
7
|
var _getUsers = require("./auth/getUsers");
|
|
8
8
|
function additionProfiles(tags, editionInfo, betaFeature, portalInfo) {
|
|
9
9
|
const additionalProfileTags = tags.filter(tag => tag.startsWith('@additional_profile_'));
|
|
10
|
-
let additionalProfileActors =
|
|
10
|
+
let additionalProfileActors = [];
|
|
11
11
|
if (additionalProfileTags.length > 0 && editionInfo) {
|
|
12
|
-
additionalProfileTags.
|
|
12
|
+
additionalProfileActors = additionalProfileTags.map(tag => {
|
|
13
13
|
const additionalProfile = tag.replace('@additional_profile_', '');
|
|
14
|
-
|
|
15
|
-
additionalProfileActors[additionalProfile] = actorDetails;
|
|
14
|
+
return (0, _getUsers.getUserForSelectedEditionAndProfile)(editionInfo, additionalProfile, betaFeature, portalInfo);
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
17
|
return additionalProfileActors;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
delete require.cache[require.resolve('../core/playwright/runner/Runner')];
|
|
4
|
+
function test() {
|
|
5
|
+
const inputString = "@hc";
|
|
6
|
+
const selectedTag = ["@hc_1234"].reverse().find(tag => tag.startsWith(inputString));
|
|
7
|
+
let tagInput = null;
|
|
8
|
+
if (selectedTag) {
|
|
9
|
+
tagInput = selectedTag.split(`${inputString}_`).pop().toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
console.log(tagInput);
|
|
12
|
+
}
|
|
13
|
+
test();
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var
|
|
4
|
+
var _page = require("../../../../../core/playwright/builtInFixtures/page");
|
|
5
5
|
var _executionContext = _interopRequireDefault(require("../../../../../core/playwright/builtInFixtures/executionContext"));
|
|
6
|
-
jest.mock('../../../../../core/playwright/
|
|
6
|
+
jest.mock('../../../../../core/playwright/builtInFixtures/page');
|
|
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
|
|
10
|
+
const mockActorInfo = {
|
|
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
|
-
|
|
18
|
-
main: mockMainActorInfo,
|
|
19
|
-
additional: {}
|
|
20
|
-
};
|
|
21
|
-
_customFixturesHelper.getCustomAccountDetails.mockReturnValue(mockActorInfo);
|
|
17
|
+
_page.getCustomAccountDetails.mockReturnValue(mockActorInfo);
|
|
22
18
|
const use = jest.fn();
|
|
23
19
|
await _executionContext.default.executionContext({
|
|
24
20
|
$tags: mockTags
|
|
25
21
|
}, use);
|
|
26
|
-
expect(
|
|
27
|
-
expect(use).toHaveBeenCalledWith(
|
|
22
|
+
expect(_page.getCustomAccountDetails).toHaveBeenCalledWith(mockTags);
|
|
23
|
+
expect(use).toHaveBeenCalledWith({
|
|
24
|
+
actorInfo: mockActorInfo
|
|
25
|
+
});
|
|
28
26
|
});
|
|
29
27
|
});
|