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 +55 -49
- package/lib/cli.js +3 -3
- package/lib/common.js +2 -4
- package/lib/default/columns.js +1 -1
- package/lib/default/options.js +2 -2
- package/lib/default/summary.js +2 -2
- package/lib/index.js +2 -2
- package/lib/merge-data.js +2 -2
- package/lib/packages/monocart-reporter-app.js +1 -1
- package/lib/packages/monocart-vendor.js +22 -22
- package/lib/utils/util.js +2 -2
- package/lib/visitor.js +8 -7
- package/package.json +8 -8
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
|
-
|
|
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
|
-
-
|
|
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
|
-
##
|
|
1108
|
-
|
|
1109
|
-
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
-
|
|
1113
|
-
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
-
|
|
1117
|
-
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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];
|
package/lib/default/columns.js
CHANGED
package/lib/default/options.js
CHANGED
package/lib/default/summary.js
CHANGED
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
|
|
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
|
-
...
|
|
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
|
|
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
|
-
...
|
|
183
|
+
... getDefaultOptions(),
|
|
184
184
|
... userOptions
|
|
185
185
|
};
|
|
186
186
|
|