test(web-app): add cypress for unit test

This commit is contained in:
fastium
2025-06-08 17:27:08 +02:00
parent 94df7fc910
commit e8fae59467
10 changed files with 2206 additions and 25 deletions

40
web-app/cypress.unit.js Normal file
View File

@@ -0,0 +1,40 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
// Shared settings for all test types
watchForFileChanges: false,
screenshotOnRunFailure: false,
video: false,
defaultCommandTimeout: 10000,
chromeWebSecurity: false,
retries: {
runMode: 2,
openMode: 0,
},
// E2E test configuration
e2e: {
specPattern: ['tests/e2e/*.spec.ts', 'tests/unit/*.spec.ts'],
baseUrl: null, // No baseUrl to prevent server checks in headless mode
supportFile: 'tests/support/e2e.ts',
experimentalRunAllSpecs: true,
testIsolation: false, // Allow shared context for unit tests
setupNodeEvents(on, config) {
// Disable baseUrl verification for headless testing
on('before:browser:launch', (browser, launchOptions) => {
return launchOptions;
});
return config;
},
},
// Component test configuration (for Vue components)
component: {
devServer: {
framework: 'vue',
bundler: 'webpack',
},
specPattern: 'tests/unit/*.spec.ts', // Component tests are in unit directory
supportFile: 'tests/support/e2e.ts',
},
});