From d181d6e163561b0e290ae3eb6e9ada0ef309acc2 Mon Sep 17 00:00:00 2001 From: FahadDarw Date: Wed, 4 Dec 2024 16:45:54 +0000 Subject: [PATCH] added slack notifications to get cypress results on slack channels --- .github/workflows/cypress-tests.yml | 6 ++++++ .../CypressTests/cypress.config.ts | 8 +++++--- .../CypressTests/cypress/cypress.config.js | 9 +++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 Dfe.Academies.External.Web/CypressTests/cypress/cypress.config.js diff --git a/.github/workflows/cypress-tests.yml b/.github/workflows/cypress-tests.yml index 0fd91e11b..c6fbbc972 100644 --- a/.github/workflows/cypress-tests.yml +++ b/.github/workflows/cypress-tests.yml @@ -53,6 +53,12 @@ jobs: - name: Run cypress run: npm run cy:run -- --env URL='${{ secrets.URL }}',LOGIN_USERNAME=${{ secrets.LOGIN_USERNAME }},LOGIN_PASSWORD=${{ secrets.LOGIN_PASSWORD }},SIGNIN_URL=${{ secrets.SIGNIN_URL }} + - name: Generate report + if: always() + run: | + mkdir mochareports + npm run generate:html:report + - name: upload report uses: actions/upload-artifact@v4 if: failure() diff --git a/Dfe.Academies.External.Web/CypressTests/cypress.config.ts b/Dfe.Academies.External.Web/CypressTests/cypress.config.ts index 7ca5395d0..d5f841adb 100644 --- a/Dfe.Academies.External.Web/CypressTests/cypress.config.ts +++ b/Dfe.Academies.External.Web/CypressTests/cypress.config.ts @@ -2,17 +2,19 @@ import { defineConfig } from 'cypress' import { generateZapReport } from './cypress/plugins/generateZapReport' export default defineConfig({ - reporter: 'cypress-multi-reporters', + reporter: 'cypress-multi-reporters', // added this for slack messaging plugin reporterOptions: { reporterEnabled: 'mochawesome', mochawesomeReporterOptions: { - reportDir: 'cypress/reports/mocha', - quite: true, + reportDir: 'cypress/reports/mocha', // added this for slack messaging plugin + quiet: true, // Fixed typo overwrite: false, html: false, json: true, }, }, + + video: false, userAgent: 'DfEAcademiesExternal/1.0 Cypress', e2e: { diff --git a/Dfe.Academies.External.Web/CypressTests/cypress/cypress.config.js b/Dfe.Academies.External.Web/CypressTests/cypress/cypress.config.js new file mode 100644 index 000000000..97f47c412 --- /dev/null +++ b/Dfe.Academies.External.Web/CypressTests/cypress/cypress.config.js @@ -0,0 +1,9 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +});