playwright-slack-report-burak 1.3.7 → 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.
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateFailures =
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 = [];
@@ -338,48 +340,80 @@ const generateProblemCaseList = async (summaryResults) => {
338
340
 
339
341
  // Decide on Titles For Listing Failures, Skips & Flakies
340
342
  if (summaryResults.failed === 1) {
341
- failedNamesTitle[0] = '\n*Failed Test Case:*\n';
343
+ failedNamesTitle[0] = '*Failed Test Case:*\n';
342
344
  }
343
345
  if (summaryResults.failed > 1) {
344
- failedNamesTitle[0] = '\n*Failed Test Cases:*\n';
346
+ failedNamesTitle[0] = '*Failed Test Cases:*\n';
345
347
  }
346
348
  if (summaryResults.flaky === 1) {
347
- flakyNamesTitle[0] = '\n*Flaky Test Case:*\n';
349
+ flakyNamesTitle[0] = '*Flaky Test Case:*\n';
348
350
  }
349
351
  if (summaryResults.flaky > 1) {
350
- flakyNamesTitle[0] = '\n*Flaky Test Cases:*\n';
352
+ flakyNamesTitle[0] = '*Flaky Test Cases:*\n';
351
353
  }
352
354
  if (summaryResults.skipped === 1) {
353
- skippedNamesTitle[0] = '\n*Skipped Test Case:*\n';
355
+ skippedNamesTitle[0] = '*Skipped Test Case:*\n';
354
356
  }
355
357
  if (summaryResults.skipped > 1) {
356
- skippedNamesTitle[0] = '\n*Skipped Test Cases:*\n';
358
+ skippedNamesTitle[0] = '*Skipped Test Cases:*\n';
357
359
  }
358
360
 
359
- // Push data into array to create the "List of Problematic Test Suites"
360
- if (summaryResults.tests.length !== summaryResults.passed){
361
- casesResults.push(
362
- {
363
- type: 'section',
364
- text: {
365
- type: 'mrkdwn',
366
- text:
367
- `\n${failedNamesTitle}${failsList.map((value, index) => `*${index + 1}.* ${value}`).join('\n')}` + // List of Failed Test Cases
368
- `\n${flakyNamesTitle}${flakyList.map((value, index) => `*${index + 1}.* ${value}`).join('\n')}` + // List of Flaky Test Cases
369
- `\n${skippedNamesTitle}${skipsList.map((value, index) => `*${index + 1}.* ${value}`).join('\n')} `, // List of Skipped Test Cases
370
- },
371
- },
372
- {
373
- type: 'section',
374
- text: {
375
- type: 'mrkdwn',
376
- text: ` `,
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
+ },
377
411
  },
378
- },
379
- {
380
- type: 'divider',
381
- },
382
- )}
412
+ {
413
+ type: 'divider',
414
+ },
415
+ );
416
+
383
417
  return [
384
418
  ...casesResults,
385
419
  ];
@@ -504,7 +538,7 @@ const generateFailuresReasons = async (summaryResults) => {
504
538
  ...failsList,
505
539
  ];
506
540
  };
507
- exports.generateFailures = generateFailures;
541
+ //exports.generateFailures = generateFailures;
508
542
  exports.generateFailuresReasons = generateFailuresReasons;
509
543
  exports.generateProblemSuiteList = generateProblemSuiteList;
510
544
  exports.generateProblemCaseList = generateProblemCaseList;
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.3.7",
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",