playwright-slack-report 1.1.16 → 1.1.17
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 +22 -4
- package/dist/src/SlackReporter.d.ts +1 -0
- package/dist/src/SlackReporter.js +5 -0
- package/package.json +15 -9
package/README.md
CHANGED
|
@@ -154,7 +154,13 @@ Limits the number of failures shown in the Slack message, defaults to 10.
|
|
|
154
154
|
### **slackOAuthToken**
|
|
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
|
-
This option allows you to control slack client severity levels for log entries. It accepts a value from @slack/web-api `LogLevel` enum
|
|
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
|
+
- ERROR
|
|
159
|
+
- WARN
|
|
160
|
+
- INFO
|
|
161
|
+
- DEBUG
|
|
162
|
+
|
|
163
|
+
Example: `slackLogLevel: "ERROR",` will only log errors to the console.
|
|
158
164
|
### **disableUnfurl** (default: true)
|
|
159
165
|
Enable or disable unfurling of links in Slack messages.
|
|
160
166
|
### **showInThread** (default: false)
|
|
@@ -327,7 +333,7 @@ Generates the following message in Slack:
|
|
|
327
333
|

|
|
328
334
|
|
|
329
335
|
|
|
330
|
-
**Example 3: -
|
|
336
|
+
**Example 3: - With screenshots and/or recorded videos (using AWS S3)**
|
|
331
337
|
|
|
332
338
|
In your, `playwright.config.ts` file, add these params (Make sure you use **layoutAsync** rather than **layout**):
|
|
333
339
|
|
|
@@ -461,7 +467,19 @@ export async function generateCustomLayoutAsync (summaryResults: SummaryResults)
|
|
|
461
467
|
|
|
462
468
|
```
|
|
463
469
|
|
|
464
|
-
**
|
|
470
|
+
**Example 4: - Upload the attachments to directly to Slack**
|
|
471
|
+
|
|
472
|
+
To enable this functionality, make sure the slackbot user has the following additional scopes:
|
|
473
|
+
- `files:write`
|
|
474
|
+
- `files:read`
|
|
475
|
+
|
|
476
|
+
You will need to re-install the app and re-invite the bot into the channel.
|
|
477
|
+
|
|
478
|
+
The value of the channel_id should be the channel id of the channel you want to upload the file to. This channel id can be found in the url when you are in the channel. e.g.
|
|
479
|
+
|
|
480
|
+
**https://app.slack.com/client/T02RVEEFPDH/C05H7TKVDUK**
|
|
481
|
+
|
|
482
|
+
^ the bit starting with 'C...' is your channel id. In this case, the channel id is `C05H7TKVDUK`
|
|
465
483
|
|
|
466
484
|
```typescript
|
|
467
485
|
...
|
|
@@ -471,7 +489,7 @@ const slackClient = new web_api_1.WebClient(process.env.SLACK_BOT_USER_OAUTH_TOK
|
|
|
471
489
|
async function uploadFile(filePath) {
|
|
472
490
|
try {
|
|
473
491
|
const result = await slackClient.files.uploadV2({
|
|
474
|
-
|
|
492
|
+
channel_id: 'C05H7TKVDUK', << this is the channel id not channel name! ☠️
|
|
475
493
|
file: fs.createReadStream(filePath),
|
|
476
494
|
filename: filePath.split('/').at(-1),
|
|
477
495
|
});
|
|
@@ -31,6 +31,7 @@ class SlackReporter {
|
|
|
31
31
|
this.slackOAuthToken = slackReporterConfig.slackOAuthToken || undefined;
|
|
32
32
|
this.disableUnfurl = slackReporterConfig.disableUnfurl || false;
|
|
33
33
|
this.showInThread = slackReporterConfig.showInThread || false;
|
|
34
|
+
this.slackLogLevel = slackReporterConfig.slackLogLevel || web_api_1.LogLevel.DEBUG;
|
|
34
35
|
}
|
|
35
36
|
this.resultsParser = new ResultsParser_1.default();
|
|
36
37
|
}
|
|
@@ -126,5 +127,9 @@ class SlackReporter {
|
|
|
126
127
|
this.logs.push(message);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
130
|
+
// eslint-disable-next-line class-methods-use-this
|
|
131
|
+
printsToStdio() {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
129
134
|
}
|
|
130
135
|
exports.default = SlackReporter;
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@slack/web-api": "^6.
|
|
3
|
+
"@slack/web-api": "^6.8.1"
|
|
4
4
|
},
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@playwright/test": "^1.23.3",
|
|
7
|
-
"dotenv": "^16.0.1",
|
|
8
|
-
"playwright": "^1.23.3",
|
|
9
|
-
"typescript": "^4.7.4",
|
|
10
7
|
"@slack/types": "^2.7.0",
|
|
11
8
|
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
12
9
|
"@typescript-eslint/parser": "^5.30.6",
|
|
10
|
+
"dotenv": "^16.0.1",
|
|
13
11
|
"eslint": "^7.32.0 || ^8.2.0",
|
|
14
12
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
15
13
|
"eslint-config-node": "^4.1.0",
|
|
@@ -19,21 +17,29 @@
|
|
|
19
17
|
"eslint-plugin-prettier": "^4.2.1",
|
|
20
18
|
"nyc": "^15.1.0",
|
|
21
19
|
"prettier": "^2.7.1",
|
|
22
|
-
"ts-mockito": "^2.6.1"
|
|
20
|
+
"ts-mockito": "^2.6.1",
|
|
21
|
+
"typescript": "^4.7.4"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|
|
25
24
|
"prettier": "prettier --write --loglevel warn \"**/**/*.ts\"",
|
|
26
25
|
"pw": "nyc playwright test && nyc report --reporter=lcov",
|
|
27
26
|
"build": "tsc -p ./tsconfig.json",
|
|
28
|
-
"lint":"npx eslint . --ext .ts"
|
|
27
|
+
"lint": "npx eslint . --ext .ts"
|
|
29
28
|
},
|
|
30
29
|
"name": "playwright-slack-report",
|
|
31
|
-
"version": "1.1.
|
|
30
|
+
"version": "1.1.17",
|
|
32
31
|
"main": "index.js",
|
|
33
32
|
"types": "dist/index.d.ts",
|
|
34
33
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|
|
35
34
|
"author": "Ryan Rosello <ryanrosello@hotmail.com>",
|
|
36
35
|
"license": "MIT",
|
|
37
|
-
"files": [
|
|
38
|
-
|
|
36
|
+
"files": [
|
|
37
|
+
"/dist/src"
|
|
38
|
+
],
|
|
39
|
+
"keywords": [
|
|
40
|
+
"slack",
|
|
41
|
+
"report",
|
|
42
|
+
"playwright",
|
|
43
|
+
"typescript"
|
|
44
|
+
]
|
|
39
45
|
}
|