@zohodesk/testinglibrary 0.0.38-n20-experimental → 0.0.39-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.
|
@@ -11,5 +11,6 @@ const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
|
11
11
|
class ReporterConstants {
|
|
12
12
|
static DEFAULT_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/playwright-test-results.json`;
|
|
13
13
|
static LAST_RUN_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/.last-run.json`;
|
|
14
|
+
static DEFAULT_UNIT_TEST_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/unit-test/unit_reports/report.html`;
|
|
14
15
|
}
|
|
15
16
|
exports.default = ReporterConstants;
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = generateReport;
|
|
8
8
|
var _child_process = require("child_process");
|
|
9
|
-
var _fs = require("fs");
|
|
10
9
|
var _path = _interopRequireDefault(require("path"));
|
|
11
10
|
var _os = require("os");
|
|
12
11
|
var _logger = require("../../utils/logger");
|
|
13
12
|
var _rootPath = require("../../utils/rootPath");
|
|
14
13
|
var _readConfigFile = require("./readConfigFile");
|
|
14
|
+
var _reporterConstants = _interopRequireDefault(require("./constants/reporterConstants"));
|
|
15
15
|
async function generateReport(reportType) {
|
|
16
16
|
if (reportType === 'unit-test') {
|
|
17
17
|
return openUnitTestReport();
|
|
@@ -19,23 +19,11 @@ async function generateReport(reportType) {
|
|
|
19
19
|
return openPlaywrightReport(reportType);
|
|
20
20
|
}
|
|
21
21
|
function openUnitTestReport() {
|
|
22
|
-
const
|
|
23
|
-
const cwd = process.cwd();
|
|
24
|
-
|
|
25
|
-
// Allow overriding via --reportPath=<path> argument
|
|
26
|
-
const reportPathArg = userArgs.find(arg => arg.startsWith('--reportPath='));
|
|
27
|
-
|
|
28
|
-
// Candidate paths in priority order
|
|
29
|
-
const candidates = [_path.default.resolve(cwd, 'unit_reports', 'report.html'), _path.default.resolve(cwd, 'test-slices', 'unit-test', 'unit_reports', 'report.html')];
|
|
30
|
-
const reportPath = reportPathArg ? _path.default.resolve(reportPathArg.split('=')[1]) : candidates.find(p => (0, _fs.existsSync)(p)) || candidates[0];
|
|
31
|
-
if (!(0, _fs.existsSync)(reportPath)) {
|
|
32
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Unit test report not found at: ${reportPath}\nRun unit tests first using "ZDTestingFramework unit-test" to generate the report.`);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
22
|
+
const reportPath = _path.default.resolve(process.cwd(), _reporterConstants.default.DEFAULT_UNIT_TEST_REPORTER_PATH);
|
|
35
23
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, `Opening unit test report: ${reportPath}`);
|
|
36
24
|
const os = (0, _os.platform)();
|
|
37
25
|
const openCommand = os === 'darwin' ? 'open' : os === 'win32' ? 'start' : 'xdg-open';
|
|
38
|
-
(0, _child_process.
|
|
26
|
+
(0, _child_process.execFile)(openCommand, [reportPath], error => {
|
|
39
27
|
if (error) {
|
|
40
28
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Failed to open report: ${error.message}`);
|
|
41
29
|
}
|
|
@@ -43,7 +31,6 @@ function openUnitTestReport() {
|
|
|
43
31
|
});
|
|
44
32
|
}
|
|
45
33
|
function openPlaywrightReport(reportType) {
|
|
46
|
-
// await preProcessReport()
|
|
47
34
|
const userArgs = process.argv.slice(3);
|
|
48
35
|
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)(reportType));
|
|
49
36
|
const command = playwrightPath;
|
package/build/lib/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _testRunner = _interopRequireDefault(require("../core/playwright/test-runner"));
|
|
5
|
-
var _unitTestingFramework =
|
|
5
|
+
var _unitTestingFramework = require("@zohodesk/unit-testing-framework");
|
|
6
6
|
var _reportGenerator = _interopRequireDefault(require("../core/playwright/report-generator"));
|
|
7
7
|
var _codegen = _interopRequireDefault(require("../core/playwright/codegen"));
|
|
8
8
|
var _logger = require("../utils/logger");
|
|
@@ -24,12 +24,12 @@ switch (option) {
|
|
|
24
24
|
{
|
|
25
25
|
const testFile = process.argv[3];
|
|
26
26
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Unit Tests..');
|
|
27
|
-
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const options = {};
|
|
28
|
+
if (testFile) {
|
|
29
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Filtering tests with pattern: ${testFile}`);
|
|
30
|
+
options.testPathPattern = testFile;
|
|
31
|
+
}
|
|
32
|
+
(0, _unitTestingFramework.createJestRunner)(options);
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
case 'validate':
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39-n20-experimental",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@zohodesk/testinglibrary",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.39-n20-experimental",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@playwright/test": "1.56.1",
|
|
16
16
|
"@reportportal/agent-js-playwright": "5.2.2",
|
|
17
17
|
"@testing-library/jest-dom": "6.9.1",
|
|
18
|
-
"@zohodesk/unit-testing-framework": "0.0.
|
|
18
|
+
"@zohodesk/unit-testing-framework": "0.0.26-experimental",
|
|
19
19
|
"babel-jest": "30.2.0",
|
|
20
20
|
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
21
21
|
"fast-glob": "3.3.3",
|
|
@@ -3526,20 +3526,17 @@
|
|
|
3526
3526
|
]
|
|
3527
3527
|
},
|
|
3528
3528
|
"node_modules/@zohodesk/unit-testing-framework": {
|
|
3529
|
-
"version": "0.0.
|
|
3530
|
-
"resolved": "https://registry.npmjs.org/@zohodesk/unit-testing-framework/-/unit-testing-framework-0.0.
|
|
3531
|
-
"integrity": "sha512-
|
|
3532
|
-
"license": "
|
|
3529
|
+
"version": "0.0.26-experimental",
|
|
3530
|
+
"resolved": "https://registry.npmjs.org/@zohodesk/unit-testing-framework/-/unit-testing-framework-0.0.26-experimental.tgz",
|
|
3531
|
+
"integrity": "sha512-5auIVEtYCyIleALN93gc/3f0WxWxox0KP3a4w0amR9wx4YhKujxRJHbjwyv0moBhppTz3fjNsDKBZgCkTmiF4w==",
|
|
3532
|
+
"license": "UNLICENSED",
|
|
3533
3533
|
"dependencies": {
|
|
3534
3534
|
"@babel/core": "7.29.0",
|
|
3535
3535
|
"@babel/preset-env": "7.29.0",
|
|
3536
3536
|
"@jest/core": "30.2.0",
|
|
3537
3537
|
"@jest/types": "30.2.0",
|
|
3538
3538
|
"babel-jest": "30.2.0",
|
|
3539
|
-
"jest-environment-
|
|
3540
|
-
},
|
|
3541
|
-
"peerDependencies": {
|
|
3542
|
-
"jest": "30.2.0"
|
|
3539
|
+
"jest-environment-jsdom": "30.2.0"
|
|
3543
3540
|
}
|
|
3544
3541
|
},
|
|
3545
3542
|
"node_modules/acorn": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39-n20-experimental",
|
|
4
4
|
"main": "./build/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node bin/postinstall.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@playwright/test": "1.56.1",
|
|
27
27
|
"@reportportal/agent-js-playwright": "5.2.2",
|
|
28
28
|
"@testing-library/jest-dom": "6.9.1",
|
|
29
|
-
"@zohodesk/unit-testing-framework": "0.0.
|
|
29
|
+
"@zohodesk/unit-testing-framework": "0.0.26-experimental",
|
|
30
30
|
"babel-jest": "30.2.0",
|
|
31
31
|
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
32
32
|
"fast-glob": "3.3.3",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@babel/core": "7.29.0",
|
|
53
53
|
"@babel/node": "7.29.0",
|
|
54
54
|
"@babel/plugin-transform-runtime": "7.28.3",
|
|
55
|
-
"@babel/preset-env": "7.29.0",
|
|
55
|
+
"@babel/preset-env": "7.29.0",
|
|
56
56
|
"@babel/runtime": "7.28.6",
|
|
57
57
|
"commander": "14.0.2",
|
|
58
58
|
"jest-html-reporter": "4.3.0"
|
package/playwright.config.js
CHANGED
|
@@ -29,6 +29,7 @@ export default defineConfig({
|
|
|
29
29
|
name: 'chromium',
|
|
30
30
|
use: {
|
|
31
31
|
...devices['Desktop Chrome'],
|
|
32
|
+
permissions: ['geolocation', 'notifications', 'camera', 'microphone'],
|
|
32
33
|
storageState: path.resolve(process.cwd(), configConstants.TEST_SLICE_FOLDER, stage, 'playwright/.auth/user.json')
|
|
33
34
|
},
|
|
34
35
|
dependencies: ['setup'],
|
|
@@ -42,6 +43,7 @@ export default defineConfig({
|
|
|
42
43
|
},
|
|
43
44
|
use: {
|
|
44
45
|
...devices['Desktop Firefox'],
|
|
46
|
+
permissions: [ 'camera', 'microphone'],
|
|
45
47
|
storageState: path.resolve(process.cwd(), configConstants.TEST_SLICE_FOLDER, stage, 'playwright/.auth/user.json')
|
|
46
48
|
},
|
|
47
49
|
dependencies: ['setup'],
|