playwright-slack-report-burak 1.2.3 → 1.2.5
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/dist/src/LayoutGenerator.js +92 -11
- package/dist/src/ResultsParser.js +17 -7
- package/package.json +1 -1
|
@@ -114,17 +114,98 @@ const generateFailuresReasons = async (summaryResults) => {
|
|
|
114
114
|
const failedNamesTitle = [];
|
|
115
115
|
const failsList = [];
|
|
116
116
|
|
|
117
|
-
for (let i = 0; i
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
for (let i = 0; i <= summaryResults.failures.length; i += 1) {
|
|
118
|
+
if (summaryResults.failures.length <=3) {
|
|
119
|
+
if (i === summaryResults.failures.length) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
const { failureReason, test, suiteName } = summaryResults.failures[i];
|
|
123
|
+
const parts = suiteName.split('/')[suiteName.split('/').length-1].replace('.spec.ts', '');
|
|
124
|
+
const backSlashedParts = parts.split('\\')[parts.split('\\').length-1];
|
|
125
|
+
if (failureReason.length > 750) {
|
|
126
|
+
failsList.push({
|
|
127
|
+
type: 'section',
|
|
128
|
+
text: {
|
|
129
|
+
type: 'mrkdwn',
|
|
130
|
+
text: `${i+1}. ${test.split(' [')[0]} (${backSlashedParts})\n:exclamation:Failure reason is too long, only first 750 characters are shown:exclamation:\n\`\`\`${failureReason.substring(0, 750)}\`\`\``,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
failsList.push({
|
|
135
|
+
type: 'section',
|
|
136
|
+
text: {
|
|
137
|
+
type: 'mrkdwn',
|
|
138
|
+
text: `${i+1}. ${test.split(' [')[0]} (${backSlashedParts})\n\`\`\`${failureReason}\`\`\``,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
} else if (3 < summaryResults.failures.length < 25) {
|
|
143
|
+
const { failureReason, test, suiteName } = summaryResults.failures[i];
|
|
144
|
+
const parts = suiteName.split('/')[suiteName.split('/').length-1].replace('.spec.ts', '');
|
|
145
|
+
const backSlashedParts = parts.split('\\')[parts.split('\\').length-1];
|
|
146
|
+
failsList.push({
|
|
147
|
+
type: 'section',
|
|
148
|
+
text: {
|
|
149
|
+
type: 'mrkdwn',
|
|
150
|
+
text: `${i+1}. ${test.split(' [')[0]} (${backSlashedParts})\n\`\`\`${failureReason.split('\n')[0]}\`\`\``,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
if (i === summaryResults.failures.length) {
|
|
154
|
+
fails.push({
|
|
155
|
+
type: 'section',
|
|
156
|
+
text: {
|
|
157
|
+
type: 'mrkdwn',
|
|
158
|
+
text: '⚠️ *There are too many failures to display in full detail. '+
|
|
159
|
+
'You can view more on CircleCI* ⚠️',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'actions',
|
|
164
|
+
elements: [
|
|
165
|
+
{
|
|
166
|
+
type: 'button',
|
|
167
|
+
text: {
|
|
168
|
+
type: 'plain_text',
|
|
169
|
+
text: 'Go to Build Details'
|
|
170
|
+
},
|
|
171
|
+
url: process.env.CIRCLE_BUILD_URL
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
} else if (summaryResults.failures.length >= 25) {
|
|
177
|
+
const { failureReason, test, suiteName } = summaryResults.failures[i];
|
|
178
|
+
const parts = suiteName.split('/')[suiteName.split('/').length-1].replace('.spec.ts', '');
|
|
179
|
+
const backSlashedParts = parts.split('\\')[parts.split('\\').length-1];
|
|
180
|
+
failsList.push({
|
|
181
|
+
type: 'section',
|
|
182
|
+
text: {
|
|
183
|
+
type: 'mrkdwn',
|
|
184
|
+
text: `${i+1}. ${test.split(' [')[0]} (${backSlashedParts})\n\`\`\`${failureReason.split('\n')[0]}\`\`\``,
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
if (i > 24) {
|
|
188
|
+
fails.push({
|
|
189
|
+
type: 'section',
|
|
190
|
+
text: {
|
|
191
|
+
type: 'mrkdwn',
|
|
192
|
+
text: '⚠️ *There are too many failures to display here '+
|
|
193
|
+
'You can view more on CircleCI* ⚠️',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
type: 'actions',
|
|
198
|
+
elements: [{
|
|
199
|
+
type: 'button',
|
|
200
|
+
text: {
|
|
201
|
+
type: 'plain_text',
|
|
202
|
+
text: 'Go to Build Details'
|
|
203
|
+
},
|
|
204
|
+
url: process.env.CIRCLE_BUILD_URL
|
|
205
|
+
}]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
128
209
|
}
|
|
129
210
|
|
|
130
211
|
// Decide on Titles For Listing Failures & Skips
|
|
@@ -62,7 +62,7 @@ class ResultsParser {
|
|
|
62
62
|
const flaky = [];
|
|
63
63
|
for (const suite of this.result) {
|
|
64
64
|
for (const test of suite.testSuite.tests) {
|
|
65
|
-
if (test.status === 'passed' && test.retry > 0) {
|
|
65
|
+
if (this.separateFlakyTests && test.status === 'passed' && test.retry > 0) {
|
|
66
66
|
flaky.push({
|
|
67
67
|
test: ResultsParser.getTestName(test),
|
|
68
68
|
retry: test.retry,
|
|
@@ -76,10 +76,18 @@ class ResultsParser {
|
|
|
76
76
|
const passes = [];
|
|
77
77
|
for (const suite of this.result) {
|
|
78
78
|
for (const test of suite.testSuite.tests) {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
if (this.separateFlakyTests) {
|
|
80
|
+
if (test.status === 'passed' && test.retry === 0) {
|
|
81
|
+
passes.push({
|
|
82
|
+
test: ResultsParser.getTestName(test),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
if (test.status === 'passed') {
|
|
87
|
+
passes.push({
|
|
88
|
+
test: ResultsParser.getTestName(test),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
93
|
}
|
|
@@ -159,7 +167,9 @@ class ResultsParser {
|
|
|
159
167
|
}
|
|
160
168
|
/** removes tests from the passed array that only passed on a retry (flaky).
|
|
161
169
|
* Does not modify param passed, returns a new passed array. */
|
|
162
|
-
|
|
170
|
+
/** Cuurently unused. Instead, we check the seperateflaky flag while
|
|
171
|
+
* passed array. */
|
|
172
|
+
/*doSeparateFlakyTests(passes, flakes) {
|
|
163
173
|
const _passes = new Map();
|
|
164
174
|
for (const pass of passes) {
|
|
165
175
|
_passes.set(pass.test, pass);
|
|
@@ -168,6 +178,6 @@ class ResultsParser {
|
|
|
168
178
|
_passes.delete(flake.test);
|
|
169
179
|
}
|
|
170
180
|
return [..._passes.values()];
|
|
171
|
-
}
|
|
181
|
+
}*/
|
|
172
182
|
}
|
|
173
183
|
exports.default = ResultsParser;
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lint-fix": "npx eslint . --ext .ts --fix"
|
|
31
31
|
},
|
|
32
32
|
"name": "playwright-slack-report-burak",
|
|
33
|
-
"version": "1.2.
|
|
33
|
+
"version": "1.2.5",
|
|
34
34
|
"main": "index.js",
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|