Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 18 additions & 82 deletions .github/workflows/frontend-deploy-workflow-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@PLT-2912-cypress-composite-actions
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:
Expand All @@ -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@PLT-2912-cypress-composite-actions
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:
Expand Down
102 changes: 18 additions & 84 deletions .github/workflows/frontend-pr-workflow-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@PLT-2912-cypress-composite-actions
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:
Expand All @@ -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@PLT-2912-cypress-composite-actions
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
111 changes: 111 additions & 0 deletions shared-actions/run-cypress-functional/action.yml
Original file line number Diff line number Diff line change
@@ -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) }}
Loading