playwright-slack-report
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -19,2 +19,3 @@ import { WebClient, KnownBlock, Block, ChatPostMessageResponse, LogLevel } from '@slack/web-api'; | ||
slackLogLevel?: LogLevel; | ||
unfurlEnable?: boolean; | ||
summaryResults: SummaryResults; | ||
@@ -26,3 +27,3 @@ }; | ||
}>>; | ||
doPostRequest(channel: string, blocks: Array<KnownBlock | Block>): Promise<ChatPostMessageResponse>; | ||
doPostRequest(channel: string, blocks: Array<KnownBlock | Block>, unfurl: boolean): Promise<ChatPostMessageResponse>; | ||
} |
@@ -24,2 +24,3 @@ "use strict"; | ||
const result = []; | ||
const unfurl = options.unfurlEnable; | ||
for (const channel of options.channelIds) { | ||
@@ -34,3 +35,3 @@ let chatResponse; | ||
// send request for reals | ||
chatResponse = await this.doPostRequest(channel, blocks); | ||
chatResponse = await this.doPostRequest(channel, blocks, unfurl); | ||
} | ||
@@ -55,6 +56,7 @@ if (chatResponse.ok) { | ||
} | ||
async doPostRequest(channel, blocks) { | ||
async doPostRequest(channel, blocks, unfurl) { | ||
const chatResponse = await this.slackWebClient.chat.postMessage({ | ||
channel, | ||
text: ' ', | ||
unfurl_link: unfurl, | ||
blocks, | ||
@@ -61,0 +63,0 @@ }); |
@@ -12,2 +12,3 @@ import { FullConfig, Reporter, Suite, TestCase, TestResult } from '@playwright/test/reporter'; | ||
private slackOAuthToken; | ||
private enableUnfurl; | ||
private suite; | ||
@@ -14,0 +15,0 @@ logs: string[]; |
@@ -16,2 +16,3 @@ "use strict"; | ||
slackOAuthToken; | ||
enableUnfurl; | ||
suite; | ||
@@ -31,2 +32,3 @@ logs = []; | ||
this.slackOAuthToken = slackReporterConfig.slackOAuthToken || undefined; | ||
this.enableUnfurl = slackReporterConfig.enableUnfurl || true; | ||
} | ||
@@ -62,2 +64,3 @@ this.resultsParser = new ResultsParser_1.default(); | ||
maxNumberOfFailures: this.maxNumberOfFailuresToShow, | ||
unfurlEnable: this.enableUnfurl, | ||
summaryResults: resultSummary, | ||
@@ -64,0 +67,0 @@ }, |
@@ -31,3 +31,3 @@ { | ||
"name": "playwright-slack-report", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"main": "index.js", | ||
@@ -34,0 +34,0 @@ "types": "dist/index.d.ts", |
@@ -131,3 +131,4 @@ # playwright-slack-report ![Builds](https://github.com/ryanrosello-og/playwright-slack-report/actions/workflows/playwright.yml/badge.svg) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ryanrosello-og/playwright-slack-report/blob/master/LICENSE) [![Coverage Status](https://coveralls.io/repos/github/ryanrosello-og/playwright-slack-report/badge.svg?branch=main)](https://coveralls.io/github/ryanrosello-og/playwright-slack-report?branch=main) | ||
slackOAuthToken: 'YOUR_SLACK_OAUTH_TOKEN', | ||
slackLogLevel: LogLevel.DEBUG | ||
slackLogLevel: LogLevel.DEBUG, | ||
enableUnfurl: false, | ||
}, | ||
@@ -157,4 +158,7 @@ | ||
This option allows you to control slack client severity levels for log entries. It accepts a value from @slack/web-api `LogLevel` enum | ||
### **enableUnfurl** (default: true) | ||
Enable or disable unfurling of links in Slack messages. | ||
**Examples:** | ||
@@ -535,3 +539,3 @@ ```typescript | ||
Create a new playwright project using `yarn create playwright` | ||
Modify the `package.json` and a local dependancy to the generated `tgz` file | ||
Modify the `package.json` and a local dependency to the generated `tgz` file | ||
@@ -538,0 +542,0 @@ e.g. |
41914
658
555