Skip to content

[WIP] Ajout de tests Playwright e2e & non-régression #25

[WIP] Ajout de tests Playwright e2e & non-régression

[WIP] Ajout de tests Playwright e2e & non-régression #25

Workflow file for this run

name: 🎭 CI - E2E tests

Check failure on line 1 in .github/workflows/ci-e2e.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci-e2e.yml

Invalid workflow file

(Line: 24, Col: 5): Unexpected value 'continue-on-error'
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} | ![avant](${RAW_BASE}/${actual}) | ![après](${RAW_BASE}/${expected}) | ![diff](${RAW_BASE}/${diff_img}) |"
# 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