@zest-pw/test 1.0.2 → 1.0.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-reporter.d.ts","sourceRoot":"","sources":["../../utils/terminal-reporter.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"terminal-reporter.d.ts","sourceRoot":"","sources":["../../utils/terminal-reporter.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAuClD"}
|
|
@@ -53,20 +53,32 @@ function printTestResults(result) {
|
|
|
53
53
|
const sanitizedTitle = test.testTitle.replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
54
54
|
const projectName = test.projectName || 'chromium';
|
|
55
55
|
const outputDir = path.join('test-results', `${testFileName}-${sanitizedTitle}-${projectName}`);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const testTitle = `${projectName} › ${testFileName} › ${test.testTitle}`;
|
|
57
|
+
const remainder = (63 - testTitle.length) < 0 ? 0 : (63 - testTitle.length);
|
|
58
|
+
const spaces = '\x1b[40m \x1b[0m'.repeat(remainder);
|
|
59
|
+
console.log(`\n\x1b[40m${testTitle}${spaces}\x1b[0m`);
|
|
60
60
|
printTestSteps(executedSteps.length, allSteps, test.testTitle, outputDir);
|
|
61
|
-
console.log('');
|
|
62
61
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
let passedCount = 0;
|
|
63
|
+
let failedCount = 0;
|
|
64
|
+
let skippedCount = 0;
|
|
65
|
+
result.tests.forEach((test) => {
|
|
66
|
+
for (const step of test.steps) {
|
|
67
|
+
switch (step.statusName) {
|
|
68
|
+
case 'pass':
|
|
69
|
+
passedCount++;
|
|
70
|
+
break;
|
|
71
|
+
case 'fail':
|
|
72
|
+
failedCount++;
|
|
73
|
+
break;
|
|
74
|
+
case 'In Progress':
|
|
75
|
+
skippedCount++;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
console.log(`\x1b[30mTotal results:\x1b[0m \x1b[32m${passedCount} passed\x1b[0m\x1b[30m,\x1b[0m \x1b[31m${failedCount} failed\x1b[0m\x1b[30m,\x1b[0m \x1b[30m${skippedCount} skipped\x1b[0m`);
|
|
81
|
+
console.log('\n');
|
|
70
82
|
}
|
|
71
83
|
/**
|
|
72
84
|
* Prints test step information
|
|
@@ -76,30 +88,36 @@ function printTestInfo(test) {
|
|
|
76
88
|
* @param outputDir - Optional output directory path for saving screenshots
|
|
77
89
|
*/
|
|
78
90
|
function printTestSteps(executedCount, allSteps, testTitle, outputDir) {
|
|
79
|
-
const totalCount = allSteps.length;
|
|
80
91
|
console.log('');
|
|
81
92
|
allSteps.forEach((step, stepIndex) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
console.log('\x1b[31m- - - - - - - - - - - - - ERROR - - - - - - - - - - - - -\x1b[0m');
|
|
85
|
-
console.log('');
|
|
93
|
+
if (step.statusName === 'In Progress') {
|
|
94
|
+
return;
|
|
86
95
|
}
|
|
87
|
-
|
|
96
|
+
let stepTitle;
|
|
97
|
+
switch (step.statusName) {
|
|
98
|
+
case 'fail':
|
|
99
|
+
stepTitle = `\x1b[31m ${step.stepTitle}\x1b[0m`;
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
stepTitle = step.stepTitle;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
const statusEmoji = step.statusName === 'pass' ? '\x1b[32mPASSED ✓\x1b[0m' : step.statusName === 'fail' ? '\x1b[31mFAILED ✗\x1b[0m' : step.statusName === 'In Progress' ? '\x1b[30mSKIPPED ⊘\x1b[0m' : '⏱️';
|
|
106
|
+
console.log(`\x1b[30mSTEP ${stepIndex + 1}:\x1b[0m ${stepTitle}`);
|
|
88
107
|
printStepAttachments(step, testTitle, outputDir, stepIndex + 1);
|
|
89
|
-
console.log('');
|
|
90
|
-
console.log(`\x1b[30mstatus:\x1b[0m ${statusEmoji}\x1b[0m`);
|
|
91
|
-
console.log('');
|
|
92
108
|
if (step.error) {
|
|
93
109
|
const stackLines = step.error.message.split('\n').slice(0, 4);
|
|
110
|
+
console.log('\n\n\x1b[41m ERROR \x1b[0m\n');
|
|
94
111
|
stackLines.forEach((line) => console.log(`${line}`));
|
|
95
|
-
console.log('');
|
|
96
|
-
console.log('\x1b[31m- - - - - - - - - - - - - ERROR - - - - - - - - - - - - -\x1b[0m');
|
|
97
|
-
console.log('');
|
|
112
|
+
console.log('\n\x1b[41m ERROR \x1b[0m\n\n');
|
|
98
113
|
}
|
|
114
|
+
;
|
|
115
|
+
if (!step.error) {
|
|
116
|
+
console.log(`\n\x1b[30mstatus:\x1b[0m ${statusEmoji}\x1b[0m`);
|
|
117
|
+
console.log('\x1b[30m‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾\x1b[0m\n\n');
|
|
118
|
+
}
|
|
119
|
+
;
|
|
99
120
|
});
|
|
100
|
-
console.log('');
|
|
101
|
-
console.log(`\x1b[30mTotal results:\x1b[0m \x1b[32m${executedCount} passed,\x1b[0m \x1b[31m${totalCount - executedCount} failed\x1b[0m`);
|
|
102
|
-
console.log('');
|
|
103
121
|
}
|
|
104
122
|
/**
|
|
105
123
|
* Prints step attachments (screenshots, etc.)
|
|
@@ -112,7 +130,7 @@ function printStepAttachments(step, testTitle, outputDir, _stepNumber) {
|
|
|
112
130
|
if (!step.actualResult || step.actualResult.length === 0) {
|
|
113
131
|
return;
|
|
114
132
|
}
|
|
115
|
-
console.log(`\x1b[
|
|
133
|
+
console.log(`\x1b[30mscreenshot:\x1b[0m`);
|
|
116
134
|
step.actualResult.forEach((att) => {
|
|
117
135
|
const isErrorScreenshot = att.fileName?.includes('ERROR');
|
|
118
136
|
const emoji = isErrorScreenshot ? '💥' : att.image === 'image/png' ? '📸' : '📄';
|
|
@@ -132,8 +150,8 @@ function printStepAttachments(step, testTitle, outputDir, _stepNumber) {
|
|
|
132
150
|
else {
|
|
133
151
|
(0, save_screenshots_1.saveBase64Screenshot)(att.body, filename, 'screenshots', testTitle);
|
|
134
152
|
}
|
|
135
|
-
console.log(` \x1b[30m💾
|
|
136
|
-
console.log(` \x1b[30m📄
|
|
153
|
+
console.log(` \x1b[30m💾 saved:\x1b[0m Locally`);
|
|
154
|
+
console.log(` \x1b[30m📄 name:\x1b[0m ${filename}`);
|
|
137
155
|
}
|
|
138
156
|
catch (error) {
|
|
139
157
|
console.error(` ⚠️ Error saving screenshot: ${error}`);
|
package/package.json
CHANGED