[WIP] Ajout de tests Playwright e2e & non-régression #25
Workflow file for this run
This file contains hidden or 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: 🎭 CI - E2E tests | ||
| on: [push, pull_request] | ||
| jobs: | ||
| e2e: | ||
| name: Baseline (current branch) | ||
| uses: ./.github/workflows/_e2e.yml | ||
| with: | ||
| ref: ${{ github.ref }} | ||
| compare: false | ||
| permissions: | ||
| contents: read | ||
| e2e-compare: | ||
| name: Compare (main) | ||
| needs: e2e | ||
| uses: ./.github/workflows/_e2e.yml | ||
| with: | ||
| ref: main | ||
| compare: true | ||
| permissions: | ||
| contents: read | ||
| continue-on-error: true | ||
| comment-visual-diffs: | ||
| name: Comment visual regression diffs | ||
| needs: e2e-compare | ||
| if: | | ||
| needs.e2e-compare.result == 'failure' && | ||
| github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
| fetch-depth: 0 | ||
| - name: Download Playwright diffs | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: playwright-diffs | ||
| path: diffs | ||
| - name: Push diff images to branch | ||
| id: push-images | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| BRANCH="pr-${{ github.event.pull_request.number }}-screenshots" | ||
| git checkout --orphan "$BRANCH" | ||
| git rm -rf --quiet . 2>/dev/null || true | ||
| git clean -fdx -e diffs | ||
| find diffs -name '*.png' -exec git add {} + | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git commit -m "Visual regression diffs for PR #${{ github.event.pull_request.number }}" | ||
| git push --force origin "$BRANCH" | ||
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | ||
| # - name: Build PR comment body | ||
| # env: | ||
| # BRANCH: ${{ steps.push-images.outputs.branch }} | ||
| # REPO: ${{ github.repository }} | ||
| # run: | | ||
| # RAW_BASE="https://raw.githubusercontent.com/${REPO}/${BRANCH}" | ||
| # { | ||
| # echo "## Régression visuelle détectée" | ||
| # echo "" | ||
| # echo "| Test | Avant (main) | Après (PR) | Diff |" | ||
| # echo "|------|--------------|------------|------|" | ||
| # for expected in $(find diffs -name '*-expected.png' | sort); do | ||
| # actual="${expected/-expected/-actual}" | ||
| # diff_img="${expected/-expected/-diff}" | ||
| # test_name=$(basename "$(dirname "$expected")" | sed 's/-chromium.*//;s/-/ /g') | ||
| # echo "| ${test_name} |  |  |  |" | ||
| # done | ||
| # echo "" | ||
| # echo "_Generated by Playwright visual regression tests._" | ||
| # } > comment_body.md | ||
| # - name: Post PR comment | ||
| # env: | ||
| # GH_TOKEN: ${{ github.token }} | ||
| # run: | | ||
| # gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ | ||
| # -F body=@comment_body.md | ||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||