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: Run Playwright Tests and Publish Report to GitHub Pages with Slack Notifications | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write # Grants write access to the repository | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
- name: Install Playwright browsers | |
run: npx playwright install | |
- name: Set up environment variables | |
run: | | |
echo "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL }}" >> .env | |
- name: Run Playwright tests for Chromium | |
run: npx playwright test --project=chromium --workers=4 | |
continue-on-error: true # Ensures workflow continues even if tests fail | |
- name: Send Slack Notification | |
run: | | |
npx playwright-slack-report --webhook-url=$SLACK_WEBHOOK_URL | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
continue-on-error: true # Ensures workflow continues even if tests fail | |
- name: Move HTML Report | |
run: mv playwright-report /tmp/playwright-report | |
continue-on-error: true # Ensures workflow continues even if tests fail | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: /tmp/playwright-report | |