Skip to content

Cypress Tests using Cypress Docker Image #2

Cypress Tests using Cypress Docker Image

Cypress Tests using Cypress Docker Image #2

Workflow file for this run

name: Run Cypress tests
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
TRAMS_API_KEY:
required: true
TRAMS_API_BASE_URL:
required: true
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
required: true
type: environment
concurrency:
group: ${{ github.workflow }}
env:
NODE_VERSION: 18.x
jobs:
cypress-tests:
name: Run Cypress Tests
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
defaults:
run:
working-directory: CypressTests/
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Npm install
run: npm install
- name: Run Cypress (${{ inputs.environment }})
if: inputs.environment == 'test' || inputs.environment == 'development'
run: npm run cy:run -- --env apiKey="${{ secrets.TRAMS_API_KEY }}",url="${{ secrets.TRAMS_API_BASE_URL }}"
- name: Upload screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ needs.set-env.outputs.environment }}
path: screenshots