08ea5fbe98
添加用户管理视图、API和状态管理文件
204 lines
6.5 KiB
TypeScript
204 lines
6.5 KiB
TypeScript
/**
|
|
* 业务流程工作流定义
|
|
* 定义核心业务场景的完整流程步骤
|
|
*/
|
|
|
|
export interface WorkflowStep {
|
|
name: string;
|
|
action: () => Promise<void>;
|
|
rollback?: () => Promise<void>;
|
|
timeout?: number;
|
|
retryCount?: number;
|
|
}
|
|
|
|
export interface BusinessWorkflow {
|
|
name: string;
|
|
description: string;
|
|
steps: WorkflowStep[];
|
|
preconditions?: () => Promise<boolean>;
|
|
postconditions?: () => Promise<boolean>;
|
|
cleanup?: () => Promise<void>;
|
|
}
|
|
|
|
/**
|
|
* 用户管理工作流
|
|
*/
|
|
export const UserManagementWorkflows = {
|
|
/**
|
|
* 创建用户完整流程
|
|
*/
|
|
createUser: {
|
|
name: 'createUser',
|
|
description: '创建新用户的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToUserManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickAddUserButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'fillUserForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'submitUserForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'verifyUserCreated', action: async () => {}, timeout: 5000 }
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 编辑用户完整流程
|
|
*/
|
|
editUser: {
|
|
name: 'editUser',
|
|
description: '编辑用户的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToUserManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'searchUser', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickEditButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'updateUserForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'submitUserForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'verifyUserUpdated', action: async () => {}, timeout: 5000 }
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 删除用户完整流程
|
|
*/
|
|
deleteUser: {
|
|
name: 'deleteUser',
|
|
description: '删除用户的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToUserManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'searchUser', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickDeleteButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'confirmDelete', action: async () => {}, timeout: 5000 },
|
|
{ name: 'verifyUserDeleted', action: async () => {}, timeout: 5000 }
|
|
]
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 角色管理工作流
|
|
*/
|
|
export const RoleManagementWorkflows = {
|
|
/**
|
|
* 创建角色完整流程
|
|
*/
|
|
createRole: {
|
|
name: 'createRole',
|
|
description: '创建新角色的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToRoleManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickAddRoleButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'fillRoleForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'assignPermissions', action: async () => {}, timeout: 10000 },
|
|
{ name: 'submitRoleForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'verifyRoleCreated', action: async () => {}, timeout: 5000 }
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 编辑角色完整流程
|
|
*/
|
|
editRole: {
|
|
name: 'editRole',
|
|
description: '编辑角色的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToRoleManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'searchRole', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickEditButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'updateRoleForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'updatePermissions', action: async () => {}, timeout: 10000 },
|
|
{ name: 'submitRoleForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'verifyRoleUpdated', action: async () => {}, timeout: 5000 }
|
|
]
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 菜单管理工作流
|
|
*/
|
|
export const MenuManagementWorkflows = {
|
|
/**
|
|
* 创建菜单完整流程
|
|
*/
|
|
createMenu: {
|
|
name: 'createMenu',
|
|
description: '创建新菜单的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToMenuManagement', action: async () => {}, timeout: 10000 },
|
|
{ name: 'clickAddMenuButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'fillMenuForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'selectParentMenu', action: async () => {}, timeout: 5000 },
|
|
{ name: 'submitMenuForm', action: async () => {}, timeout: 10000 },
|
|
{ name: 'verifyMenuCreated', action: async () => {}, timeout: 5000 }
|
|
]
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 认证工作流
|
|
*/
|
|
export const AuthenticationWorkflows = {
|
|
/**
|
|
* 用户登录流程
|
|
*/
|
|
login: {
|
|
name: 'login',
|
|
description: '用户登录的完整流程',
|
|
steps: [
|
|
{ name: 'navigateToLogin', action: async () => {}, timeout: 10000 },
|
|
{ name: 'fillUsername', action: async () => {}, timeout: 5000 },
|
|
{ name: 'fillPassword', action: async () => {}, timeout: 5000 },
|
|
{ name: 'clickLoginButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'verifyLoginSuccess', action: async () => {}, timeout: 10000 }
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 用户登出流程
|
|
*/
|
|
logout: {
|
|
name: 'logout',
|
|
description: '用户登出的完整流程',
|
|
steps: [
|
|
{ name: 'clickUserDropdown', action: async () => {}, timeout: 5000 },
|
|
{ name: 'clickLogoutButton', action: async () => {}, timeout: 5000 },
|
|
{ name: 'verifyLogoutSuccess', action: async () => {}, timeout: 10000 }
|
|
]
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 端到端业务流程
|
|
*/
|
|
export const EndToEndWorkflows = {
|
|
/**
|
|
* 完整用户生命周期流程
|
|
*/
|
|
userLifecycle: {
|
|
name: 'userLifecycle',
|
|
description: '用户从创建到删除的完整生命周期',
|
|
steps: [
|
|
{ name: 'login', action: async () => {}, timeout: 15000 },
|
|
{ name: 'createUser', action: async () => {}, timeout: 30000 },
|
|
{ name: 'verifyUserInList', action: async () => {}, timeout: 10000 },
|
|
{ name: 'editUser', action: async () => {}, timeout: 30000 },
|
|
{ name: 'verifyUserUpdated', action: async () => {}, timeout: 10000 },
|
|
{ name: 'deleteUser', action: async () => {}, timeout: 20000 },
|
|
{ name: 'verifyUserDeleted', action: async () => {}, timeout: 10000 },
|
|
{ name: 'logout', action: async () => {}, timeout: 15000 }
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 权限管理完整流程
|
|
*/
|
|
permissionManagement: {
|
|
name: 'permissionManagement',
|
|
description: '创建角色并分配权限的完整流程',
|
|
steps: [
|
|
{ name: 'login', action: async () => {}, timeout: 15000 },
|
|
{ name: 'createRole', action: async () => {}, timeout: 30000 },
|
|
{ name: 'assignPermissions', action: async () => {}, timeout: 20000 },
|
|
{ name: 'createUserWithRole', action: async () => {}, timeout: 30000 },
|
|
{ name: 'verifyPermissions', action: async () => {}, timeout: 20000 },
|
|
{ name: 'cleanup', action: async () => {}, timeout: 30000 }
|
|
]
|
|
}
|
|
};
|