playwright-slack-report-burak 1.3.6 → 1.4.0
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 +87 -54
- package/dist/src/SlackReporter.js +33 -31
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
//exports.generateBlocks =
|
|
4
|
+
//exports.generateFailures =
|
|
4
5
|
exports.generateFailuresReasons =
|
|
5
6
|
exports.generateProblemSuiteList =
|
|
6
7
|
exports.generateProblemCaseList =
|
|
7
|
-
exports.generateBlocks =
|
|
8
8
|
exports.generateAllRunSuites =
|
|
9
9
|
void 0;
|
|
10
10
|
|
|
11
|
+
/*
|
|
11
12
|
const generateBlocks = async (summaryResults, maxNumberOfFailures) => {
|
|
12
13
|
const meta = [];
|
|
13
14
|
const header = {
|
|
@@ -113,6 +114,7 @@ const generateFailures = async (summaryResults) => {
|
|
|
113
114
|
...thread,
|
|
114
115
|
];
|
|
115
116
|
};
|
|
117
|
+
*/
|
|
116
118
|
|
|
117
119
|
const generateAllRunSuites = async (summaryResults) => {
|
|
118
120
|
const suitesResults = [];
|
|
@@ -144,30 +146,29 @@ const generateAllRunSuites = async (summaryResults) => {
|
|
|
144
146
|
allSuitesTitle[0] = '*Suites Run:*\n';
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
// Push data into array to create the "List of
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`${allSuitesTitle}${[...new Set(allSuites)].map((value, index) => `*${index + 1}.* ${value}`).join('\n')}`
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
type: 'section',
|
|
159
|
-
text: {
|
|
160
|
-
type: 'mrkdwn',
|
|
161
|
-
text: ` `,
|
|
162
|
-
},
|
|
149
|
+
// Push data into array to create the "List of All Run Test Suites"
|
|
150
|
+
suitesResults.push({
|
|
151
|
+
type: 'section',
|
|
152
|
+
text: {
|
|
153
|
+
type: 'mrkdwn',
|
|
154
|
+
text:
|
|
155
|
+
`${allSuitesTitle}${[...new Set(allSuites)].map((value, index) => `*${index + 1}.* ${value}`).join('\n')}`
|
|
163
156
|
},
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'section',
|
|
160
|
+
text: {
|
|
161
|
+
type: 'mrkdwn',
|
|
162
|
+
text: ` `,
|
|
166
163
|
},
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: 'divider',
|
|
167
|
+
},
|
|
168
|
+
)
|
|
169
|
+
return [
|
|
170
|
+
...suitesResults,
|
|
171
|
+
];
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
const generateProblemSuiteList = async (summaryResults) => {
|
|
@@ -339,48 +340,80 @@ const generateProblemCaseList = async (summaryResults) => {
|
|
|
339
340
|
|
|
340
341
|
// Decide on Titles For Listing Failures, Skips & Flakies
|
|
341
342
|
if (summaryResults.failed === 1) {
|
|
342
|
-
failedNamesTitle[0] = '
|
|
343
|
+
failedNamesTitle[0] = '*Failed Test Case:*\n';
|
|
343
344
|
}
|
|
344
345
|
if (summaryResults.failed > 1) {
|
|
345
|
-
failedNamesTitle[0] = '
|
|
346
|
+
failedNamesTitle[0] = '*Failed Test Cases:*\n';
|
|
346
347
|
}
|
|
347
348
|
if (summaryResults.flaky === 1) {
|
|
348
|
-
flakyNamesTitle[0] = '
|
|
349
|
+
flakyNamesTitle[0] = '*Flaky Test Case:*\n';
|
|
349
350
|
}
|
|
350
351
|
if (summaryResults.flaky > 1) {
|
|
351
|
-
flakyNamesTitle[0] = '
|
|
352
|
+
flakyNamesTitle[0] = '*Flaky Test Cases:*\n';
|
|
352
353
|
}
|
|
353
354
|
if (summaryResults.skipped === 1) {
|
|
354
|
-
skippedNamesTitle[0] = '
|
|
355
|
+
skippedNamesTitle[0] = '*Skipped Test Case:*\n';
|
|
355
356
|
}
|
|
356
357
|
if (summaryResults.skipped > 1) {
|
|
357
|
-
skippedNamesTitle[0] = '
|
|
358
|
+
skippedNamesTitle[0] = '*Skipped Test Cases:*\n';
|
|
358
359
|
}
|
|
359
360
|
|
|
360
|
-
//
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
361
|
+
// Function to safely push text to casesResults
|
|
362
|
+
const safePush = (title, list, array) => {
|
|
363
|
+
let text = `${title}${list.map((value, index) => `*${index + 1}.* ${value}`).join('\n')}\n`;
|
|
364
|
+
if (text.length > 2700) {
|
|
365
|
+
text = text.substring(0, 2700) + '...';
|
|
366
|
+
array.push({
|
|
367
|
+
type: 'section',
|
|
368
|
+
text: {
|
|
369
|
+
type: 'mrkdwn',
|
|
370
|
+
text: text + '\n\n\n' + '⚠️ *There are too many items to display here. ' +
|
|
371
|
+
'You can view more on CircleCI* ⚠️',
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
type: 'actions',
|
|
376
|
+
elements: [{
|
|
377
|
+
type: 'button',
|
|
378
|
+
text: {
|
|
379
|
+
type: 'plain_text',
|
|
380
|
+
text: 'Go to Build Details'
|
|
381
|
+
},
|
|
382
|
+
url: process.env.CIRCLE_BUILD_URL
|
|
383
|
+
}]
|
|
384
|
+
});
|
|
385
|
+
} else {
|
|
386
|
+
casesResults.push({
|
|
387
|
+
type: 'section',
|
|
388
|
+
text: {
|
|
389
|
+
type: 'mrkdwn',
|
|
390
|
+
text: text,
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// Push each section with character limit check
|
|
397
|
+
if (summaryResults.tests.length !== summaryResults.passed) {
|
|
398
|
+
safePush(failedNamesTitle, failsList, casesResults);
|
|
399
|
+
safePush(flakyNamesTitle, flakyList, casesResults);
|
|
400
|
+
safePush(skippedNamesTitle, skipsList, casesResults);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Add additional sections if needed
|
|
404
|
+
casesResults.push(
|
|
405
|
+
{
|
|
406
|
+
type: 'section',
|
|
407
|
+
text: {
|
|
408
|
+
type: 'mrkdwn',
|
|
409
|
+
text: ` `,
|
|
410
|
+
},
|
|
378
411
|
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
412
|
+
{
|
|
413
|
+
type: 'divider',
|
|
414
|
+
},
|
|
415
|
+
);
|
|
416
|
+
|
|
384
417
|
return [
|
|
385
418
|
...casesResults,
|
|
386
419
|
];
|
|
@@ -505,7 +538,7 @@ const generateFailuresReasons = async (summaryResults) => {
|
|
|
505
538
|
...failsList,
|
|
506
539
|
];
|
|
507
540
|
};
|
|
508
|
-
exports.generateFailures = generateFailures;
|
|
541
|
+
//exports.generateFailures = generateFailures;
|
|
509
542
|
exports.generateFailuresReasons = generateFailuresReasons;
|
|
510
543
|
exports.generateProblemSuiteList = generateProblemSuiteList;
|
|
511
544
|
exports.generateProblemCaseList = generateProblemCaseList;
|
|
@@ -111,8 +111,8 @@ class SlackReporter {
|
|
|
111
111
|
});
|
|
112
112
|
// eslint-disable-next-line no-console
|
|
113
113
|
console.log(JSON.stringify(result, null, 2));
|
|
114
|
-
if (this.showInThread
|
|
115
|
-
|
|
114
|
+
if (this.showInThread) {
|
|
115
|
+
/*for (let i = 0; i < result.length; i += 1) {
|
|
116
116
|
// eslint-disable-next-line no-await-in-loop
|
|
117
117
|
await slackClient.attachDetailsToThread({
|
|
118
118
|
channelIds: [result[i].channel],
|
|
@@ -120,7 +120,7 @@ class SlackReporter {
|
|
|
120
120
|
summaryResults: resultSummary,
|
|
121
121
|
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
122
122
|
});
|
|
123
|
-
}*/
|
|
123
|
+
}*/
|
|
124
124
|
for (let i = 0; i < result.length; i += 1) {
|
|
125
125
|
// eslint-disable-next-line no-await-in-loop
|
|
126
126
|
await slackClient.attachDetailsToThreadRuns({
|
|
@@ -131,35 +131,37 @@ class SlackReporter {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
if ((resultSummary.failures.length > 0 || resultSummary.skipped > 0 || resultSummary.flaky > 0)) {
|
|
135
|
+
for (let i = 0; i < result.length; i += 1) {
|
|
136
|
+
// eslint-disable-next-line no-await-in-loop
|
|
137
|
+
await slackClient.attachDetailsToThreadSuites({
|
|
138
|
+
channelIds: [result[i].channel],
|
|
139
|
+
ts: result[i].ts,
|
|
140
|
+
summaryResults: resultSummary,
|
|
141
|
+
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
145
|
+
for (let i = 0; i < result.length; i += 1) {
|
|
146
|
+
// eslint-disable-next-line no-await-in-loop
|
|
147
|
+
await slackClient.attachDetailsToThreadCases({
|
|
148
|
+
channelIds: [result[i].channel],
|
|
149
|
+
ts: result[i].ts,
|
|
150
|
+
summaryResults: resultSummary,
|
|
151
|
+
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
for (let i = 0; i < result.length; i += 1) {
|
|
156
|
+
// eslint-disable-next-line no-await-in-loop
|
|
157
|
+
await slackClient.attachDetailsToThreadReasons({
|
|
158
|
+
channelIds: [result[i].channel],
|
|
159
|
+
ts: result[i].ts,
|
|
160
|
+
summaryResults: resultSummary,
|
|
161
|
+
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
}
|
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.
|
|
33
|
+
"version": "1.4.0",
|
|
34
34
|
"main": "index.js",
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|