Run Cypress tests #1
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: Run Cypress tests | |
on: | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
type: string | |
secrets: | |
AZURE_ENDPOINT: | |
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: | |
if: inputs.environment == 'test' || inputs.environment == 'dev' | |
name: Run Cypress tests on ${{ inputs.environment }} | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment }} | |
defaults: | |
run: | |
working-directory: CypressTests | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: npm install | |
run: npm install | |
- name: Run cypress | |
run: npm run cy:run | |
env: | |
url: ${{ secrets.AZURE_ENDPOINT }} | |
- name: Upload screenshots | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots-${{ needs.set-env.outputs.environment }} | |
path: CypressTests/cypress/screenshots |