Skip to content

Commit

Permalink
Merge pull request #979 from DFE-Digital/cypress-reporting
Browse files Browse the repository at this point in the history
Refactor Cypress Tests, Resolve Mochawesome and Slack Reporter Issues, updated README.ME and Add .gitignore
  • Loading branch information
dangood84 authored Jan 25, 2024
2 parents c1437db + c8ce92a commit 4fcfcf1
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 43 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,24 @@ jobs:
with:
name: screenshots-${{ needs.set-env.outputs.environment }}
path: Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/screenshots


- name: Generate report
if: always()
run: |
mkdir mochareports
npm run generate:html:report
- name: Upload report
if: always()
uses: actions/upload-artifact@v3
with:
name: reports-${{ needs.set-env.outputs.environment }}
path: Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/mochareports

- name: Report results
if: always()
run: npm run cy:notify -- --custom-text="Environment ${{ needs.set-env.outputs.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 }}


4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,8 @@ backend.vars

# sonar cloud
/Dfe.PrepareConversions/.sonarlint
## other files
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress.env.json
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress.env
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress.json
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/reports/mocha/
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import { defineConfig } from 'cypress'
import { generateZapReport } from './cypress/plugins/generateZapReport'

export default defineConfig({
reporter: 'cypress-multi-reporters',
reporterOptions: {
reporterEnabled: 'mochawesome',
mochawesomeReporterOptions: {
reportDir: 'cypress/reports/mocha',
quite: true,
overwrite: false,
html: false,
json: true,
}
},
video: false,
retries: 0,
e2e: {
Expand All @@ -12,7 +23,7 @@ export default defineConfig({
setupNodeEvents(on, config) {

on('after:run', async () => {
if(process.env.ZAP) {
if (process.env.ZAP) {
await generateZapReport()
}
})
Expand Down
Loading

0 comments on commit 4fcfcf1

Please sign in to comment.