Initialisation des tests e2e avec Playwright #11
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 E2E Tests | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Obtenir l'URL de preview Vercel | |
uses: zentered/vercel-preview-url@v1.1.9 | |
id: vercel_preview_url | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
with: | |
vercel_team_id: 'team_XNy8GPxmIHotpZqqeAyKBm79' | |
vercel_project_id: 'prj_AGcOI1rKi80YLDCPDpwEnNHyJ1wc' | |
- name: Attente du déploiement de la preview | |
uses: UnlyEd/github-action-await-vercel@v1 | |
id: await-vercel | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
with: | |
deployment-url: ${{ steps.vercel_preview_url.outputs.preview_url }} | |
timeout: 180 | |
poll-interval: 1 | |
- name: Récupération du code | |
uses: actions/checkout@v4 | |
- name: Installation de Node.JS 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Installation des dépendances NPM | |
run: npm ci | |
- name: Récupération du cache des navigateurs Playwright (${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}) | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: "~/.cache/ms-playwright" | |
key: "${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}" | |
restore-keys: ${{ runner.os }}-playwright- | |
- name: Installation des navigateurs Playwright | |
run: npx playwright install --with-deps | |
- name: Execution des tests Playwright | |
run: npx playwright test | |
env: | |
BASE_URL: ${{ steps.vercel_preview_url.outputs.preview_url }} | |
- name: Ajout du commentaire dans la PR | |
run: npx github-actions-ctrf ctrf/ctrf-report.json | |
if: always() | |
- name: Mise à disposition des résultats | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Résultats | |
path: playwright-report/ | |
retention-days: 7 |