feat: 添加测试框架和覆盖率报告功能

feat(测试): 新增Playwright和Vitest测试配置
feat(测试): 添加测试覆盖率报告生成功能
feat(测试): 实现前后端测试脚本集成

fix(测试): 修复测试密码不匹配问题
fix(测试): 修正URL等待策略
fix(测试): 调整错误消息选择器

refactor(测试): 重构测试目录结构
refactor(测试): 优化测试用例组织方式

docs: 更新测试报告文档
docs: 添加测试覆盖率报告模板

ci: 添加Docker测试环境配置
ci: 实现测试自动化脚本

chore: 更新依赖版本
chore: 添加测试相关配置文件
This commit is contained in:
张翔
2026-03-25 09:03:37 +08:00
parent 117978e148
commit e2ad1331cc
126 changed files with 18083 additions and 7805 deletions
@@ -0,0 +1,87 @@
/**
* 系统状态值常量定义
*
* 统一前后端状态值,避免不一致导致的功能问题
*
* @author 张翔
* @date 2026-03-24
*/
/**
* 用户状态枚举
*/
export enum UserStatus {
/** 正常 */
ACTIVE = 1,
/** 禁用 */
INACTIVE = 0,
/** 锁定 */
LOCKED = 2
}
/**
* 角色状态枚举
*/
export enum RoleStatus {
/** 正常 */
ACTIVE = 1,
/** 禁用 */
INACTIVE = 0
}
/**
* 菜单状态枚举
*/
export enum MenuStatus {
/** 正常 */
ACTIVE = 1,
/** 禁用 */
INACTIVE = 0
}
/**
* 通知状态枚举
*/
export enum NoticeStatus {
/** 正常 */
ACTIVE = '1',
/** 禁用 */
INACTIVE = '0'
}
/**
* 状态值映射工具类
*/
export class StatusHelper {
/**
* 判断状态是否为正常
*/
static isActive(status: number | string): boolean {
return status === 1 || status === '1' || status === 'ACTIVE'
}
/**
* 判断状态是否为禁用
*/
static isInactive(status: number | string): boolean {
return status === 0 || status === '0' || status === 'INACTIVE'
}
/**
* 获取状态显示文本
*/
static getStatusText(status: number | string): string {
if (this.isActive(status)) return '正常'
if (this.isInactive(status)) return '禁用'
return '未知'
}
/**
* 获取状态标签类型
*/
static getStatusType(status: number | string): 'success' | 'danger' | 'warning' {
if (this.isActive(status)) return 'success'
if (this.isInactive(status)) return 'danger'
return 'warning'
}
}