Skip to content

Commit 72125d4

Browse files
committed
SlackNotifications
1 parent 6fc2423 commit 72125d4

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.github/workflows/playwright.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# Name of the GitHub Actions workflow
21
name: Playwright Github Actions
32

4-
# Define when to trigger this workflow
53
on:
64
push:
75
branches:
@@ -10,58 +8,60 @@ on:
108
branches:
119
- main
1210

13-
# Define the jobs to run in this workflow
1411
jobs:
15-
# Define a job named 'build'
1612
build:
17-
# Specify the operating system for this job
1813
runs-on: ubuntu-latest
1914
env:
2015
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
2116

22-
# Define the steps to execute in this job
2317
steps:
24-
# Step to checkout the source code from the repository
2518
- name: Checkout code
2619
uses: actions/checkout@v2
2720

28-
# Step to set up the Node.js version
2921
- name: Install node js v20
3022
uses: actions/setup-node@v2
3123
with:
3224
node-version: "20"
3325

34-
# Step to install Node.js dependencies
3526
- name: Install dependencies
3627
run: npm ci
3728

38-
# Step to install Chrome browser for Playwright
3929
- name: Install Chrome browser for Playwright
4030
run: npx playwright install chrome
4131

42-
# Step to run tests with qa as environment variable similarly we can define qa|dev|qaApi|devApi
4332
- name: Run tests
4433
run: npm run test:serial
4534
env:
4635
npm_config_ENV: "qa"
4736

48-
# Step to wait for the job to complete
4937
- name: Wait for job completion
50-
# Adjust the wait time as needed
5138
run: sleep 30s
52-
# This step should always run, even if previous steps fail
5339
if: always()
5440

55-
# Step to zip html-report folder
5641
- name: Zip HTML report
5742
run: zip -r html-report.zip html-report
58-
# This step should always run, even if previous steps fail
5943
if: always()
6044

61-
- name: Slack Notification
62-
uses: act10ns/slack@v1
45+
- name: Send Slack notification with HTML report
46+
uses: rtCamp/action-slack@v3
6347
with:
64-
channel: '#playwright-test-reports'
65-
message: Playwright Tests are completed, please find attached report
66-
attachments: ./html-report.zip
67-
if: always()
48+
text: "Playwright tests have completed. HTML report is attached."
49+
channel: "#playwright-test-reports"
50+
attachments: |
51+
[{
52+
"color": "good",
53+
"blocks": [
54+
{
55+
"type": "section",
56+
"text": {
57+
"type": "mrkdwn",
58+
"text": "Playwright HTML Report"
59+
}
60+
}
61+
],
62+
"files": [
63+
{
64+
"path": "./html-report.zip"
65+
}
66+
]
67+
}]

0 commit comments

Comments
 (0)