Skip to content

Commit

Permalink
Update default layout (#3)
Browse files Browse the repository at this point in the history
* replace asset

* update default layout

* update failing tests

* version bump

Co-authored-by: Ryan Rosello <[email protected]>
  • Loading branch information
ryanrosello-og and ryanrosello authored Aug 15, 2022
1 parent 270953f commit 8b86ea5
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Publish your Playwright test results to your favorite Slack channel(s).

![Gif](https://github.com/ryanrosello-og/playwright-slack-report/blob/main/assets/2022-08-13_8-35-26.gif?raw=true)
![Gif](https://github.com/ryanrosello-og/playwright-slack-report/blob/main/assets/2022-08-15_20-22-59.png?raw=true)

## 🚀 Features

Expand Down
Binary file removed assets/2022-08-13_8-35-26.gif
Binary file not shown.
Binary file added assets/2022-08-15_20-22-59.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lint":"npx eslint . --ext .ts"
},
"name": "playwright-slack-report",
"version": "1.0.6",
"version": "1.0.7",
"main": "index.js",
"types": "dist/index.d.ts",
"repository": "[email protected]:ryanrosello-og/playwright-slack-report.git",
Expand Down
10 changes: 5 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ const config: PlaywrightTestConfig = {
[
'./src/SlackReporter.ts',
{
channels: ['zeb', 'pw'],
channels: ['qa-automation'],
sendResults: 'always', // "always" , "on-failure", "off"
// layout: generateCustomLayout,
meta: [
{
key: 'BUILD_NUMBER',
value: '323332-2341',
key: 'BuildID',
value: '0181ec91-6d2e-4ac9-8587-7612858a57a7',
},
{
key: 'WHATEVER_ENV_VARIABLE',
value: process.env.SOME_ENV_VARIABLE,
key: 'Branch',
value: 'feat/create-secondary-account',
},
],
},
Expand Down
19 changes: 9 additions & 10 deletions src/LayoutGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@ const generateBlocks = async (
const maxNumberOfFailureLength = 650;
const fails = [];
const meta = [];

const header = {
type: 'section',
text: {
type: 'mrkdwn',
text: '🎭 *Playwright Results*',
},
};
const summary = {
type: 'section',
text: {
type: 'mrkdwn',
text: `:white_check_mark: *${
summaryResults.passed
}* Tests ran successfully \n\n :red_circle: *${
summaryResults.failed
}* Tests failed \n\n ${
summaryResults.skipped > 0
? `:fast_forward: *${summaryResults.skipped}* skipped`
: ''
} \n\n `,
text: `✅ *${summaryResults.passed}* | ❌ *${summaryResults.failed}* | ⏩ *${summaryResults.skipped}*`,
},
};

Expand Down Expand Up @@ -66,6 +64,7 @@ const generateBlocks = async (
}

return [
header,
summary,
...meta,
{
Expand Down
27 changes: 24 additions & 3 deletions tests/SlackClient_generate_blocks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ test.describe('SlackClient.generateBlocks()', () => {
type: 'section',
text: {
type: 'mrkdwn',
text: ':white_check_mark: *1* Tests ran successfully \n\n :red_circle: *1* Tests failed \n\n :fast_forward: *1* skipped \n\n ',
text: '🎭 *Playwright Results*',
},
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '✅ *1* | ❌ *1* | ⏩ *1*',
},
},
{
Expand Down Expand Up @@ -50,7 +57,14 @@ test.describe('SlackClient.generateBlocks()', () => {
type: 'section',
text: {
type: 'mrkdwn',
text: ':white_check_mark: *1* Tests ran successfully \n\n :red_circle: *0* Tests failed \n\n :fast_forward: *1* skipped \n\n ',
text: '🎭 *Playwright Results*',
},
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '✅ *1* | ❌ *0* | ⏩ *1*',
},
},
{
Expand Down Expand Up @@ -98,7 +112,14 @@ test.describe('SlackClient.generateBlocks()', () => {
type: 'section',
text: {
type: 'mrkdwn',
text: ':white_check_mark: *0* Tests ran successfully \n\n :red_circle: *1* Tests failed \n\n :fast_forward: *1* skipped \n\n ',
text: '🎭 *Playwright Results*',
},
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '✅ *0* | ❌ *1* | ⏩ *1*',
},
},
{
Expand Down

0 comments on commit 8b86ea5

Please sign in to comment.