@zohodesk/testinglibrary 0.4.66-n18-experimental → 0.4.68-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/.gitlab-ci.yml +32 -0
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/helpers/auth/accountLogin.js +1 -2
- package/build/core/playwright/setup/config-creator.js +1 -1
- package/build/core/playwright/setup/config-utils.js +19 -0
- package/build/core/playwright/setup/qc-custom-reporter.js +2 -2
- package/build/core/playwright/test-runner.js +4 -3
- package/build/core/playwright/types.js +1 -0
- package/build/utils/fileUtils.js +18 -0
- package/npm-shrinkwrap.json +15 -15
- package/package.json +5 -5
- package/playwright.config.js +1 -4
package/.gitlab-ci.yml
CHANGED
|
@@ -115,3 +115,35 @@ uat-nobdd:
|
|
|
115
115
|
when: always
|
|
116
116
|
paths:
|
|
117
117
|
- nobdd/uat/playwright-report
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
uatmodule:
|
|
121
|
+
stage: uat
|
|
122
|
+
script:
|
|
123
|
+
- cd examples
|
|
124
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
125
|
+
- output=$(npm run uatmodule)
|
|
126
|
+
- echo "$output"
|
|
127
|
+
- node ../ValidateUATReport.js examples
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
artifacts:
|
|
131
|
+
when: always
|
|
132
|
+
paths:
|
|
133
|
+
- examples/uat/playwright-report
|
|
134
|
+
|
|
135
|
+
uatconfigmodule:
|
|
136
|
+
stage: uat
|
|
137
|
+
script:
|
|
138
|
+
- cd examples
|
|
139
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
140
|
+
- output=$(npm run uatconfigmodule)
|
|
141
|
+
- echo "$output"
|
|
142
|
+
- node ../ValidateUATReport.js examples
|
|
143
|
+
|
|
144
|
+
artifacts:
|
|
145
|
+
when: always
|
|
146
|
+
paths:
|
|
147
|
+
- examples/uat/playwright-report
|
|
148
|
+
|
|
149
|
+
|
|
@@ -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'];
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules'];
|
|
@@ -13,8 +13,7 @@ async function accountLogin(page, useremail, password) {
|
|
|
13
13
|
await page.locator('#nextbtn').click();
|
|
14
14
|
const domainUrlOrigin = (0, _getUrlOrigin.default)(process.env.domain);
|
|
15
15
|
await page.waitForNavigation();
|
|
16
|
-
if (page.url().includes(
|
|
17
|
-
console.log("Detected 'sessions-reminder' or 'announcement' page. Redirecting to domain origin:", domainUrlOrigin);
|
|
16
|
+
if (!page.url().includes(domainUrlOrigin)) {
|
|
18
17
|
await page.goto(domainUrlOrigin);
|
|
19
18
|
}
|
|
20
19
|
await page.waitForURL(`${domainUrlOrigin}/**`);
|
|
@@ -50,7 +50,7 @@ let reporter = [['html', {
|
|
|
50
50
|
outputFolder: reportPath,
|
|
51
51
|
open: openReportOn
|
|
52
52
|
}], ['list'], ['json', {
|
|
53
|
-
outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'test-results.json')
|
|
53
|
+
outputFile: _path.default.join(process.cwd(), 'uat', 'json-test-results', 'test-results.json')
|
|
54
54
|
}], ['./custom-reporter.js'], ['./qc-custom-reporter.js']];
|
|
55
55
|
if (customReporter) {
|
|
56
56
|
reporter = [customReporter, ...reporter];
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getBrowsersList = getBrowsersList;
|
|
8
|
+
exports.getModulePathForFeatureFiles = getModulePathForFeatureFiles;
|
|
8
9
|
exports.getProjects = getProjects;
|
|
9
10
|
exports.getTestDir = getTestDir;
|
|
10
11
|
var _test = require("@playwright/test");
|
|
@@ -140,9 +141,27 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
140
141
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Unable to read test summary from the ${reportPath}. Verify If File Exists in the path`);
|
|
141
142
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Going to run all test cases');
|
|
142
143
|
}
|
|
144
|
+
} else if (process.env.modules !== 'undefined' && process.env.modules.length > 0) {
|
|
145
|
+
let modules = process.env.modules;
|
|
146
|
+
let moduleList = modules.split(',');
|
|
147
|
+
return getModulePathForFeatureFiles(moduleList);
|
|
143
148
|
}
|
|
144
149
|
return [_path.default.join(cwd, 'uat', '**', '*.feature')];
|
|
145
150
|
}
|
|
151
|
+
function getModulePathForFeatureFiles(moduleList) {
|
|
152
|
+
let validModuleList = [];
|
|
153
|
+
moduleList.forEach(moduleName => {
|
|
154
|
+
let modulePath = _path.default.join(process.cwd(), 'uat', 'modules', '**', `${moduleName}`);
|
|
155
|
+
if ((0, _fileUtils.checkIfFolderExistsWithPattern)(modulePath)) {
|
|
156
|
+
validModuleList.push(_path.default.join(modulePath, '**', '*.feature'));
|
|
157
|
+
} else {
|
|
158
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Module ${moduleName} does not exist, Please check the module name`);
|
|
159
|
+
validModuleList = [];
|
|
160
|
+
return validModuleList;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return validModuleList;
|
|
164
|
+
}
|
|
146
165
|
function getTestDir(bddMode, cwd, {
|
|
147
166
|
stepDefinitionsFolder
|
|
148
167
|
}) {
|
|
@@ -10,9 +10,9 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _codeFrame = require("@babel/code-frame");
|
|
11
11
|
class CustomJsonReporter {
|
|
12
12
|
constructor({
|
|
13
|
-
outputFile = '
|
|
13
|
+
outputFile = 'test-results.json'
|
|
14
14
|
} = {}) {
|
|
15
|
-
this.outputFile = _path.default.resolve(outputFile);
|
|
15
|
+
this.outputFile = _path.default.resolve(process.cwd(), 'uat/test-results/', outputFile);
|
|
16
16
|
this.rootSuite = null;
|
|
17
17
|
this.report = {
|
|
18
18
|
config: {},
|
|
@@ -83,15 +83,16 @@ function runPlaywright(command, args) {
|
|
|
83
83
|
function main() {
|
|
84
84
|
// Getting the default config's from framework
|
|
85
85
|
const uatConfig = new _Configuration.default((0, _readConfigFile.getDefaultConfig)());
|
|
86
|
-
|
|
87
86
|
// overriding the application config's from project
|
|
88
|
-
|
|
89
87
|
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
90
88
|
const mode = userArgConfig.get("mode");
|
|
91
89
|
uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(mode)));
|
|
92
|
-
|
|
93
90
|
// overriding the user config's from CLI
|
|
94
91
|
uatConfig.addAll(userArgConfig);
|
|
92
|
+
const modules = uatConfig.get('modules');
|
|
93
|
+
|
|
94
|
+
//We need to change this process.env variable to pass the module name in future.
|
|
95
|
+
process.env.modules = modules;
|
|
95
96
|
const {
|
|
96
97
|
isAuthMode,
|
|
97
98
|
editionOrder,
|
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
40
40
|
* @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
|
|
41
41
|
* @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
|
|
42
|
+
* @property {string} modules: Modules name to be used for running the specific module test cases.
|
|
42
43
|
*/
|
|
43
44
|
"use strict";
|
package/build/utils/fileUtils.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.checkIfFileExists = checkIfFileExists;
|
|
8
|
+
exports.checkIfFolderExistsWithPattern = checkIfFolderExistsWithPattern;
|
|
8
9
|
exports.deleteFile = deleteFile;
|
|
9
10
|
exports.deleteFolder = deleteFolder;
|
|
10
11
|
exports.readFileContents = readFileContents;
|
|
@@ -12,6 +13,9 @@ exports.writeFileContents = writeFileContents;
|
|
|
12
13
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
14
|
var _path = _interopRequireDefault(require("path"));
|
|
14
15
|
var _logger = require("./logger");
|
|
16
|
+
var glob = _interopRequireWildcard(require("glob"));
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
19
|
function checkIfFileExists(file) {
|
|
16
20
|
try {
|
|
17
21
|
_fs.default.accessSync(file, _fs.default.constants.F_OK);
|
|
@@ -69,4 +73,18 @@ function deleteFolder(folderPath) {
|
|
|
69
73
|
throw new Error(`Error while deleting the test data file: ${folderPath}`);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// This function uses glob to check if a folder exists with a specific pattern
|
|
79
|
+
// Glob is define patterns for matching file and directory names based on wildcards
|
|
80
|
+
function checkIfFolderExistsWithPattern(folderPath) {
|
|
81
|
+
try {
|
|
82
|
+
if (glob.sync(folderPath).length > 0) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
} catch (err) {
|
|
87
|
+
_logger.Logger.error(err);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
72
90
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.68-n18-experimental",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@zohodesk/testinglibrary",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.68-n18-experimental",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@babel/code-frame": "7.27.1",
|
|
14
14
|
"@babel/preset-react": "7.22.5",
|
|
15
15
|
"@cucumber/cucumber": "11.2.0",
|
|
16
|
-
"@playwright/test": "1.
|
|
16
|
+
"@playwright/test": "1.52.0",
|
|
17
17
|
"@reportportal/agent-js-playwright": "5.1.11",
|
|
18
18
|
"@testing-library/jest-dom": "5.11.9",
|
|
19
19
|
"@testing-library/react": "11.2.7",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"jest": "29.6.2",
|
|
25
25
|
"jest-environment-jsdom": "29.6.2",
|
|
26
26
|
"msw": "1.2.3",
|
|
27
|
-
"playwright": "1.
|
|
27
|
+
"playwright": "1.52.0",
|
|
28
28
|
"playwright-bdd": "8.2.1",
|
|
29
29
|
"supports-color": "8.1.1"
|
|
30
30
|
},
|
|
@@ -3095,12 +3095,12 @@
|
|
|
3095
3095
|
}
|
|
3096
3096
|
},
|
|
3097
3097
|
"node_modules/@playwright/test": {
|
|
3098
|
-
"version": "1.
|
|
3099
|
-
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.
|
|
3100
|
-
"integrity": "sha512-
|
|
3098
|
+
"version": "1.52.0",
|
|
3099
|
+
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.52.0.tgz",
|
|
3100
|
+
"integrity": "sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==",
|
|
3101
3101
|
"license": "Apache-2.0",
|
|
3102
3102
|
"dependencies": {
|
|
3103
|
-
"playwright": "1.
|
|
3103
|
+
"playwright": "1.52.0"
|
|
3104
3104
|
},
|
|
3105
3105
|
"bin": {
|
|
3106
3106
|
"playwright": "cli.js"
|
|
@@ -8661,12 +8661,12 @@
|
|
|
8661
8661
|
}
|
|
8662
8662
|
},
|
|
8663
8663
|
"node_modules/playwright": {
|
|
8664
|
-
"version": "1.
|
|
8665
|
-
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.
|
|
8666
|
-
"integrity": "sha512-
|
|
8664
|
+
"version": "1.52.0",
|
|
8665
|
+
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz",
|
|
8666
|
+
"integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==",
|
|
8667
8667
|
"license": "Apache-2.0",
|
|
8668
8668
|
"dependencies": {
|
|
8669
|
-
"playwright-core": "1.
|
|
8669
|
+
"playwright-core": "1.52.0"
|
|
8670
8670
|
},
|
|
8671
8671
|
"bin": {
|
|
8672
8672
|
"playwright": "cli.js"
|
|
@@ -8834,9 +8834,9 @@
|
|
|
8834
8834
|
}
|
|
8835
8835
|
},
|
|
8836
8836
|
"node_modules/playwright-core": {
|
|
8837
|
-
"version": "1.
|
|
8838
|
-
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.
|
|
8839
|
-
"integrity": "sha512
|
|
8837
|
+
"version": "1.52.0",
|
|
8838
|
+
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz",
|
|
8839
|
+
"integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==",
|
|
8840
8840
|
"license": "Apache-2.0",
|
|
8841
8841
|
"bin": {
|
|
8842
8842
|
"playwright-core": "cli.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.68-n18-experimental",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@babel/code-frame": "7.27.1",
|
|
25
25
|
"@babel/preset-react": "7.22.5",
|
|
26
26
|
"@cucumber/cucumber": "11.2.0",
|
|
27
|
-
"@playwright/test": "1.
|
|
27
|
+
"@playwright/test": "1.52.0",
|
|
28
28
|
"@reportportal/agent-js-playwright": "5.1.11",
|
|
29
29
|
"@testing-library/jest-dom": "5.11.9",
|
|
30
30
|
"@testing-library/react": "11.2.7",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"jest": "29.6.2",
|
|
36
36
|
"jest-environment-jsdom": "29.6.2",
|
|
37
37
|
"msw": "1.2.3",
|
|
38
|
-
"playwright": "1.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
38
|
+
"playwright": "1.52.0",
|
|
39
|
+
"supports-color": "8.1.1",
|
|
40
|
+
"playwright-bdd": "8.2.1"
|
|
41
41
|
},
|
|
42
42
|
"bin": {
|
|
43
43
|
"ZDTestingFramework": "./bin/cli.js"
|
package/playwright.config.js
CHANGED
|
@@ -8,10 +8,7 @@ export default defineConfig({
|
|
|
8
8
|
outputDir: path.join(process.cwd(), 'uat', 'test-results'),
|
|
9
9
|
fullyParallel: true,
|
|
10
10
|
retries: process.env.CI ? 2 : 0,
|
|
11
|
-
reporter: [
|
|
12
|
-
['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }],
|
|
13
|
-
['./src/core/playwright/setup/qc-custom-reporter.js']
|
|
14
|
-
],
|
|
11
|
+
reporter: [['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }]],
|
|
15
12
|
timeout: 60 * 1000,
|
|
16
13
|
expect: {
|
|
17
14
|
timeout: 5 * 1000,
|