feat: 增强情绪博物馆项目功能 - 新增用户评论和帖子功能,优化前端架构和WebSocket通信 - 更新文档和部署配置

This commit is contained in:
2025-07-29 07:38:47 +08:00
parent cc886cd4d5
commit 2f3d39fb00
142 changed files with 45645 additions and 0 deletions
+126
View File
@@ -0,0 +1,126 @@
/**
* Cypress E2E 测试配置
*/
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// 基础URL
baseUrl: 'http://localhost:5173',
// 测试文件位置
specPattern: 'tests/e2e/**/*.cy.{js,jsx,ts,tsx}',
// 支持文件位置
supportFile: 'tests/e2e/support/e2e.ts',
// 固件文件位置
fixturesFolder: 'tests/e2e/fixtures',
// 截图和视频配置
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
// 视频录制
video: true,
videoCompression: 32,
// 截图配置
screenshotOnRunFailure: true,
// 视口配置
viewportWidth: 1280,
viewportHeight: 720,
// 等待配置
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 10000,
pageLoadTimeout: 30000,
// 重试配置
retries: {
runMode: 2,
openMode: 0
},
// 浏览器配置
chromeWebSecurity: false,
// 环境变量
env: {
// API基础URL
apiUrl: 'http://localhost:3000/api',
// 测试用户凭据
testUser: {
username: 'testuser',
password: 'password123',
email: 'test@example.com'
},
// 测试管理员凭据
adminUser: {
username: 'admin',
password: 'admin123',
email: 'admin@example.com'
}
},
setupNodeEvents(on, config) {
// 任务注册
on('task', {
// 数据库清理任务
clearDatabase() {
// 这里可以添加数据库清理逻辑
return null
},
// 创建测试数据任务
seedTestData() {
// 这里可以添加测试数据创建逻辑
return null
},
// 日志输出任务
log(message) {
console.log(message)
return null
}
})
// 文件处理
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome') {
// Chrome 特定配置
launchOptions.args.push('--disable-dev-shm-usage')
launchOptions.args.push('--no-sandbox')
}
return launchOptions
})
// 配置处理
on('before:spec', (spec) => {
console.log(`Running spec: ${spec.name}`)
})
return config
}
},
component: {
// 组件测试配置
devServer: {
framework: 'vue',
bundler: 'vite'
},
specPattern: 'src/**/*.cy.{js,jsx,ts,tsx,vue}',
supportFile: 'tests/e2e/support/component.ts',
viewportWidth: 1000,
viewportHeight: 660
}
})