@zohodesk/testinglibrary 0.0.5-n20-experimental → 0.0.6-n20-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/.gitlab-ci.yml +15 -0
- package/README.md +22 -1
- package/build/common/searchFake/helpers/rpcRequestHelper.js +14 -3
- package/build/common/searchFake/steps/searchFake.spec.js +52 -1
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/helpers/auth/loginSteps.js +3 -2
- package/build/core/playwright/helpers/fileMutex.js +6 -5
- package/build/core/playwright/readConfigFile.js +1 -0
- package/build/core/playwright/setup/Project.js +35 -0
- package/build/core/playwright/setup/ProjectConfiguration.js +80 -0
- package/build/core/playwright/setup/config-creator.js +23 -51
- package/build/core/playwright/test-runner.js +2 -0
- package/npm-shrinkwrap.json +256 -150
- package/package.json +2 -1
- package/unit_reports/unit-report.html +59 -76
package/.gitlab-ci.yml
CHANGED
|
@@ -188,4 +188,19 @@ uat-data_generator:
|
|
|
188
188
|
paths:
|
|
189
189
|
- examples/uat/playwright-report
|
|
190
190
|
|
|
191
|
+
uat-search_indexing:
|
|
192
|
+
stage: uat
|
|
193
|
+
script:
|
|
194
|
+
- cd examples
|
|
195
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
196
|
+
- output=$(npm run uat-search_indexing)
|
|
197
|
+
- echo "$output"
|
|
198
|
+
- node ../ValidateUATReport.js examples
|
|
199
|
+
|
|
200
|
+
artifacts:
|
|
201
|
+
when: always
|
|
202
|
+
paths:
|
|
203
|
+
- examples/uat/playwright-report
|
|
204
|
+
|
|
205
|
+
|
|
191
206
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,28 @@
|
|
|
17
17
|
|
|
18
18
|
- npm run report
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### v3.2.11 - 13-10-2025
|
|
21
|
+
|
|
22
|
+
### Feature
|
|
23
|
+
|
|
24
|
+
- New step a search entity using {string} provided for search indexing, This step will use run time data generation response as input for the indexing
|
|
25
|
+
|
|
26
|
+
### Issue fix
|
|
27
|
+
- Custom teardown comment provided
|
|
28
|
+
|
|
29
|
+
### v3.2.10 - 09-10-2025
|
|
30
|
+
|
|
31
|
+
#### Enhancement
|
|
32
|
+
- A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### v3.2.9 - 26-09-2025
|
|
36
|
+
|
|
37
|
+
### Enhancement
|
|
38
|
+
|
|
39
|
+
- Authentication deatils for data generation can be configured in org level
|
|
40
|
+
- reference link : https://learn.zoho.in/portal/zohocorp/knowledge/manual/client-uat/article/data-generation#_Tocpd3n7yt9ngeg
|
|
41
|
+
|
|
21
42
|
|
|
22
43
|
### v3.2.8 - 18-09-2025
|
|
23
44
|
|
|
@@ -30,11 +30,22 @@ async function entityIdReConstructor(payload) {
|
|
|
30
30
|
if (typeof payload !== 'object' || payload === null) {
|
|
31
31
|
throw new Error('Invalid payload. It must be a non-null object.');
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
if (!payload.arguments || (!payload.arguments.entityId)) {
|
|
35
|
+
throw new Error('Invalid payload.arguments.entityId. It must be a non-empty string or array of strings.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const entityId = payload.arguments.entityId;
|
|
39
|
+
|
|
40
|
+
// If it's already an array, validate and clean it
|
|
41
|
+
if (Array.isArray(entityId)) {
|
|
42
|
+
payload.arguments.entityId = entityId.map(id => id.trim());
|
|
43
|
+
}
|
|
44
|
+
// If it's a string, split and convert to array
|
|
45
|
+
else if (typeof entityId === 'string') {
|
|
46
|
+
payload.arguments.entityId = entityId.split(',').map(id => id.trim());
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
payload.arguments.entityId = payload.arguments.entityId.split(',').map(id => id.trim());
|
|
38
49
|
return payload;
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import {createBdd } from '@zohodesk/testinglibrary';
|
|
2
2
|
import { executeRpcRequest , entityIdReConstructor } from '../helpers/rpcRequestHelper';
|
|
3
|
+
// import jp from 'jsonpath';
|
|
3
4
|
|
|
4
5
|
const { Given } = createBdd();
|
|
5
6
|
|
|
7
|
+
|
|
8
|
+
// Given a search entity
|
|
9
|
+
// | moduleName | entityId | entityName | searchString |
|
|
10
|
+
// | contact | 122000006785675, 122000007141665, 122000006636472 | QA Team | testinguat |
|
|
11
|
+
|
|
6
12
|
Given('a search entity', async ({page}, dataTable)=>{
|
|
7
13
|
const data = dataTable.hashes();
|
|
8
14
|
|
|
@@ -22,5 +28,50 @@ Given('a search entity', async ({page}, dataTable)=>{
|
|
|
22
28
|
|
|
23
29
|
await executeRpcRequest(page, payload);
|
|
24
30
|
}
|
|
25
|
-
|
|
26
31
|
});
|
|
32
|
+
|
|
33
|
+
// Given data generation step
|
|
34
|
+
// Given a search entity using "C1"
|
|
35
|
+
// | moduleName | searchString | searchEntity (response of the previous data generation step) |
|
|
36
|
+
// | contact | testinguat | $.id |
|
|
37
|
+
// | contact | testinguat | $.ids |
|
|
38
|
+
// | contact | testinguat |
|
|
39
|
+
|
|
40
|
+
Given('a search entity using {string}', async ({page,cacheLayer}, reference,dataTable)=>{
|
|
41
|
+
const data = dataTable.hashes();
|
|
42
|
+
|
|
43
|
+
const row = data[0];
|
|
44
|
+
if (!row || !row.moduleName || !row.searchString) {
|
|
45
|
+
throw new Error('Invalid or missing data in dataTable');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { moduleName, searchEntity, searchString } = row;
|
|
49
|
+
|
|
50
|
+
const searchObj = cacheLayer.get(reference);
|
|
51
|
+
let entityIdValue;
|
|
52
|
+
|
|
53
|
+
if (typeof searchObj === 'string') {
|
|
54
|
+
entityIdValue = searchObj;
|
|
55
|
+
} else {
|
|
56
|
+
const jsonPath = searchEntity?.startsWith?.('$') ? searchEntity : `$.${searchEntity}`;
|
|
57
|
+
const result = null;//jp.query(searchObj, jsonPath);
|
|
58
|
+
|
|
59
|
+
if (!result || result.length === 0) {
|
|
60
|
+
throw new Error(`JSONPath query '${jsonPath}' returned no results from cache object for reference: ${reference}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
entityIdValue = result.length === 1 ? result[0] : result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const payload = {
|
|
67
|
+
className: 'applicationDriver.rpc.desk.integrations.search.SearchFakeDataPopulator',
|
|
68
|
+
methodName: 'populateSearchData',
|
|
69
|
+
arguments: {
|
|
70
|
+
module: moduleName,
|
|
71
|
+
searchString: searchString,
|
|
72
|
+
entityId: entityIdValue
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
await entityIdReConstructor(payload);
|
|
76
|
+
await executeRpcRequest(page, payload);
|
|
77
|
+
});
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CUSTOM_COMMANDS = void 0;
|
|
7
|
-
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules'];
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules', 'isTearDown'];
|
|
@@ -10,6 +10,7 @@ var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
|
10
10
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
11
11
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
12
12
|
var _checkAuthDirectory = require("../checkAuthDirectory");
|
|
13
|
+
var _logger = require("../../../../utils/logger");
|
|
13
14
|
/* eslint-disable no-console */
|
|
14
15
|
|
|
15
16
|
async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
@@ -25,7 +26,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
25
26
|
let loginUsingCookie = false;
|
|
26
27
|
try {
|
|
27
28
|
if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
|
|
28
|
-
|
|
29
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `${email} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
29
30
|
loginUsingCookie = true;
|
|
30
31
|
} else {
|
|
31
32
|
await fileMutex.acquire();
|
|
@@ -40,7 +41,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
|
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
} catch (error) {
|
|
43
|
-
|
|
44
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Error during login for ${email}:`, error);
|
|
44
45
|
} finally {
|
|
45
46
|
if (!loginUsingCookie) {
|
|
46
47
|
await fileMutex.release();
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _fs = require("fs");
|
|
10
|
+
var _logger = require("../../../utils/logger");
|
|
10
11
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
11
12
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
12
13
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
@@ -24,7 +25,7 @@ class FileMutex {
|
|
|
24
25
|
return new Promise((resolve, reject) => {
|
|
25
26
|
if (!(0, _fs.existsSync)(this.lockFilePath)) {
|
|
26
27
|
(0, _fs.writeFileSync)(this.lockFilePath, 'locked');
|
|
27
|
-
|
|
28
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Lock file created: ${this.lockFilePath}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
28
29
|
return resolve();
|
|
29
30
|
}
|
|
30
31
|
const timeout = setTimeout(() => {
|
|
@@ -35,12 +36,12 @@ class FileMutex {
|
|
|
35
36
|
try {
|
|
36
37
|
if (eventType === 'rename' && filename === this.lockFileName) {
|
|
37
38
|
clearTimeout(timeout);
|
|
38
|
-
|
|
39
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Lock file deleted! Proceeding, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
39
40
|
watcher.close();
|
|
40
41
|
resolve();
|
|
41
42
|
}
|
|
42
43
|
} catch (err) {
|
|
43
|
-
|
|
44
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Error watching for lock file deletion: ${err.message}`);
|
|
44
45
|
watcher.close();
|
|
45
46
|
}
|
|
46
47
|
});
|
|
@@ -50,10 +51,10 @@ class FileMutex {
|
|
|
50
51
|
try {
|
|
51
52
|
if ((0, _fs.existsSync)(this.lockFilePath)) {
|
|
52
53
|
(0, _fs.unlinkSync)(this.lockFilePath);
|
|
53
|
-
|
|
54
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Lock file deleted: ${this.lockFilePath}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
54
55
|
}
|
|
55
56
|
} catch (err) {
|
|
56
|
-
|
|
57
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Error deleting lock file: ${err.message}, worker index - ${process.env.TEST_WORKER_INDEX}`);
|
|
57
58
|
throw err;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -19,6 +19,7 @@ var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
|
19
19
|
let cachedConfig = null;
|
|
20
20
|
function getDefaultConfig() {
|
|
21
21
|
return {
|
|
22
|
+
isTearDown: true,
|
|
22
23
|
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
23
24
|
headless: false,
|
|
24
25
|
browsers: ['Chrome'],
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class Project {
|
|
4
|
+
constructor(name) {
|
|
5
|
+
this.properties = {};
|
|
6
|
+
this.properties.name = name;
|
|
7
|
+
}
|
|
8
|
+
setTestDir(value) {
|
|
9
|
+
this.properties.testDir = value;
|
|
10
|
+
}
|
|
11
|
+
setTestMatch(value) {
|
|
12
|
+
this.properties.testMatch = value;
|
|
13
|
+
}
|
|
14
|
+
setRetries(value) {
|
|
15
|
+
this.properties.retries = value;
|
|
16
|
+
}
|
|
17
|
+
setUse(value) {
|
|
18
|
+
this.properties.use = value;
|
|
19
|
+
}
|
|
20
|
+
setTearDown(value) {
|
|
21
|
+
this.properties.teardown = value;
|
|
22
|
+
}
|
|
23
|
+
setDependencies(value) {
|
|
24
|
+
this.properties.dependencies = value;
|
|
25
|
+
}
|
|
26
|
+
setProperty(key, value) {
|
|
27
|
+
this.properties[key] = value;
|
|
28
|
+
}
|
|
29
|
+
getProperties() {
|
|
30
|
+
return this.properties;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
module.exports = {
|
|
34
|
+
Project
|
|
35
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.cleanupConfig = cleanupConfig;
|
|
8
|
+
exports.setupConfig = setupConfig;
|
|
9
|
+
exports.smokeTestConfig = smokeTestConfig;
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _Project = require("./Project");
|
|
12
|
+
var _configUtils = require("./config-utils");
|
|
13
|
+
var _readConfigFile = require("../readConfigFile");
|
|
14
|
+
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
15
|
+
const {
|
|
16
|
+
isAuthMode,
|
|
17
|
+
isSmokeTest,
|
|
18
|
+
bddMode,
|
|
19
|
+
authFilePath,
|
|
20
|
+
trace,
|
|
21
|
+
video,
|
|
22
|
+
testIdAttribute,
|
|
23
|
+
viewport
|
|
24
|
+
} = uatConfig;
|
|
25
|
+
function setupConfig() {
|
|
26
|
+
const setupProject = new _Project.Project('setup');
|
|
27
|
+
setupProject.setTestMatch(/.*\.setup\.js/);
|
|
28
|
+
setupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
29
|
+
const isTearDown = JSON.parse(process.env.tearDown);
|
|
30
|
+
setupProject.setTearDown(isTearDown ? 'cleanup' : '');
|
|
31
|
+
const setupProjectConfig = [setupProject.getProperties()];
|
|
32
|
+
return setupProjectConfig;
|
|
33
|
+
}
|
|
34
|
+
function smokeTestConfig() {
|
|
35
|
+
const smokeTestProject = new _Project.Project('smokeTest');
|
|
36
|
+
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
37
|
+
featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
|
|
38
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
39
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
|
|
40
|
+
uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
|
|
41
|
+
});
|
|
42
|
+
const commonConfig = {
|
|
43
|
+
storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
|
|
44
|
+
};
|
|
45
|
+
smokeTestProject.setTestDir(smokeTestDir);
|
|
46
|
+
smokeTestProject.setRetries(0);
|
|
47
|
+
smokeTestProject.setUse({
|
|
48
|
+
...commonConfig
|
|
49
|
+
});
|
|
50
|
+
smokeTestProject.setDependencies(isAuthMode ? ['setup'] : []);
|
|
51
|
+
const smokeTestProjectConfig = [smokeTestProject.getProperties()];
|
|
52
|
+
return smokeTestProjectConfig;
|
|
53
|
+
}
|
|
54
|
+
function defaultConfig() {
|
|
55
|
+
const defaultProject = new _Project.Project('default');
|
|
56
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
57
|
+
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
58
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
59
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
60
|
+
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
61
|
+
});
|
|
62
|
+
const use = {
|
|
63
|
+
trace,
|
|
64
|
+
video,
|
|
65
|
+
viewport,
|
|
66
|
+
testIdAttribute
|
|
67
|
+
};
|
|
68
|
+
defaultProject.setUse(use);
|
|
69
|
+
defaultProject.setTestDir(testDir);
|
|
70
|
+
defaultProject.setDependencies(isSmokeTest ? ['smokeTest'] : []);
|
|
71
|
+
const defaultProjectConfig = [defaultProject.getProperties()];
|
|
72
|
+
return defaultProjectConfig;
|
|
73
|
+
}
|
|
74
|
+
function cleanupConfig() {
|
|
75
|
+
const cleanupProject = new _Project.Project('cleanup');
|
|
76
|
+
cleanupProject.setTestMatch(/.*\.teardown\.js/);
|
|
77
|
+
cleanupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
|
|
78
|
+
const cleanupProjectConfig = [cleanupProject.getProperties()];
|
|
79
|
+
return cleanupProjectConfig;
|
|
80
|
+
}
|
|
@@ -9,25 +9,24 @@ var _test = require("@playwright/test");
|
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var _readConfigFile = require("../readConfigFile");
|
|
11
11
|
var _configUtils = require("./config-utils");
|
|
12
|
+
var _ProjectConfiguration = require("./ProjectConfiguration");
|
|
12
13
|
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
13
14
|
const {
|
|
15
|
+
bddMode,
|
|
14
16
|
browsers,
|
|
15
17
|
isSmokeTest,
|
|
16
|
-
trace,
|
|
17
|
-
video,
|
|
18
18
|
isAuthMode,
|
|
19
19
|
openReportOn,
|
|
20
20
|
reportPath,
|
|
21
|
-
bddMode,
|
|
22
21
|
expectTimeout,
|
|
23
22
|
testTimeout,
|
|
24
23
|
authFilePath,
|
|
25
24
|
viewport,
|
|
26
|
-
featureFilesFolder,
|
|
27
|
-
stepDefinitionsFolder,
|
|
28
|
-
testIdAttribute,
|
|
29
25
|
globalTimeout,
|
|
30
|
-
customReporter
|
|
26
|
+
customReporter,
|
|
27
|
+
trace,
|
|
28
|
+
video,
|
|
29
|
+
testIdAttribute
|
|
31
30
|
} = uatConfig;
|
|
32
31
|
const projects = (0, _configUtils.getProjects)({
|
|
33
32
|
browsers,
|
|
@@ -38,18 +37,6 @@ const projects = (0, _configUtils.getProjects)({
|
|
|
38
37
|
testTimeout,
|
|
39
38
|
viewport
|
|
40
39
|
});
|
|
41
|
-
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
42
|
-
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
43
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
44
|
-
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
45
|
-
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
46
|
-
});
|
|
47
|
-
const use = {
|
|
48
|
-
trace,
|
|
49
|
-
video,
|
|
50
|
-
viewport,
|
|
51
|
-
testIdAttribute
|
|
52
|
-
};
|
|
53
40
|
let reporter = [['html', {
|
|
54
41
|
outputFolder: reportPath,
|
|
55
42
|
open: openReportOn
|
|
@@ -66,29 +53,23 @@ if (customReporter) {
|
|
|
66
53
|
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
67
54
|
*/
|
|
68
55
|
|
|
56
|
+
const use = {
|
|
57
|
+
trace,
|
|
58
|
+
video,
|
|
59
|
+
viewport,
|
|
60
|
+
testIdAttribute
|
|
61
|
+
};
|
|
62
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
63
|
+
featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
|
|
64
|
+
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
65
|
+
outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
|
|
66
|
+
uatPath: _path.default.join(process.cwd(), 'uat')
|
|
67
|
+
});
|
|
69
68
|
function getPlaywrightConfig() {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const smokeTestProject = isSmokeTest ? smokeTestConfig() : [];
|
|
75
|
-
function smokeTestConfig() {
|
|
76
|
-
const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
|
|
77
|
-
featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
|
|
78
|
-
stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
|
|
79
|
-
outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
|
|
80
|
-
uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
|
|
81
|
-
});
|
|
82
|
-
return [{
|
|
83
|
-
name: 'smokeTest',
|
|
84
|
-
testDir: smokeTestDir,
|
|
85
|
-
use: {
|
|
86
|
-
...commonConfig
|
|
87
|
-
},
|
|
88
|
-
dependencies: dependencies,
|
|
89
|
-
retries: 0
|
|
90
|
-
}];
|
|
91
|
-
}
|
|
69
|
+
const smokeTestProject = isSmokeTest ? (0, _ProjectConfiguration.smokeTestConfig)() : [];
|
|
70
|
+
const setupProject = isAuthMode ? (0, _ProjectConfiguration.setupConfig)() : [];
|
|
71
|
+
const isTearDown = JSON.parse(process.env.tearDown);
|
|
72
|
+
const cleanupProject = isTearDown ? (0, _ProjectConfiguration.cleanupConfig)() : [];
|
|
92
73
|
const playwrightConfig = {
|
|
93
74
|
testDir,
|
|
94
75
|
globalTimeout: globalTimeout || 3600000,
|
|
@@ -100,16 +81,7 @@ function getPlaywrightConfig() {
|
|
|
100
81
|
timeout: expectTimeout
|
|
101
82
|
},
|
|
102
83
|
use,
|
|
103
|
-
projects:
|
|
104
|
-
name: 'setup',
|
|
105
|
-
testMatch: /.*\.setup\.js/,
|
|
106
|
-
testDir: _path.default.join(process.cwd(), 'uat'),
|
|
107
|
-
teardown: 'cleanup'
|
|
108
|
-
}, ...smokeTestProject, {
|
|
109
|
-
name: 'cleanup',
|
|
110
|
-
testMatch: /.*\.teardown\.js/,
|
|
111
|
-
testDir: _path.default.join(process.cwd(), 'uat')
|
|
112
|
-
}, ...projects] : [...projects, ...smokeTestProject],
|
|
84
|
+
projects: [...setupProject, ...smokeTestProject, ...projects, ...cleanupProject],
|
|
113
85
|
...uatConfig
|
|
114
86
|
};
|
|
115
87
|
return playwrightConfig;
|
|
@@ -90,9 +90,11 @@ function main() {
|
|
|
90
90
|
// overriding the user config's from CLI
|
|
91
91
|
uatConfig.addAll(userArgConfig);
|
|
92
92
|
const modules = uatConfig.get('modules');
|
|
93
|
+
const tearDown = uatConfig.get('isTearDown');
|
|
93
94
|
|
|
94
95
|
//We need to change this process.env variable to pass the module name in future.
|
|
95
96
|
process.env.modules = modules;
|
|
97
|
+
process.env.tearDown = tearDown;
|
|
96
98
|
const {
|
|
97
99
|
isAuthMode,
|
|
98
100
|
editionOrder,
|