monocart-reporter 2.4.7 → 2.4.9

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/README.md CHANGED
@@ -46,15 +46,7 @@
46
46
  - [Send and Receive Messages between Processes](#send-and-receive-messages-between-processes)
47
47
  * [Merge Shard Reports](#merge-shard-reports)
48
48
  * [onEnd Hook](#onend-hook)
49
- - [Send Email](#send-email)
50
- - [Testrail Integration](#testrail-integration)
51
- - [Jira + Zephyr Scale Integration](#jira--zephyr-scale-integration)
52
- - [Jira + Xray Integration](#jira--xray-integration)
53
- - [Slack Integration](#slack-integration)
54
- - [Discord Integration](#discord-integration)
55
- - [Teams Integration](#teams-integration)
56
- - [BrowserStack Integration](#browserstack-integration)
57
- - [Dingtalk/Weixin/Feishu Integration](#dingtalkweixinfeishu-integration)
49
+ * [Integration](#integration)
58
50
  * [Contributing](#contributing)
59
51
  * [Changelog](CHANGELOG.md)
60
52
  ## Preview
@@ -87,7 +79,8 @@ Playwright Docs [https://playwright.dev/docs/test-reporters](https://playwright.
87
79
 
88
80
  ## Examples
89
81
  - [tests](/tests/)
90
- - More Examples [monocart-reporter-examples](https://github.com/cenfun/monocart-reporter-examples)
82
+ - [monocart-reporter-examples](https://github.com/cenfun/monocart-reporter-examples)
83
+ - [playwright-reporter-integrations](https://github.com/cenfun/playwright-reporter-integrations)
91
84
 
92
85
  ## Output
93
86
  - path-to/your-filename.html
@@ -541,11 +534,17 @@ module.exports = {
541
534
  see example: [remove-secrets](https://github.com/cenfun/monocart-reporter-examples/tree/main/tests/remove-secrets)
542
535
 
543
536
  ## Style Tags
537
+
544
538
  * Add tag to test/describe title ( starts with `@` )
545
539
  ```js
546
540
  test('test title @smoke @critical', () => { });
547
541
  test.describe('describe title @smoke @critical', () => { });
542
+
543
+ // new syntax for tag in playwright v1.42.0
544
+ test('test title', { tag: ['@smoke', '@critical'] }, () => { });
545
+ test.describe('describe title', { tag: ['@smoke', '@critical'] }, () => { });
548
546
  ```
547
+
549
548
  * Custom tag style
550
549
  ```js
551
550
  // playwright.config.js
@@ -570,6 +569,38 @@ module.exports = {
570
569
  };
571
570
  ```
572
571
 
572
+ * Put style tags in new column
573
+ ```js
574
+ module.exports = {
575
+ reporter: [
576
+ ['list'],
577
+ ['monocart-reporter', {
578
+ name: "My Test Report",
579
+ outputFile: './test-results/report.html',
580
+ tags: {
581
+ // ...
582
+ },
583
+ columns: (defaultColumns) => {
584
+
585
+ // disable title tags
586
+ defaultColumns.find((column) => column.id === 'title').titleTagsDisabled = true;
587
+
588
+ // add tags column
589
+ const index = defaultColumns.findIndex((column) => column.id === 'type');
590
+ defaultColumns.splice(index, 0, {
591
+ id: 'tags',
592
+ name: 'Tags',
593
+ width: 150,
594
+ formatter: 'tags'
595
+ });
596
+ }
597
+ }]
598
+ ]
599
+ };
600
+ ```
601
+ see [example](https://github.com/cenfun/monocart-reporter-examples/tree/main/tests/tags-column)
602
+
603
+
573
604
  ## Metadata
574
605
  > All metadata will be listed in the report in a key/value format.
575
606
  - Global level `metadata`
@@ -1104,45 +1135,20 @@ module.exports = {
1104
1135
  };
1105
1136
  ```
1106
1137
 
1107
- ## Send Email
1108
- - Simply send email with [nodemailer](https://nodemailer.com)
1109
- - Example: [send-email](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/send-email)
1110
-
1111
- ## Testrail Integration
1112
- - Send test results to your [Testrail](https://www.testrail.com/)
1113
- - Example: [testrail](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/testrail)
1114
-
1115
- ## Jira + Zephyr Scale Integration
1116
- - Create test cycle and executions with [zephyr-scale-api](https://support.smartbear.com/zephyr-scale-cloud/api-docs/)
1117
- - Example: [zephyr-scale](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/zephyr-scale)
1118
-
1119
- ## Jira + Xray Integration
1120
- - Import test execution results with [Xray REST API](https://docs.getxray.app/display/XRAYCLOUD/REST+API)
1121
- - Update Jira issue status with [Jira Transition API](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post)
1122
- - Example: [xray](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/xray)
1123
-
1124
- ## Slack Integration
1125
- - Simply send message with [@slack/webhook](https://github.com/slackapi/node-slack-sdk)
1126
- - Example: [slack-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/slack-webhook)
1127
- - Post chat message and upload image with [@slack/web-api](https://github.com/slackapi/node-slack-sdk)
1128
- - Example: [slack-web-api](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/slack-web-api)
1129
-
1130
- ## Discord Integration
1131
- - Using [Discord webhooks](https://discord.com/developers/docs/resources/webhook) to post messages to channels.
1132
- - Example: [discord-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/discord-webhook)
1133
-
1134
- ## Teams Integration
1135
- - Please create an [Incoming Webhooks](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook) for the channel first.
1136
- - Example: [teams-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/teams-webhook)
1137
-
1138
- ## BrowserStack Integration
1139
- - Example: [browserstack](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/browserstack)
1140
-
1141
- ## Dingtalk/Weixin/Feishu Integration
1142
- - [dingtalk-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/dingtalk-webhook)
1143
- - [weixin-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/weixin-webhook)
1144
- - [feishu-webhook](https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/feishu-webhook)
1145
-
1138
+ ## Integration
1139
+ By using the `onEnd` hook, we can integrate Playwright report with any other tools, such as:
1140
+ - Email
1141
+ - Testrail
1142
+ - Qase
1143
+ - Jira + Zephyr
1144
+ - Jira + Xray
1145
+ - Slack
1146
+ - Discord
1147
+ - Teams
1148
+ - BrowserStack
1149
+ - Dingtalk/Weixin/Feishu
1150
+
1151
+ See [Integration Examples](https://github.com/cenfun/playwright-reporter-integrations)
1146
1152
 
1147
1153
  ## Contributing
1148
1154
  ```sh
package/lib/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -12,7 +12,7 @@ const Koa = require('koa');
12
12
  const CG = require('console-grid');
13
13
 
14
14
  const { program, open } = require('./packages/monocart-vendor.js');
15
- const defaultOptions = require('./default/options.js');
15
+ const getDefaultOptions = require('./default/options.js');
16
16
  const version = require('../package.json').version;
17
17
 
18
18
  const getInternalIps = () => {
@@ -102,7 +102,7 @@ const createServer = (app, options) => {
102
102
  const serveReport = async (p, options) => {
103
103
 
104
104
  if (!p) {
105
- p = defaultOptions.outputFile;
105
+ p = getDefaultOptions().outputFile;
106
106
  }
107
107
 
108
108
  const dirs = [];
package/lib/common.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const Util = require('./utils/util.js');
2
- const defaultSummary = require('./default/summary.js');
2
+ const getDefaultSummary = require('./default/summary.js');
3
3
  const generatePieChart = require('./utils/pie.js');
4
4
 
5
5
  const caseHandler = (item, summary) => {
@@ -81,9 +81,7 @@ const calculateSummary = (data, options) => {
81
81
  const tags = {};
82
82
  const tagOptions = options.tags || {};
83
83
 
84
- const summary = {
85
- ... defaultSummary
86
- };
84
+ const summary = getDefaultSummary();
87
85
  // init summary data
88
86
  Object.keys(summary).forEach((k) => {
89
87
  const item = summary[k];
@@ -1,4 +1,4 @@
1
- module.exports = [{
1
+ module.exports = () => [{
2
2
  id: 'caseType',
3
3
  name: '',
4
4
  width: 36,
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ module.exports = () => ({
2
2
  // the report name
3
3
  name: '',
4
4
 
@@ -65,4 +65,4 @@ module.exports = {
65
65
  // onEnd hook
66
66
  onEnd: null
67
67
  // onEnd: async (reportData, helper) => {}
68
- };
68
+ });
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ module.exports = () => ({
2
2
  tests: {
3
3
  name: 'Tests',
4
4
  value: 0,
@@ -77,4 +77,4 @@ module.exports = {
77
77
  name: 'Attachments',
78
78
  value: 0
79
79
  }
80
- };
80
+ });
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@ const EC = require('eight-colors');
2
2
  const { getSystemInfo, getTickInfo } = require('./utils/system.js');
3
3
  const generateData = require('./generate-data.js');
4
4
  const generateReport = require('./generate-report.js');
5
- const defaultOptions = require('./default/options.js');
5
+ const getDefaultOptions = require('./default/options.js');
6
6
  const { getTrends } = require('./common.js');
7
7
 
8
8
  const merge = require('./merge-data.js');
@@ -35,7 +35,7 @@ class MonocartReporter {
35
35
  const timestampStart = Date.now();
36
36
 
37
37
  this.options = {
38
- ... defaultOptions,
38
+ ... getDefaultOptions(),
39
39
  ... userOptions
40
40
  };
41
41
 
package/lib/merge-data.js CHANGED
@@ -2,7 +2,7 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const Util = require('./utils/util.js');
4
4
  const generateReport = require('./generate-report.js');
5
- const defaultOptions = require('./default/options.js');
5
+ const getDefaultOptions = require('./default/options.js');
6
6
  const { calculateSummary, getTrends } = require('./common.js');
7
7
 
8
8
  const checkReportData = (item) => {
@@ -180,7 +180,7 @@ module.exports = async (reportDataList, userOptions = {}) => {
180
180
  }
181
181
 
182
182
  const options = {
183
- ... defaultOptions,
183
+ ... getDefaultOptions(),
184
184
  ... userOptions
185
185
  };
186
186