Skip to content

Cypress Tests using Cypress Docker Image #13

Cypress Tests using Cypress Docker Image

Cypress Tests using Cypress Docker Image #13

Workflow file for this run

name: Cypress Tests using Cypress Docker Image
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
URL:
required: true
LOGIN_USERNAME:
required: true
LOGIN_PASSWORD:
required: true
SIGNIN_URL:
required: true
SLACK_WEBHOOK_URL:
required: true
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
required: true
type: environment
concurrency:
group: ${{ github.workflow }}
jobs:
cypress-tests:
name: Run Cypress Tests
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
strategy:
matrix:
browser: [
"edge"
]
container:
image: cypress/browsers:22.12.0
defaults:
run:
working-directory: Dfe.Academies.External.Web/CypressTests
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Run
uses: cypress-io/github-action@v6
env:
CYPRESS_URL: ${{ secrets.URL }}
CYPRESS_LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
CYPRESS_LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
CYPRESS_SIGNIN_URL: ${{ secrets.SIGNIN_URL }}
with:
browser: ${{ matrix.browser }}
working-directory: ./Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests
wait-on: ${{ secrets.URL }}
- name: Generate report
if: always()
run: |
mkdir mochareports
npm run generate:html:report
- name: Upload report
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-${{ inputs.environment }}-${{ matrix.browser }}
path: Dfe.Academies.External.Web/CypressTests/cypress/screenshots
- name: Report results
if: always()
run: npm run cy:notify -- --custom-text="Environment ${{ inputs.environment }}, See more information https://github.com/DFE-Digital/Dfe.Academies.External/actions/runs/${{github.run_id}}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}