From 6781a18f687d2cf5a11e0789880ae930a5d21b01 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Fri, 6 Feb 2026 17:31:58 +0100 Subject: [PATCH 1/3] feat: implement Cypress functional and visual test actions with artifact management --- .../workflows/frontend-deploy-workflow-v2.yml | 100 +++---------- .github/workflows/frontend-pr-workflow-v2.yml | 102 +++---------- .../run-cypress-functional/action.yml | 111 +++++++++++++++ shared-actions/run-cypress-visual/action.yml | 134 ++++++++++++++++++ 4 files changed, 281 insertions(+), 166 deletions(-) create mode 100644 shared-actions/run-cypress-functional/action.yml create mode 100644 shared-actions/run-cypress-visual/action.yml diff --git a/.github/workflows/frontend-deploy-workflow-v2.yml b/.github/workflows/frontend-deploy-workflow-v2.yml index e820890..0c9b965 100644 --- a/.github/workflows/frontend-deploy-workflow-v2.yml +++ b/.github/workflows/frontend-deploy-workflow-v2.yml @@ -432,53 +432,20 @@ jobs: timeout-minutes: ${{ inputs.cypress-timeout }} steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Setup Node with Cache - uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + - name: Run Cypress Functional Tests + uses: Typeform/.github/shared-actions/run-cypress-functional@v1 with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Jarvis - uses: Typeform/.github/shared-actions/setup-jarvis@v1 - with: jarvis-branch: ${{ inputs.jarvis-branch }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Cypress - uses: Typeform/.github/shared-actions/setup-cypress@v1 - - - name: Run pre-test command - if: inputs.pre-test-command != '' - run: ${{ inputs.pre-test-command }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Cypress functional tests - uses: cypress-io/github-action@v6 - timeout-minutes: 15 - with: - install: false - start: ${{ inputs.cypress-functional-start }} - wait-on: ${{ inputs.cypress-functional-wait-on }} - command: ${{ inputs.cypress-functional-command }} - env: + pre-test-command: ${{ inputs.pre-test-command }} + test-command: ${{ inputs.cypress-functional-command }} + start-command: ${{ inputs.cypress-functional-start }} + wait-on-url: ${{ inputs.cypress-functional-wait-on }} + artifact-name: 'cypress-functional-results-${{ github.run_id }}' + artifact-retention-days: '7' GH_TOKEN: ${{ secrets.GH_TOKEN }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_PORT: 8080 - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: cypress-functional-results-${{ github.run_id }} - path: | - cypress/screenshots/ - cypress/videos/ - retention-days: 7 # Job 5: Cypress Visual Tests (runs in parallel with other tests) cypress-visual: @@ -489,56 +456,25 @@ jobs: timeout-minutes: ${{ inputs.cypress-timeout }} steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Setup Node with Cache - uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + - name: Run Cypress Visual Tests + uses: Typeform/.github/shared-actions/run-cypress-visual@v1 with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Jarvis - uses: Typeform/.github/shared-actions/setup-jarvis@v1 - with: jarvis-branch: ${{ inputs.jarvis-branch }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Cypress - uses: Typeform/.github/shared-actions/setup-cypress@v1 - - - name: Run pre-test command - if: inputs.pre-test-command != '' - run: ${{ inputs.pre-test-command }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Cypress visual tests - uses: cypress-io/github-action@v6 - timeout-minutes: 15 - with: - install: false - start: ${{ inputs.cypress-visual-start }} - wait-on: ${{ inputs.cypress-visual-wait-on }} - command: ${{ inputs.cypress-visual-command }} - env: + pre-test-command: ${{ inputs.pre-test-command }} + test-command: ${{ inputs.cypress-visual-command }} + start-command: ${{ inputs.cypress-visual-start }} + wait-on-url: ${{ inputs.cypress-visual-wait-on }} + vrt-branch-name: ${{ github.head_ref || github.ref_name }} + vrt-build-id: ${{ github.sha }} + artifact-name: 'cypress-visual-results-${{ github.run_id }}' + artifact-retention-days: '7' GH_TOKEN: ${{ secrets.GH_TOKEN }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} VRT_APIURL: ${{ secrets.VRT_APIURL }} VRT_APIKEY: ${{ secrets.VRT_APIKEY }} VRT_PROJECT: ${{ secrets.VRT_PROJECT }} - CYPRESS_PORT: 8080 - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: cypress-visual-results-${{ github.run_id }} - path: | - cypress/screenshots/ - cypress/videos/ - retention-days: 7 # Job 6: SonarCloud Analysis (waits for unit tests if enabled) sonarcloud: diff --git a/.github/workflows/frontend-pr-workflow-v2.yml b/.github/workflows/frontend-pr-workflow-v2.yml index 43e54f0..9e28bc8 100644 --- a/.github/workflows/frontend-pr-workflow-v2.yml +++ b/.github/workflows/frontend-pr-workflow-v2.yml @@ -541,53 +541,20 @@ jobs: timeout-minutes: ${{ inputs.cypress-timeout }} steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Setup Node with Cache - uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + - name: Run Cypress Functional Tests + uses: Typeform/.github/shared-actions/run-cypress-functional@v1 with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Jarvis - uses: Typeform/.github/shared-actions/setup-jarvis@v1 - with: jarvis-branch: ${{ inputs.jarvis-branch }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Cypress - uses: Typeform/.github/shared-actions/setup-cypress@v1 - - - name: Run pre-test command - if: inputs.pre-test-command != '' - run: ${{ inputs.pre-test-command }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Cypress functional tests - uses: cypress-io/github-action@v6 - timeout-minutes: 15 - with: - install: false - start: ${{ inputs.cypress-functional-start }} - wait-on: ${{ inputs.cypress-functional-wait-on }} - command: ${{ inputs.cypress-functional-command }} - env: + pre-test-command: ${{ inputs.pre-test-command }} + test-command: ${{ inputs.cypress-functional-command }} + start-command: ${{ inputs.cypress-functional-start }} + wait-on-url: ${{ inputs.cypress-functional-wait-on }} + artifact-name: 'cypress-functional-results-${{ github.run_id }}' + artifact-retention-days: '7' GH_TOKEN: ${{ secrets.GH_TOKEN }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_PORT: 8080 - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: cypress-functional-results-${{ github.run_id }} - path: | - cypress/screenshots/ - cypress/videos/ - retention-days: 7 # Job 9: Cypress Visual Tests cypress-visual: @@ -598,55 +565,22 @@ jobs: timeout-minutes: ${{ inputs.cypress-timeout }} steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Setup Node with Cache - uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + - name: Run Cypress Visual Tests + uses: Typeform/.github/shared-actions/run-cypress-visual@v1 with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Jarvis - uses: Typeform/.github/shared-actions/setup-jarvis@v1 - with: jarvis-branch: ${{ inputs.jarvis-branch }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Setup Cypress - uses: Typeform/.github/shared-actions/setup-cypress@v1 - - - name: Run pre-test command - if: inputs.pre-test-command != '' - run: ${{ inputs.pre-test-command }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Cypress visual tests - uses: cypress-io/github-action@v6 - timeout-minutes: 15 - with: - install: false - start: ${{ inputs.cypress-visual-start }} - wait-on: ${{ inputs.cypress-visual-wait-on }} - command: ${{ inputs.cypress-visual-command }} - env: + pre-test-command: ${{ inputs.pre-test-command }} + test-command: ${{ inputs.cypress-visual-command }} + start-command: ${{ inputs.cypress-visual-start }} + wait-on-url: ${{ inputs.cypress-visual-wait-on }} + vrt-branch-name: ${{ github.head_ref || github.ref_name }} + vrt-build-id: ${{ github.sha }} + artifact-name: 'cypress-visual-results-${{ github.run_id }}' + artifact-retention-days: '7' GH_TOKEN: ${{ secrets.GH_TOKEN }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_PORT: 8080 VRT_APIURL: ${{ secrets.VRT_APIURL }} VRT_APIKEY: ${{ secrets.VRT_APIKEY }} VRT_PROJECT: ${{ secrets.VRT_PROJECT }} - VRT_BRANCHNAME: ${{ github.head_ref || github.ref_name }} - VRT_CIBUILDID: ${{ github.sha }} - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: cypress-visual-results-${{ github.run_id }} - path: | - cypress/screenshots/ - cypress/videos/ - retention-days: 7 diff --git a/shared-actions/run-cypress-functional/action.yml b/shared-actions/run-cypress-functional/action.yml new file mode 100644 index 0000000..2752635 --- /dev/null +++ b/shared-actions/run-cypress-functional/action.yml @@ -0,0 +1,111 @@ +name: 'Run Cypress Functional Tests' +description: 'Execute Cypress functional tests with server management and artifact upload' + +inputs: + # Node & Jarvis configuration + node-version: + description: 'Node.js version (ignored if use-asdf is true)' + required: false + default: '20' + use-asdf: + description: 'Use asdf-vm for version management' + required: false + default: 'false' + jarvis-branch: + description: 'Jarvis branch to use (empty = npm version)' + required: false + default: '' + + # Pre-test setup + pre-test-command: + description: 'Command to run before tests (e.g., GraphQL codegen)' + required: false + default: '' + + # Cypress test configuration + test-command: + description: 'Cypress functional test command' + required: false + default: 'yarn test:functional' + start-command: + description: 'Command to start server for functional tests' + required: false + default: 'yarn start:ci' + wait-on-url: + description: 'URL to wait for before running functional tests' + required: false + default: 'http://localhost:9000' + test-timeout: + description: 'Timeout for Cypress test execution (minutes)' + required: false + default: '15' + + # Artifact configuration + artifact-name: + description: 'Name for uploaded test results artifact' + required: false + default: 'cypress-functional-results' + artifact-retention-days: + description: 'Days to retain test result artifacts' + required: false + default: '7' + + # Secrets (passed as inputs since composite actions cannot access secrets directly) + GH_TOKEN: + description: 'GitHub token for authentication' + required: true + CYPRESS_RECORD_KEY: + description: 'Cypress Dashboard recording key' + required: false + default: '' + +runs: + using: 'composite' + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Setup Node with Cache + uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + with: + node-version: ${{ inputs.node-version }} + use-asdf: ${{ inputs.use-asdf }} + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Setup Jarvis + uses: Typeform/.github/shared-actions/setup-jarvis@v1 + with: + jarvis-branch: ${{ inputs.jarvis-branch }} + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Setup Cypress + uses: Typeform/.github/shared-actions/setup-cypress@v1 + + - name: Run pre-test command + if: inputs.pre-test-command != '' + shell: bash + run: ${{ inputs.pre-test-command }} + env: + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Cypress functional tests + uses: cypress-io/github-action@v6 + with: + install: false + start: ${{ inputs.start-command }} + wait-on: ${{ inputs.wait-on-url }} + command: ${{ inputs.test-command }} + env: + GH_TOKEN: ${{ inputs.GH_TOKEN }} + CYPRESS_RECORD_KEY: ${{ inputs.CYPRESS_RECORD_KEY }} + CYPRESS_PORT: 8080 + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact-name }} + path: | + cypress/screenshots/ + cypress/videos/ + retention-days: ${{ fromJSON(inputs.artifact-retention-days) }} diff --git a/shared-actions/run-cypress-visual/action.yml b/shared-actions/run-cypress-visual/action.yml new file mode 100644 index 0000000..c3dab3d --- /dev/null +++ b/shared-actions/run-cypress-visual/action.yml @@ -0,0 +1,134 @@ +name: 'Run Cypress Visual Regression Tests' +description: 'Execute Cypress visual regression tests with VRT integration, server management, and artifact upload' + +inputs: + # Node & Jarvis configuration + node-version: + description: 'Node.js version (ignored if use-asdf is true)' + required: false + default: '20' + use-asdf: + description: 'Use asdf-vm for version management' + required: false + default: 'false' + jarvis-branch: + description: 'Jarvis branch to use (empty = npm version)' + required: false + default: '' + + # Pre-test setup + pre-test-command: + description: 'Command to run before tests (e.g., GraphQL codegen)' + required: false + default: '' + + # Cypress test configuration + test-command: + description: 'Cypress visual test command' + required: false + default: 'yarn test:visual' + start-command: + description: 'Command to start server for visual tests' + required: false + default: 'yarn start:ci' + wait-on-url: + description: 'URL to wait for before running visual tests' + required: false + default: 'http://localhost:9000' + + # VRT configuration + vrt-branch-name: + description: 'Branch name for VRT comparison (defaults to github.head_ref or github.ref_name)' + required: false + default: '' + vrt-build-id: + description: 'Build ID for VRT (defaults to github.sha)' + required: false + default: '' + + # Artifact configuration + artifact-name: + description: 'Name for uploaded test results artifact' + required: false + default: 'cypress-visual-results' + artifact-retention-days: + description: 'Days to retain test result artifacts' + required: false + default: '7' + + # Secrets (passed as inputs since composite actions cannot access secrets directly) + GH_TOKEN: + description: 'GitHub token for authentication' + required: true + CYPRESS_RECORD_KEY: + description: 'Cypress Dashboard recording key' + required: false + default: '' + VRT_APIURL: + description: 'Visual Regression Tracker API URL' + required: false + default: '' + VRT_APIKEY: + description: 'Visual Regression Tracker API key' + required: false + default: '' + VRT_PROJECT: + description: 'Visual Regression Tracker project name' + required: false + default: '' + +runs: + using: 'composite' + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Setup Node with Cache + uses: Typeform/.github/shared-actions/setup-node-with-cache@v1 + with: + node-version: ${{ inputs.node-version }} + use-asdf: ${{ inputs.use-asdf }} + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Setup Jarvis + uses: Typeform/.github/shared-actions/setup-jarvis@v1 + with: + jarvis-branch: ${{ inputs.jarvis-branch }} + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Setup Cypress + uses: Typeform/.github/shared-actions/setup-cypress@v1 + + - name: Run pre-test command + if: inputs.pre-test-command != '' + shell: bash + run: ${{ inputs.pre-test-command }} + env: + GH_TOKEN: ${{ inputs.GH_TOKEN }} + + - name: Cypress visual tests + uses: cypress-io/github-action@v6 + with: + install: false + start: ${{ inputs.start-command }} + wait-on: ${{ inputs.wait-on-url }} + command: ${{ inputs.test-command }} + env: + GH_TOKEN: ${{ inputs.GH_TOKEN }} + CYPRESS_RECORD_KEY: ${{ inputs.CYPRESS_RECORD_KEY }} + CYPRESS_PORT: 8080 + VRT_APIURL: ${{ inputs.VRT_APIURL }} + VRT_APIKEY: ${{ inputs.VRT_APIKEY }} + VRT_PROJECT: ${{ inputs.VRT_PROJECT }} + VRT_BRANCHNAME: ${{ inputs.vrt-branch-name }} + VRT_CIBUILDID: ${{ inputs.vrt-build-id }} + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact-name }} + path: | + cypress/screenshots/ + cypress/videos/ + retention-days: ${{ fromJSON(inputs.artifact-retention-days) }} From fa89e8c2a11fdf08679af229b3b0a5bfe4a0c862 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Fri, 6 Feb 2026 17:50:07 +0100 Subject: [PATCH 2/3] feat: update Cypress functional test action to use composite actions branch --- .github/workflows/frontend-deploy-workflow-v2.yml | 2 +- .github/workflows/frontend-pr-workflow-v2.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow-v2.yml b/.github/workflows/frontend-deploy-workflow-v2.yml index 0c9b965..7346869 100644 --- a/.github/workflows/frontend-deploy-workflow-v2.yml +++ b/.github/workflows/frontend-deploy-workflow-v2.yml @@ -433,7 +433,7 @@ jobs: steps: - name: Run Cypress Functional Tests - uses: Typeform/.github/shared-actions/run-cypress-functional@v1 + uses: Typeform/.github/shared-actions/run-cypress-functional@PLT-2912-cypress-composite-actions with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} diff --git a/.github/workflows/frontend-pr-workflow-v2.yml b/.github/workflows/frontend-pr-workflow-v2.yml index 9e28bc8..6ea58b9 100644 --- a/.github/workflows/frontend-pr-workflow-v2.yml +++ b/.github/workflows/frontend-pr-workflow-v2.yml @@ -542,7 +542,7 @@ jobs: steps: - name: Run Cypress Functional Tests - uses: Typeform/.github/shared-actions/run-cypress-functional@v1 + uses: Typeform/.github/shared-actions/run-cypress-functional@PLT-2912-cypress-composite-actions with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} From 672d51a2604ce7fa02f8ea6c6535704db27175e2 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Fri, 6 Feb 2026 18:23:39 +0100 Subject: [PATCH 3/3] feat: update Cypress visual test action to use composite actions branch --- .github/workflows/frontend-deploy-workflow-v2.yml | 2 +- .github/workflows/frontend-pr-workflow-v2.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow-v2.yml b/.github/workflows/frontend-deploy-workflow-v2.yml index 7346869..12eb6bc 100644 --- a/.github/workflows/frontend-deploy-workflow-v2.yml +++ b/.github/workflows/frontend-deploy-workflow-v2.yml @@ -457,7 +457,7 @@ jobs: steps: - name: Run Cypress Visual Tests - uses: Typeform/.github/shared-actions/run-cypress-visual@v1 + uses: Typeform/.github/shared-actions/run-cypress-visual@PLT-2912-cypress-composite-actions with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }} diff --git a/.github/workflows/frontend-pr-workflow-v2.yml b/.github/workflows/frontend-pr-workflow-v2.yml index 6ea58b9..4531c61 100644 --- a/.github/workflows/frontend-pr-workflow-v2.yml +++ b/.github/workflows/frontend-pr-workflow-v2.yml @@ -566,7 +566,7 @@ jobs: steps: - name: Run Cypress Visual Tests - uses: Typeform/.github/shared-actions/run-cypress-visual@v1 + uses: Typeform/.github/shared-actions/run-cypress-visual@PLT-2912-cypress-composite-actions with: node-version: ${{ inputs.node-version }} use-asdf: ${{ inputs.use-asdf }}