Skip to content

Cypress Tests using Cypress Docker Image #19

Cypress Tests using Cypress Docker Image

Cypress Tests using Cypress Docker Image #19

Workflow file for this run

name: Cypress Tests using Cypress Docker Image
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
AZURE_ENDPOINT:
required: true
CYPRESS_TEST_SECRET:
required: true
CYPRESS_ACADEMISATION_API_URL:
required: true
CYPRESS_ACADEMISATION_API_KEY:
required: true
DB_CONNECTION_STRING:
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"
]
project: [
"conversions",
"transfers"
]
include:
- project: "transfers"
working_dir: "./Dfe.PrepareConversions/Dfe.PrepareTransfers.CypressTests"
url: ${{ secrets.AZURE_ENDPOINT }}/transfers/

Check failure on line 49 in .github/workflows/cypress.yml

View workflow run for this annotation

GitHub Actions / Cypress Tests using Cypress Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/cypress.yml (Line: 49, Col: 18): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.AZURE_ENDPOINT .github/workflows/cypress.yml (Line: 52, Col: 18): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.AZURE_ENDPOINT
- project: "conversions"
working_dir: "./Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests"
url: ${{ secrets.AZURE_ENDPOINT }}
container:
image: cypress/browsers:22.12.0
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: |
INPUT=${{ github.event.inputs.environment }}
ENVIRONMENT=${INPUT:-"Dev"}
if [[ $ENVIRONMENT == 'Staging' ]]
then
echo "GREP=-dao" >> $GITHUB_ENV
else
echo "GREP=" >> $GITHUB_ENV
fi
- name: Run (${{ inputs.environment }})
uses: cypress-io/github-action@v6
env:
CYPRESS_db: ${{ secrets.DB_CONNECTION_STRING }}
CYPRESS_url: ${{ matrix.url }}
CYPRESS_cypressTestSecret: ${{ secrets.CYPRESS_TEST_SECRET }}
CYPRESS_academisationApiUrl: ${{ secrets.CYPRESS_ACADEMISATION_API_URL }}
CYPRESS_academisationApiKey: ${{ secrets.CYPRESS_ACADEMISATION_API_KEY }}
CYPRESS_grep: ${{ env.GREP }}
with:
browser: ${{ matrix.browser }}
working-directory: ${{ matrix.working_dir }}
wait-on: ${{ secrets.AZURE_ENDPOINT }}
- name: Upload screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.project }}-${{ inputs.environment }}-${{ matrix.browser }}
path: ${{ matrix.working_dir }}/cypress/screenshots
- name: Upload reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: reports-${{ inputs.environment }}-${{ matrix.project }}-${{ matrix.browser }}
path: ${{ matrix.working_dir }}/cypress/reports
build-reports:
name: Build combined reports
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
needs: cypress-tests
env:
working_dir: "./Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
working-directory: ${{ env.working_dir }}
- name: Download reports
uses: actions/download-artifact@v4
with:
pattern: reports-${{ inputs.environment }}-*
path: ${{ env.working_dir }}/reports
merge-multiple: true
- name: Generate combined report
working-directory: ${{ env.working_dir }}
run: |
mkdir mochareports
npm run generate:html:report
- name: Upload combined report
if: always()
uses: actions/upload-artifact@v4
with:
name: combined-reports-${{ inputs.environment }}
path: mochareports
- name: Report results to Slack
if: always()
run: npm run cy:notify -- --custom-text="Environment ${{ inputs.environment }}, See more information https://github.com/DFE-Digital/prepare-academy-conversions/actions/runs/${{github.run_id}}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}