diff --git a/dogfood-output/generate-signature.sh b/dogfood-output/generate-signature.sh new file mode 100755 index 0000000..6d5f040 --- /dev/null +++ b/dogfood-output/generate-signature.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +SECRET="NovalonManageSystemSecretKey2026" +METHOD=$1 +URL=$2 +BODY=$3 + +TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))") +NONCE="${TIMESTAMP}-$(head /dev/urandom | LC_ALL=C tr -dc 'a-z0-9' | head -c 13)" + +PATH_PART=$(echo "$URL" | sed -E 's|^https?://[^/]+||' | sed 's|\?.*||') +QUERY_PART=$(echo "$URL" | sed -E 's|^https?://[^/]+||' | sed -n 's|.*\?||p') + +STRING_TO_SIGN="${METHOD} +${PATH_PART} +${QUERY_PART} +${BODY} +${TIMESTAMP} +${NONCE}" + +SIGNATURE=$(echo -n "$STRING_TO_SIGN" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64) + +echo "X-Signature: $SIGNATURE" +echo "X-Timestamp: $TIMESTAMP" +echo "X-Nonce: $NONCE" diff --git a/dogfood-output/report.md b/dogfood-output/report.md new file mode 100644 index 0000000..c9ed820 --- /dev/null +++ b/dogfood-output/report.md @@ -0,0 +1,230 @@ +# Dogfood Report: Novalon管理系统 + +| Field | Value | +|-------|-------| +| **Date** | 2026-04-28 | +| **App URL** | http://localhost:3002 | +| **Session** | novalon-test | +| **Scope** | 全应用探索性测试,重点关注用户旅程(User Journey) | + +## Summary + +| Severity | Count | +|----------|-------| +| Critical | 0 | +| High | 1 | +| Medium | 2 | +| Low | 1 | +| **Total** | **4** | + +## Test Environment + +- **Frontend**: http://localhost:3002 (Vue 3 + Vite) +- **Gateway**: http://localhost:8080 (Spring Cloud Gateway) +- **Backend**: http://localhost:8084 (Spring Boot) +- **Database**: PostgreSQL on localhost:55432 +- **Test User**: admin / Test@123 + +## Test Execution Summary + +### 服务状态验证 +- ✅ 后端服务 (8084): 正常运行 +- ✅ 网关服务 (8080): 正常运行 +- ✅ 前端服务 (3002): 正常运行 +- ✅ 数据库连接: 正常 + +### 数据库验证 +- ✅ 用户表: 7条记录 +- ✅ 角色表: 8条记录 +- ✅ 菜单表: 51条记录 +- ✅ 字典类型表: 8条记录 +- ✅ 系统配置表: 9条记录 + +### API测试结果 +- ✅ 登录API: 正常工作,返回JWT token +- ✅ 用户管理API: 正常工作,需要签名验证 +- ✅ 角色管理API: 正常工作,需要签名验证 +- ✅ 菜单管理API: 正常工作,需要签名验证 +- ✅ 字典管理API: 正常工作,需要签名验证 +- ✅ 系统配置API: 正常工作,需要签名验证 + +### 日志监控结果 +- ✅ 后端日志: 无ERROR或Exception +- ⚠️ 网关日志: 有配置警告,但不影响功能 +- ✅ 前端日志: 未发现异步功能错误 + +## Issues + +### ISSUE-001: API签名验证机制导致测试困难 + +| Field | Value | +|-------|-------| +| **Severity** | high | +| **Category** | functional | +| **URL** | http://localhost:8080/api/* | +| **Repro Video** | N/A | + +**Description** + +所有API请求都需要签名验证(X-Signature, X-Timestamp, X-Nonce),这导致: +1. 直接使用curl或Postman测试API时会被拒绝 +2. 测试脚本需要实现签名生成逻辑,增加了测试复杂度 +3. 签名验证失败时,错误信息不够友好 + +**Expected Behavior** +- 应该提供测试模式,允许跳过签名验证 +- 或者提供测试工具/库来简化签名生成 + +**Actual Behavior** +- API返回401错误,提示签名验证失败 +- 错误信息:`{"error": "Unauthorized", "code": "INVALID_SIGNATURE", "message": "Request signature verification failed. Please ensure you have included valid X-Signature, X-Timestamp, and X-Nonce headers."}` + +**Impact** +- 增加了API测试的复杂度 +- 影响开发效率 +- 可能导致测试覆盖率不足 + +--- + +### ISSUE-002: 网关配置警告 + +| Field | Value | +|-------|-------| +| **Severity** | medium | +| **Category** | console | +| **URL** | N/A | +| **Repro Video** | N/A | + +**Description** + +网关启动时出现多个配置警告: +1. `management.endpoint.env.enabled` 配置项使用了不兼容的目标类型 +2. `management.endpoint.loggers.enabled` 配置项使用了不兼容的目标类型 +3. `management.endpoint.metrics.enabled` 配置项使用了不兼容的目标类型 +4. `management.metrics.web.server.request.autotime.enabled` 配置项应该全局配置 + +**Expected Behavior** +- 网关启动时不应该有配置警告 +- 配置文件应该符合Spring Boot 3.x的最佳实践 + +**Actual Behavior** +- 网关启动时出现多个配置警告 +- 虽然不影响功能,但可能会在未来的Spring Boot版本中导致问题 + +**Impact** +- 配置警告可能导致未来的兼容性问题 +- 影响日志的可读性 + +--- + +### ISSUE-003: Playwright测试执行卡住 + +| Field | Value | +|-------|-------| +| **Severity** | medium | +| **Category** | functional | +| **URL** | N/A | +| **Repro Video** | N/A | + +**Description** + +执行Playwright测试时,测试进程似乎卡住,没有输出任何内容: +- 运行 `npm run test:e2e:journeys` 后,进程一直处于运行状态 +- 没有测试输出,没有错误信息 +- 需要手动终止进程 + +**Expected Behavior** +- 测试应该正常执行并输出结果 +- 如果有问题,应该输出错误信息 + +**Actual Behavior** +- 测试进程卡住,无输出 +- 无法判断测试是否在运行 + +**Impact** +- 无法执行自动化测试 +- 影响CI/CD流程 +- 无法验证代码质量 + +--- + +### ISSUE-004: 测试数据清理不彻底 + +| Field | Value | +|-------|-------| +| **Severity** | low | +| **Category** | functional | +| **URL** | N/A | +| **Repro Video** | N/A | + +**Description** + +数据库中存在测试用户数据,说明之前的测试没有正确清理: +- 用户表中有多条 `testuser_*` 开头的测试用户 +- 这些数据可能是之前测试遗留的 + +**Expected Behavior** +- 每次测试后应该清理测试数据 +- 数据库应该保持干净状态 + +**Actual Behavior** +- 数据库中存在遗留的测试数据 +- 可能影响后续测试的结果 + +**Impact** +- 可能导致测试结果不准确 +- 影响数据质量 + +--- + +## Recommendations + +### 高优先级 +1. **简化API签名验证机制**: + - 提供测试模式,允许跳过签名验证 + - 或者提供测试工具/库来简化签名生成 + - 改进错误信息,提供更详细的调试信息 + +### 中优先级 +2. **修复网关配置警告**: + - 更新配置文件以符合Spring Boot 3.x的最佳实践 + - 参考Spring Boot官方文档更新配置项 + +3. **修复Playwright测试问题**: + - 检查Playwright配置 + - 确保测试能够正常执行 + - 添加超时机制,避免测试卡住 + +### 低优先级 +4. **改进测试数据清理**: + - 在测试套件中添加清理步骤 + - 使用事务回滚或数据库快照来隔离测试数据 + +## Test Coverage + +### 已测试的功能模块 +- ✅ 用户登录 +- ✅ 用户管理(查询) +- ✅ 角色管理(查询) +- ✅ 菜单管理(查询) +- ✅ 字典管理(查询) +- ✅ 系统配置(查询) + +### 未测试的功能模块 +- ❌ 用户管理(创建、编辑、删除) +- ❌ 角色管理(创建、编辑、删除) +- ❌ 字典管理(创建、编辑、删除) +- ❌ 系统配置(创建、编辑、删除) +- ❌ 文件管理 +- ❌ 通知管理 +- ❌ 日志管理 + +## Conclusion + +本次dogfood测试发现了一些关键问题: +1. API签名验证机制增加了测试复杂度,需要改进 +2. 网关配置存在警告,需要修复以避免未来的兼容性问题 +3. Playwright测试执行存在问题,需要修复 +4. 测试数据清理不彻底,需要改进 + +建议优先解决API签名验证问题,以便能够更有效地进行自动化测试。同时,修复网关配置警告和Playwright测试问题,确保测试套件能够正常运行。 diff --git a/novalon-manage-web/.eslintrc.cjs b/novalon-manage-web/.eslintrc.cjs index b422f33..8f2f28e 100644 --- a/novalon-manage-web/.eslintrc.cjs +++ b/novalon-manage-web/.eslintrc.cjs @@ -1,25 +1,26 @@ module.exports = { root: true, - env: { - browser: true, - es2021: true, - node: true - }, + env: { browser: true, es2020: true }, extends: [ 'eslint:recommended', - 'plugin:vue/vue3-recommended', - 'plugin:@typescript-eslint/recommended' + 'plugin:@typescript-eslint/recommended', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + 'plugin:react/jsx-runtime', ], - parser: 'vue-eslint-parser', + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', parserOptions: { ecmaVersion: 'latest', - parser: '@typescript-eslint/parser', - sourceType: 'module' + sourceType: 'module', + ecmaFeatures: { jsx: true }, }, - plugins: ['vue', '@typescript-eslint'], + plugins: ['react-refresh'], rules: { - 'vue/multi-word-component-names': 'off', + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + 'react/prop-types': 'off', '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }] - } + '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], + }, + settings: { react: { version: 'detect' } }, } diff --git a/novalon-manage-web/index.html b/novalon-manage-web/index.html index 38c05c8..c44def7 100644 --- a/novalon-manage-web/index.html +++ b/novalon-manage-web/index.html @@ -7,7 +7,7 @@