SlackNotifications #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Github Actions | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install node js v20 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Chrome browser for Playwright | |
run: npx playwright install chrome | |
- name: Run tests | |
run: npm run test:serial | |
env: | |
npm_config_ENV: "qa" | |
- name: Wait for job completion | |
run: sleep 30s | |
if: always() | |
- name: Zip HTML report | |
run: zip -r html-report.zip html-report | |
if: always() | |
- name: Send Slack notification with HTML report | |
uses: rtCamp/action-slack@v3 | |
with: | |
text: "Playwright tests have completed. HTML report is attached." | |
channel: "#playwright-test-reports" | |
attachments: | | |
[{ | |
"color": "good", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Playwright HTML Report" | |
} | |
} | |
], | |
"files": [ | |
{ | |
"path": "./html-report.zip" | |
} | |
] | |
}] |