import { defineConfig } from 'cypress'; // https://docs.cypress.io/app/tooling/reporters // https://docs.cypress.io/app/references/configuration // https://www.npmjs.com/package/cypress-mochawesome-reporter let urlHost, browser, reporter, reporterOptions; if (process.env.CI) { urlHost = 'front'; browser = 'chromium'; reporter = 'junit'; reporterOptions = { mochaFile: 'e2e-junitresults.xml,toConsole=true', toConsole: true, }; } else { urlHost = 'localhost'; reporter = 'cypress-mochawesome-reporter'; reporterOptions = { charts: true, reportPageTitle: 'Cypress Inline Reporter', reportFilename: '[status]_[datetime]-report', embeddedScreenshots: true, reportDir: 'test/cypress/reports', inlineAssets: true, }; } export default defineConfig({ e2e: { baseUrl: `http://${urlHost}:9000`, experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios defaultCommandTimeout: 10000, trashAssetsBeforeRuns: false, requestTimeout: 10000, responseTimeout: 30000, pageLoadTimeout: 60000, fixturesFolder: 'test/cypress/fixtures', screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', videosFolder: 'test/cypress/videos', downloadsFolder: 'test/cypress/downloads', video: false, specPattern: 'test/cypress/integration/**/*.spec.js', experimentalRunAllSpecs: true, watchForFileChanges: true, reporter, reporterOptions, component: { componentFolder: 'src', testFiles: '**/*.spec.js', supportFile: 'test/cypress/support/unit.js', },/* setupNodeEvents: async (on, config) => { const plugin = await import('cypress-mochawesome-reporter/plugin'); plugin.default(on); const fs = await import('fs'); on('task', { deleteFile(filePath) { if (fs.existsSync(filePath)) { fs.unlinkSync(filePath); return true; } return false; }, }); return config; },*/ viewportWidth: 1280, viewportHeight: 720, }, experimentalMemoryManagement: true, defaultCommandTimeout: 10000, numTestsKeptInMemory: 2, });