diff --git a/.github/workflows/test.e2e.yml b/.github/workflows/test.e2e.yml index 18480d1a..2d0ffa36 100644 --- a/.github/workflows/test.e2e.yml +++ b/.github/workflows/test.e2e.yml @@ -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 diff --git a/cypress/cypress.config.ts b/cypress/cypress.config.ts index b5cec9da..317160b3 100644 --- a/cypress/cypress.config.ts +++ b/cypress/cypress.config.ts @@ -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) diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts new file mode 100644 index 00000000..0e057ecc --- /dev/null +++ b/cypress/support/e2e.ts @@ -0,0 +1,24 @@ +/// + +// 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 +})