playwright-slack-report 1.1.3 → 1.1.4

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
@@ -128,7 +128,8 @@ An example advanced configuration is shown below:
128
128
  },
129
129
  ],
130
130
  slackOAuthToken: 'YOUR_SLACK_OAUTH_TOKEN',
131
- slackLogLevel: LogLevel.DEBUG
131
+ slackLogLevel: LogLevel.DEBUG,
132
+ enableUnfurl: false,
132
133
  },
133
134
 
134
135
  ],
@@ -153,6 +154,9 @@ Limits the number of failures shown in the Slack message, defaults to 10.
153
154
  Instead of providing an environment variable `SLACK_BOT_USER_OAUTH_TOKEN` you can specify the token in the config in the `slackOAuthToken` field.
154
155
  ### **slackLogLevel** (default LogLevel.DEBUG)
155
156
  This option allows you to control slack client severity levels for log entries. It accepts a value from @slack/web-api `LogLevel` enum
157
+ ### **enableUnfurl** (default: true)
158
+ Enable or disable unfurling of links in Slack messages.
159
+
156
160
 
157
161
 
158
162
  **Examples:**
@@ -530,7 +534,7 @@ Run the tests using `npm run pw`
530
534
  Run `npm pack`
531
535
 
532
536
  Create a new playwright project using `yarn create playwright`
533
- Modify the `package.json` and a local dependancy to the generated `tgz` file
537
+ Modify the `package.json` and a local dependency to the generated `tgz` file
534
538
 
535
539
  e.g.
536
540
 
@@ -16,11 +16,12 @@ export default class SlackClient {
16
16
  maxNumberOfFailures: number;
17
17
  slackOAuthToken?: string;
18
18
  slackLogLevel?: LogLevel;
19
+ unfurlEnable?: boolean;
19
20
  summaryResults: SummaryResults;
20
21
  };
21
22
  }): Promise<Array<{
22
23
  channel: string;
23
24
  outcome: string;
24
25
  }>>;
25
- doPostRequest(channel: string, blocks: Array<KnownBlock | Block>): Promise<ChatPostMessageResponse>;
26
+ doPostRequest(channel: string, blocks: Array<KnownBlock | Block>, unfurl: boolean): Promise<ChatPostMessageResponse>;
26
27
  }
@@ -21,6 +21,7 @@ class SlackClient {
21
21
  throw new Error(`Channel ids [${options.channelIds}] is not valid`);
22
22
  }
23
23
  const result = [];
24
+ const unfurl = options.unfurlEnable;
24
25
  for (const channel of options.channelIds) {
25
26
  let chatResponse;
26
27
  try {
@@ -30,7 +31,7 @@ class SlackClient {
30
31
  }
31
32
  else {
32
33
  // send request for reals
33
- chatResponse = await this.doPostRequest(channel, blocks);
34
+ chatResponse = await this.doPostRequest(channel, blocks, unfurl);
34
35
  }
35
36
  if (chatResponse.ok) {
36
37
  result.push({ channel, outcome: `✅ Message sent to ${channel}` });
@@ -50,10 +51,11 @@ class SlackClient {
50
51
  }
51
52
  return result;
52
53
  }
53
- async doPostRequest(channel, blocks) {
54
+ async doPostRequest(channel, blocks, unfurl) {
54
55
  const chatResponse = await this.slackWebClient.chat.postMessage({
55
56
  channel,
56
57
  text: ' ',
58
+ unfurl_link: unfurl,
57
59
  blocks,
58
60
  });
59
61
  return chatResponse;
@@ -9,6 +9,7 @@ declare class SlackReporter implements Reporter {
9
9
  private slackChannels;
10
10
  private slackLogLevel;
11
11
  private slackOAuthToken;
12
+ private enableUnfurl;
12
13
  private suite;
13
14
  logs: string[];
14
15
  onBegin(fullConfig: FullConfig, suite: Suite): void;
@@ -13,6 +13,7 @@ class SlackReporter {
13
13
  slackChannels = [];
14
14
  slackLogLevel;
15
15
  slackOAuthToken;
16
+ enableUnfurl;
16
17
  suite;
17
18
  logs = [];
18
19
  onBegin(fullConfig, suite) {
@@ -27,6 +28,7 @@ class SlackReporter {
27
28
  this.slackChannels = slackReporterConfig.channels;
28
29
  this.maxNumberOfFailuresToShow = slackReporterConfig.maxNumberOfFailuresToShow || 10;
29
30
  this.slackOAuthToken = slackReporterConfig.slackOAuthToken || undefined;
31
+ this.enableUnfurl = slackReporterConfig.enableUnfurl || true;
30
32
  }
31
33
  this.resultsParser = new ResultsParser_1.default();
32
34
  }
@@ -57,6 +59,7 @@ class SlackReporter {
57
59
  customLayout: this.customLayout,
58
60
  customLayoutAsync: this.customLayoutAsync,
59
61
  maxNumberOfFailures: this.maxNumberOfFailuresToShow,
62
+ unfurlEnable: this.enableUnfurl,
60
63
  summaryResults: resultSummary,
61
64
  },
62
65
  });
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "lint":"npx eslint . --ext .ts"
29
29
  },
30
30
  "name": "playwright-slack-report",
31
- "version": "1.1.3",
31
+ "version": "1.1.4",
32
32
  "main": "index.js",
33
33
  "types": "dist/index.d.ts",
34
34
  "repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",