playwright-slack-report 1.1.15 → 1.1.16
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
|
@@ -129,7 +129,7 @@ An example advanced configuration is shown below:
|
|
|
129
129
|
],
|
|
130
130
|
slackOAuthToken: 'YOUR_SLACK_OAUTH_TOKEN',
|
|
131
131
|
slackLogLevel: LogLevel.DEBUG,
|
|
132
|
-
|
|
132
|
+
disableUnfurl: true,
|
|
133
133
|
showInThread: true,
|
|
134
134
|
},
|
|
135
135
|
|
|
@@ -155,7 +155,7 @@ Limits the number of failures shown in the Slack message, defaults to 10.
|
|
|
155
155
|
Instead of providing an environment variable `SLACK_BOT_USER_OAUTH_TOKEN` you can specify the token in the config in the `slackOAuthToken` field.
|
|
156
156
|
### **slackLogLevel** (default LogLevel.DEBUG)
|
|
157
157
|
This option allows you to control slack client severity levels for log entries. It accepts a value from @slack/web-api `LogLevel` enum
|
|
158
|
-
### **
|
|
158
|
+
### **disableUnfurl** (default: true)
|
|
159
159
|
Enable or disable unfurling of links in Slack messages.
|
|
160
160
|
### **showInThread** (default: false)
|
|
161
161
|
Instructs the reporter to show the failure details in a thread instead of the main channel.
|
|
@@ -16,7 +16,7 @@ export default class SlackClient {
|
|
|
16
16
|
maxNumberOfFailures: number;
|
|
17
17
|
slackOAuthToken?: string;
|
|
18
18
|
slackLogLevel?: LogLevel;
|
|
19
|
-
|
|
19
|
+
disableUnfurl?: boolean;
|
|
20
20
|
summaryResults: SummaryResults;
|
|
21
21
|
showInThread: boolean;
|
|
22
22
|
};
|
|
@@ -25,12 +25,12 @@ export default class SlackClient {
|
|
|
25
25
|
outcome: string;
|
|
26
26
|
ts: string;
|
|
27
27
|
}>>;
|
|
28
|
-
attachDetailsToThread({ channelIds, ts, summaryResults, maxNumberOfFailures,
|
|
28
|
+
attachDetailsToThread({ channelIds, ts, summaryResults, maxNumberOfFailures, disableUnfurl, fakeRequest, }: {
|
|
29
29
|
channelIds: Array<string>;
|
|
30
30
|
ts: string;
|
|
31
31
|
summaryResults: SummaryResults;
|
|
32
32
|
maxNumberOfFailures: number;
|
|
33
|
-
|
|
33
|
+
disableUnfurl?: boolean;
|
|
34
34
|
fakeRequest?: Function;
|
|
35
35
|
}): Promise<any[]>;
|
|
36
36
|
static doPostRequest(slackWebClient: WebClient, channel: string, blocks: Array<KnownBlock | Block>, unfurl: boolean, threadTimestamp?: string): Promise<ChatPostMessageResponse>;
|
package/dist/src/SlackClient.js
CHANGED
|
@@ -26,7 +26,7 @@ class SlackClient {
|
|
|
26
26
|
throw new Error(`Channel ids [${options.channelIds}] is not valid`);
|
|
27
27
|
}
|
|
28
28
|
const result = [];
|
|
29
|
-
const unfurl = options.
|
|
29
|
+
const unfurl = !options.disableUnfurl;
|
|
30
30
|
for (const channel of options.channelIds) {
|
|
31
31
|
let chatResponse;
|
|
32
32
|
try {
|
|
@@ -63,7 +63,7 @@ class SlackClient {
|
|
|
63
63
|
}
|
|
64
64
|
return result;
|
|
65
65
|
}
|
|
66
|
-
async attachDetailsToThread({ channelIds, ts, summaryResults, maxNumberOfFailures,
|
|
66
|
+
async attachDetailsToThread({ channelIds, ts, summaryResults, maxNumberOfFailures, disableUnfurl, fakeRequest, }) {
|
|
67
67
|
const result = [];
|
|
68
68
|
const blocks = await (0, LayoutGenerator_1.generateFailures)(summaryResults, maxNumberOfFailures);
|
|
69
69
|
for (const channel of channelIds) {
|
|
@@ -73,7 +73,7 @@ class SlackClient {
|
|
|
73
73
|
chatResponse = await fakeRequest();
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
chatResponse = await SlackClient.doPostRequest(this.slackWebClient, channel, blocks,
|
|
76
|
+
chatResponse = await SlackClient.doPostRequest(this.slackWebClient, channel, blocks, disableUnfurl, ts);
|
|
77
77
|
}
|
|
78
78
|
if (chatResponse.ok) {
|
|
79
79
|
// eslint-disable-next-line no-console
|
|
@@ -10,7 +10,7 @@ declare class SlackReporter implements Reporter {
|
|
|
10
10
|
private slackChannels;
|
|
11
11
|
private slackLogLevel;
|
|
12
12
|
private slackOAuthToken;
|
|
13
|
-
private
|
|
13
|
+
private disableUnfurl;
|
|
14
14
|
private suite;
|
|
15
15
|
logs: string[];
|
|
16
16
|
onBegin(fullConfig: FullConfig, suite: Suite): void;
|
|
@@ -14,7 +14,7 @@ class SlackReporter {
|
|
|
14
14
|
slackChannels = [];
|
|
15
15
|
slackLogLevel;
|
|
16
16
|
slackOAuthToken;
|
|
17
|
-
|
|
17
|
+
disableUnfurl;
|
|
18
18
|
suite;
|
|
19
19
|
logs = [];
|
|
20
20
|
onBegin(fullConfig, suite) {
|
|
@@ -29,7 +29,7 @@ class SlackReporter {
|
|
|
29
29
|
this.slackChannels = slackReporterConfig.channels;
|
|
30
30
|
this.maxNumberOfFailuresToShow = slackReporterConfig.maxNumberOfFailuresToShow || 10;
|
|
31
31
|
this.slackOAuthToken = slackReporterConfig.slackOAuthToken || undefined;
|
|
32
|
-
this.
|
|
32
|
+
this.disableUnfurl = slackReporterConfig.disableUnfurl || false;
|
|
33
33
|
this.showInThread = slackReporterConfig.showInThread || false;
|
|
34
34
|
}
|
|
35
35
|
this.resultsParser = new ResultsParser_1.default();
|
|
@@ -62,7 +62,7 @@ class SlackReporter {
|
|
|
62
62
|
customLayout: this.customLayout,
|
|
63
63
|
customLayoutAsync: this.customLayoutAsync,
|
|
64
64
|
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
65
|
-
|
|
65
|
+
disableUnfurl: this.disableUnfurl,
|
|
66
66
|
summaryResults: resultSummary,
|
|
67
67
|
showInThread: this.showInThread,
|
|
68
68
|
},
|
package/package.json
CHANGED