address reporter issue in e2e test workflow

This commit is contained in:
mahula 2025-10-01 15:48:33 +02:00
parent 8f395a3dda
commit 1d0badcc56
3 changed files with 38 additions and 7 deletions

View File

@ -354,6 +354,7 @@ jobs:
id: report-results
if: always()
run: |
echo "Debug: cypress-tests step outcome = '${{ steps.cypress-tests.outcome }}'"
if [ "${{ steps.cypress-tests.outcome }}" = "failure" ]; then
echo "❌ Tests failed - artifacts will be uploaded by dependent job"
echo "test_failed=true" >> $GITHUB_OUTPUT

View File

@ -8,19 +8,22 @@ export default defineConfig({
viewportHeight: 720,
specPattern: 'e2e/**/*.cy.ts',
supportFile: false,
supportFile: 'support/e2e.ts',
screenshotsFolder: 'reports/screenshots',
videosFolder: 'reports/videos',
video: false,
screenshotOnRunFailure: true,
reporter: 'mochawesome',
reporter: 'cypress-mochawesome-reporter',
reporterOptions: {
reportDir: 'reports/json',
overwrite: false,
html: false,
json: true,
timestamp: 'mmddyyyy_HHMMss',
reportDir: 'reports',
charts: true,
reportPageTitle: 'Utopia Map E2E Test Report',
embeddedScreenshots: true,
inlineAssets: true,
saveAllAttempts: false,
saveJson: true,
saveHtml: false,
},
defaultCommandTimeout: 10000,
@ -44,6 +47,9 @@ export default defineConfig({
},
setupNodeEvents(on, config) {
// Load cypress-mochawesome-reporter plugin
require('cypress-mochawesome-reporter/plugin')(on)
// Load cypress-split plugin
cypressSplit(on, config)

24
cypress/support/e2e.ts Normal file
View File

@ -0,0 +1,24 @@
/// <reference types="cypress" />
// Import cypress-mochawesome-reporter register
import 'cypress-mochawesome-reporter/register'
// Import commands.ts using ES2015 syntax:
// import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
// This file is processed and loaded automatically before your test files.
// This is a great place to put global configuration and behavior that modifies Cypress.
// You can change the location of this file or turn off
// automatically serving support files with the 'supportFile' configuration option.
// Global exception handler
Cypress.on('uncaught:exception', (err, _runnable) => {
// eslint-disable-next-line no-console
console.log('Uncaught exception:', err.message)
// returning false here prevents Cypress from failing the test
return false
})