提交 d0738690 authored 作者: 陈泽健's avatar 陈泽健

feat(security): 安全测试升级为一级菜单,补充26个用例,修复报告类型标签

- 安全测试从自动化测试子菜单拆出,升级为独立一级菜单(Lock图标)
- 安全用例管理页面隐藏智能定位按钮(v-if caseType筛选)
- security_executor.py: 新增header_contains/cors_allow_wildcard断言
- create_security_cases.py: 新增26个用例(JWT伪造/CORS/XSS/回归/红线等,总计68个)
- 修复报告列表接口返回case_type字段,前端报告类型标签正确显示'安全测试'
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
上级 26cc89c5
# HANDOFF — 安全测试模块会话交接文档
> **生成时间**: 2026-07-22
> **最后更新**: 2026-07-22 12:40
> **最后更新**: 2026-08-13
> **当前分支**: `platform-auto-test`
> **开发窗口**: 安全测试模块(与会议管理窗口并行)
> **开发窗口**: 安全测试模块
> **最近提交**: `4c3301ee` feat(security): 前端报告中心适配安全报告+补充API3/4/6/7/9/10用例
> **状态**: ✅ 安全测试 P1 全部完成 + P2 执行验证完成
> **状态**: ✅ 安全测试 P1 全部完成 + P2 执行验证完成 + 菜单升级为一级菜单
---
## ⚠️ 多窗口并行开发注意(安全测试窗口)
本窗口是**安全测试模块开发**,与另一个窗口(会议管理/UI自动化)并行开发**必须遵守** `Docs/多窗口并行开发指南.md`
本窗口是**安全测试模块开发****必须遵守** `Docs/多窗口并行开发指南.md`
| 项目 | 安全测试窗口(本窗口) | 会议管理窗口 |
|------|----------------------|------------|
......@@ -94,7 +94,39 @@
| API9 - 库存管理不当 | 3 | sec_2_9_001/002/003 | high/medium/low |
| API10 - 不安全的第三方API集成 | 3 | sec_2_10_001/002/003 | high/medium/critical |
### 2.3 文档
### 2.3 菜单升级:安全测试作为一级菜单(2026-08-13)
**变更内容**:安全测试从"自动化测试"父菜单中拆出,升级为独立的一级菜单。
| 文件 | 修改内容 |
|------|---------|
| `frontend/src/App.vue` | 1. 从"自动化测试"子菜单中移除安全测试三个入口(用例管理/执行中心/报告中心)<br>2. 新增独立一级菜单"安全测试"(`<Lock />` 图标),含三个子项<br>3. 页面标题映射新增 `'/security': '安全测试'`<br>4. 菜单高亮逻辑新增 `/security` 路径支持 |
**菜单结构变更**
```
自动化测试(改前) 自动化测试(改后)
├── 用例管理 ├── 用例管理
│ ├── UI自动化 │ ├── UI自动化
│ ├── 接口自动化 │ └── 接口自动化
│ └── 安全自动化测试 ← 移除 ├── 执行中心
├── 执行中心 │ ├── UI自动化
│ ├── UI自动化 │ └── 接口自动化
│ ├── 接口自动化 └── 报告中心
│ └── 安全自动化测试 ← 移除 ├── UI自动化测试
└── 报告中心 └── 接口测试
├── UI自动化测试
├── 接口测试 安全测试(新增一级菜单)
└── 安全测试 ← 移除 ├── 用例管理
├── 执行中心
└── 报告中心
```
**路由影响**:无变化。安全测试路由仍复用 `/cases/security``/execution/security``/reports/security`,仅菜单结构变更。
**构建验证**:✅ `npm run build` 通过。
### 2.4 文档
| 文件 | 说明 |
|------|------|
......@@ -257,9 +289,9 @@ PYTHONIOENCODING=utf-8 python scripts/create_security_cases.py
- `68b2fbbf` feat(security): 安全测试报告生成服务+格式对齐参考实现
- `4c3301ee` feat(security): 前端报告中心适配安全报告+补充API3/4/6/7/9/10用例
**本次会话未提交**(仅执行验证,无代码变更)
- 执行了 42 个安全测试用例,验证全流程正常
- 发现报告类型标签显示问题(P2.5 待修复)
**2026-08-13 菜单升级(未提交)**
- `frontend/src/App.vue` — 安全测试升级为一级菜单(详见二、2.3 节)
- 前端构建已通过,待下次会话提交
---
......
......@@ -172,6 +172,7 @@ async def list_reports(
{
"id": e.id,
"name": e.name,
"case_type": e.case_type,
"pass_rate": e.pass_rate,
"total_cases": e.total_cases,
"passed": e.passed,
......
......@@ -37,7 +37,7 @@
<el-menu-item index="/modules/custom">项目定制模块</el-menu-item>
</el-sub-menu>
<!-- 自动化测试(父菜单,UI/接口 两类) -->
<!-- 自动化测试(父菜单,UI 自动化) -->
<el-sub-menu index="/auto">
<template #title>
<el-icon><VideoPlay /></el-icon>
......@@ -45,34 +45,22 @@
</template>
<!-- 用例管理 -->
<el-sub-menu index="/cases">
<template #title>
<el-icon><Document /></el-icon>
<span>用例管理</span>
</template>
<el-menu-item index="/cases/ui">UI自动化</el-menu-item>
<el-menu-item index="/cases/api">接口自动化</el-menu-item>
</el-sub-menu>
<el-menu-item index="/cases/ui">
<el-icon><Document /></el-icon>
<span>用例管理</span>
</el-menu-item>
<!-- 执行中心 -->
<el-sub-menu index="/execution">
<template #title>
<el-icon><VideoPlay /></el-icon>
<span>执行中心</span>
</template>
<el-menu-item index="/execution/ui">UI自动化</el-menu-item>
<el-menu-item index="/execution/api">接口自动化</el-menu-item>
</el-sub-menu>
<el-menu-item index="/execution/ui">
<el-icon><VideoPlay /></el-icon>
<span>执行中心</span>
</el-menu-item>
<!-- 报告中心 -->
<el-sub-menu index="/reports">
<template #title>
<el-icon><DataLine /></el-icon>
<span>报告中心</span>
</template>
<el-menu-item index="/reports/ui">UI自动化测试</el-menu-item>
<el-menu-item index="/reports/api">接口测试</el-menu-item>
</el-sub-menu>
<el-menu-item index="/reports/ui">
<el-icon><DataLine /></el-icon>
<span>报告中心</span>
</el-menu-item>
</el-sub-menu>
<!-- 安全测试(一级菜单,含用例/执行/报告) -->
......@@ -150,6 +138,16 @@
<el-menu-item index="/system/info">系统信息</el-menu-item>
<el-menu-item index="/system/logs">操作日志</el-menu-item>
</el-sub-menu>
<!-- 文档管理(父菜单,含文档校正优化和文档翻译两个子页面) -->
<el-sub-menu index="/document">
<template #title>
<el-icon><EditPen /></el-icon>
<span>文档管理</span>
</template>
<el-menu-item index="/document/optimize">文档校正优化</el-menu-item>
<el-menu-item index="/document/translate">文档翻译</el-menu-item>
</el-sub-menu>
</el-menu>
</el-aside>
......@@ -205,7 +203,8 @@ import {
Iphone,
Tools,
Lock,
Setting
Setting,
EditPen
} from '@element-plus/icons-vue'
// ==================== 响应式数据 ====================
......@@ -220,7 +219,6 @@ const route = useRoute()
/** 分类标签映射:用例管理/执行中心 */
const CASE_TYPE_LABELS: Record<string, string> = {
ui: 'UI自动化',
api: '接口自动化',
security: '安全自动化测试',
}
......@@ -236,7 +234,6 @@ const DEVICE_SIM_LABELS: Record<string, string> = {
/** 分类标签映射:报告中心 */
const REPORT_TYPE_LABELS: Record<string, string> = {
ui: 'UI自动化测试',
api: '接口测试',
security: '安全测试',
functional: '功能测试报告',
}
......@@ -274,13 +271,19 @@ const FUNCTIONAL_LABELS: Record<string, string> = {
'erp-config': 'ERP 配置',
}
/** 文档管理子页面标签映射 */
const DOCUMENT_LABELS: Record<string, string> = {
optimize: '文档校正优化',
translate: '文档翻译',
}
/** 当前激活菜单项(无 type 时回退到默认子项以保持高亮) */
const currentRoute = computed(() => {
const seg = route.path.split('/').filter(Boolean)
const root = '/' + (seg[0] || '')
// 无 type 参数时回退到默认子项,保证菜单高亮
if (seg.length === 1 && ['/modules', '/cases', '/execution', '/reports', '/system', '/deploy', '/device-sim', '/performance', '/security'].includes(root)) {
const defaultType = root === '/modules' ? 'standard' : root === '/system' ? 'settings' : root === '/deploy' ? 'servers' : root === '/device-sim' ? 'settings' : root === '/performance' ? 'tasks' : root === '/security' ? 'security' : 'ui'
if (seg.length === 1 && ['/modules', '/cases', '/execution', '/reports', '/system', '/deploy', '/device-sim', '/performance', '/security', '/document'].includes(root)) {
const defaultType = root === '/modules' ? 'standard' : root === '/system' ? 'settings' : root === '/deploy' ? 'servers' : root === '/device-sim' ? 'settings' : root === '/performance' ? 'tasks' : root === '/security' ? 'security' : root === '/document' ? 'optimize' : 'ui'
return `${root}/${defaultType}`
}
return route.path
......@@ -304,6 +307,7 @@ const pageTitle = computed(() => {
'/tools': '辅助工具',
'/device-sim': '设备模拟',
'/system': '系统管理',
'/document': '文档管理',
}
const base = baseMap[root] || '测试管理平台'
const type = seg[1]
......@@ -316,12 +320,13 @@ const pageTitle = computed(() => {
const typeLabel = (() => {
if (root === '/modules') return MODULE_TYPE_LABELS[type]
if (root === '/reports') return REPORT_TYPE_LABELS[type]
if (root === '/cases' || root === '/execution') return CASE_TYPE_LABELS[type]
if (root === '/reports') return type === 'ui' ? '' : REPORT_TYPE_LABELS[type]
if (root === '/cases' || root === '/execution') return type === 'ui' ? '' : CASE_TYPE_LABELS[type]
if (root === '/device-sim') return DEVICE_SIM_LABELS[type]
if (root === '/system') return SYSTEM_LABELS[type]
if (root === '/deploy') return DEPLOY_LABELS[type]
if (root === '/performance') return PERFORMANCE_LABELS[type]
if (root === '/document') return DOCUMENT_LABELS[type]
return ''
})()
......
......@@ -186,12 +186,12 @@
查看
</el-button>
<el-button
v-if="row.caseType === 'ui'"
size="small"
type="success"
link
@click="showLocateConfig(row)"
:loading="locatingCaseId === row.id"
:disabled="row.caseType !== 'ui'"
>
智能定位
</el-button>
......@@ -598,7 +598,6 @@ setPageUrl(DEFAULT_TARGET_URL)
/** 用例类型选项 */
const CASE_TYPE_OPTIONS = [
{ label: 'UI自动化', value: 'ui' },
{ label: '接口自动化', value: 'api' },
{ label: '安全自动化测试', value: 'security' },
]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论