From 07511c45d434429e594bff86f12d43a3464f5371 Mon Sep 17 00:00:00 2001 From: Boris Ballester Date: Thu, 23 Apr 2026 14:00:51 +0200 Subject: [PATCH] feat(ci): add Playwright visual regression test support to frontend deploy workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add optional Playwright visual regression testing step to the frontend deployment workflow. The new job runs in parallel with other test suites and integrates with VRT service for visual diff tracking. Changes: - Add workflow inputs: run-playwright-visual, playwright-visual-command, playwright-visual-timeout - Add playwright-visual job that uses shared-actions/run-playwright-visual@v1 - Pass VRT configuration (branch name, build ID, API credentials) to the visual test job - Update job numbering in comments (SonarCloud: Job 6→7, Deploy: Job 7→8, Notify: Job 8→9) --- .../workflows/frontend-deploy-workflow.yml | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 29f4640..214b3ad 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -208,6 +208,20 @@ on: description: 'Cypress test timeout (minutes)' type: number default: 20 + + # Playwright visual tests + run-playwright-visual: + description: "Run Playwright visual regression tests before deployment" + type: boolean + default: false + playwright-visual-command: + description: "Playwright visual test command" + type: string + default: "yarn test:visual" + playwright-visual-timeout: + description: "Playwright visual test timeout (minutes)" + type: number + default: 20 # SonarCloud configuration run-sonarcloud: @@ -523,7 +537,38 @@ jobs: VRT_APIKEY: ${{ secrets.VRT_APIKEY }} VRT_PROJECT: ${{ secrets.VRT_PROJECT }} - # Job 6: SonarCloud Analysis (waits for unit tests if enabled) + # Job 6: Playwright Visual Tests (runs in parallel with other tests) + playwright-visual: + name: 🎨 Playwright Visual + if: inputs.run-playwright-visual + needs: build + runs-on: ${{ fromJSON(inputs.e2e-runner) }} + timeout-minutes: ${{ inputs.playwright-visual-timeout }} + + steps: + - name: Run Playwright Visual Tests + uses: Typeform/.github/shared-actions/run-playwright-visual@v1 + with: + node-version: ${{ inputs.node-version }} + use-asdf: ${{ inputs.use-asdf }} + cache-mode: ${{ inputs.cache-mode }} + disable-restore-keys: ${{ inputs.disable-restore-keys }} + jarvis-branch: ${{ inputs.jarvis-branch }} + pre-test-command: ${{ inputs.pre-test-command }} + test-command: ${{ inputs.playwright-visual-command }} + build-artifact-name: ${{ needs.build.outputs.artifact-name }} + build-artifact-download-path: ${{ inputs.build-artifact-download-path || inputs.build-output-dir }} + turbo-scm-base: ${{ inputs.turbo-scm-base }} + vrt-branch-name: ${{ github.head_ref || github.ref_name }} + vrt-build-id: ${{ github.sha }} + artifact-name: "playwright-visual-results-${{ github.run_id }}" + artifact-retention-days: "7" + GH_TOKEN: ${{ secrets.GH_TOKEN }} + VRT_APIURL: ${{ secrets.VRT_APIURL }} + VRT_APIKEY: ${{ secrets.VRT_APIKEY }} + VRT_PROJECT: ${{ secrets.VRT_PROJECT }} + + # Job 7: SonarCloud Analysis (waits for unit tests if enabled) sonarcloud: name: 🔍 SonarCloud if: inputs.run-sonarcloud @@ -542,7 +587,7 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} SONAR_CLOUD_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }} - # Job 7: Deploy to Production (only if all enabled tests pass) + # Job 8: Deploy to Production (only if all enabled tests pass) deploy: name: 🚀 Deploy to Production needs: @@ -663,7 +708,7 @@ jobs: echo "📝 Commit: ${{ github.sha }}" echo "📋 Workflow: frontend-deploy-workflow-v2 (v2)" - # Job 8: Slack Notifications (runs after deploy completes) + # Job 9: Slack Notifications (runs after deploy completes) notify-slack: name: 📢 Notify Slack if: always() && inputs.slack-channel != '' && needs.deploy.result != 'cancelled'