Merge pull request #735 from dipjyotimetia/dependabot/npm_and_yarn/al… #1566
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 Tests | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
jobs: | |
playwright-tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20] | |
shardIndex: [1, 2, 3, 4] | |
shardTotal: [4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node-version }}- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- uses: daun/playwright-report-summary@v3 | |
if: always() | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
report-file: results.json | |
comment-title: 'Test results' | |
- name: Upload blob report to GitHub Actions Artifacts | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: blob-report-${{ matrix.shardIndex }} | |
path: blob-report | |
retention-days: 1 | |
merge-reports: | |
# Merge reports after playwright-tests, even if some shards have failed | |
if: ${{ !cancelled() }} | |
needs: [playwright-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node-version }}- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Download blob reports from GitHub Actions Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: all-blob-reports | |
pattern: blob-report-* | |
merge-multiple: true | |
- name: Merge into HTML Report | |
run: npx playwright merge-reports --reporter html ./all-blob-reports | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-report--attempt-${{ github.run_attempt }} | |
path: all-blob-reports | |
retention-days: 14 |