@lobehub/lobehub 2.0.0-next.266 → 2.0.0-next.268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.cursor/rules/microcopy-cn.mdc +75 -63
  2. package/.cursor/rules/microcopy-en.mdc +4 -8
  3. package/CHANGELOG.md +50 -0
  4. package/README.md +8 -8
  5. package/README.zh-CN.md +8 -8
  6. package/apps/desktop/src/main/locales/default/common.ts +2 -2
  7. package/changelog/v1.json +10 -0
  8. package/docs/development/database-schema.dbml +4 -0
  9. package/e2e/CLAUDE.md +43 -81
  10. package/e2e/cucumber.config.js +1 -0
  11. package/e2e/docs/local-setup.md +67 -219
  12. package/e2e/scripts/setup.ts +529 -0
  13. package/e2e/src/features/home/sidebarAgent.feature +62 -0
  14. package/e2e/src/features/home/sidebarGroup.feature +62 -0
  15. package/e2e/src/features/page/README.md +118 -0
  16. package/e2e/src/features/page/crud.feature +62 -0
  17. package/e2e/src/features/page/editor-content.feature +93 -0
  18. package/e2e/src/features/page/editor-meta.feature +60 -0
  19. package/e2e/src/steps/agent/conversation.steps.ts +4 -4
  20. package/e2e/src/steps/home/sidebarAgent.steps.ts +370 -0
  21. package/e2e/src/steps/home/sidebarGroup.steps.ts +168 -0
  22. package/e2e/src/steps/hooks.ts +4 -0
  23. package/e2e/src/steps/page/editor-content.steps.ts +344 -0
  24. package/e2e/src/steps/page/editor-meta.steps.ts +410 -0
  25. package/e2e/src/steps/page/page-crud.steps.ts +363 -0
  26. package/e2e/src/support/world.ts +12 -0
  27. package/locales/ar/file.json +2 -0
  28. package/locales/bg-BG/file.json +2 -0
  29. package/locales/de-DE/file.json +2 -0
  30. package/locales/en-US/auth.json +1 -1
  31. package/locales/en-US/file.json +2 -0
  32. package/locales/en-US/metadata.json +2 -2
  33. package/locales/es-ES/file.json +2 -0
  34. package/locales/fa-IR/file.json +2 -0
  35. package/locales/fr-FR/file.json +2 -0
  36. package/locales/it-IT/file.json +2 -0
  37. package/locales/ja-JP/file.json +2 -0
  38. package/locales/ko-KR/file.json +2 -0
  39. package/locales/nl-NL/file.json +2 -0
  40. package/locales/pl-PL/file.json +2 -0
  41. package/locales/pt-BR/file.json +2 -0
  42. package/locales/ru-RU/file.json +2 -0
  43. package/locales/tr-TR/file.json +2 -0
  44. package/locales/vi-VN/file.json +2 -0
  45. package/locales/zh-CN/file.json +2 -0
  46. package/locales/zh-TW/file.json +2 -0
  47. package/package.json +3 -3
  48. package/packages/builtin-agents/src/agents/agent-builder/index.ts +1 -1
  49. package/packages/builtin-agents/src/agents/group-agent-builder/index.ts +1 -1
  50. package/packages/builtin-agents/src/agents/page-agent/index.ts +1 -1
  51. package/packages/const/src/settings/group.ts +0 -10
  52. package/packages/database/migrations/0068_update_group_data.sql +4 -0
  53. package/packages/database/migrations/meta/0068_snapshot.json +9588 -0
  54. package/packages/database/migrations/meta/_journal.json +7 -0
  55. package/packages/database/src/models/__tests__/chatGroup.test.ts +5 -7
  56. package/packages/database/src/models/__tests__/knowledgeBase.test.ts +185 -0
  57. package/packages/database/src/models/knowledgeBase.ts +67 -3
  58. package/packages/database/src/repositories/agentGroup/index.test.ts +23 -29
  59. package/packages/database/src/repositories/agentGroup/index.ts +4 -9
  60. package/packages/database/src/repositories/knowledge/index.ts +3 -3
  61. package/packages/database/src/schemas/chatGroup.ts +4 -3
  62. package/packages/database/src/types/chatGroup.ts +0 -7
  63. package/packages/types/src/agentGroup/index.ts +30 -9
  64. package/packages/utils/src/multimodalContent.test.ts +302 -0
  65. package/packages/utils/src/server/__tests__/sse.test.ts +353 -0
  66. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentGroupItem/Editing.tsx +4 -11
  67. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentGroupItem/index.tsx +3 -3
  68. package/src/app/[variants]/(main)/home/_layout/Body/Agent/ModalProvider.tsx +9 -32
  69. package/src/app/[variants]/(main)/home/_layout/hooks/useCreateMenuItems.tsx +3 -37
  70. package/src/app/[variants]/(main)/home/_layout/hooks/useSessionGroupMenuItems.tsx +7 -53
  71. package/src/app/[variants]/(main)/home/features/RecentPage/List.tsx +2 -1
  72. package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +1 -1
  73. package/src/app/[variants]/(main)/resource/library/_layout/Sidebar.tsx +2 -2
  74. package/src/app/[variants]/(main)/resource/library/features/LibraryMenu.tsx +2 -2
  75. package/src/app/[variants]/(mobile)/chat/settings/features/SettingButton.tsx +2 -12
  76. package/src/components/ChatGroupWizard/ChatGroupWizard.tsx +5 -27
  77. package/src/components/DragUpload/index.tsx +24 -27
  78. package/src/components/MemberSelectionModal/MemberSelectionModal.tsx +2 -11
  79. package/src/features/ChatInput/ActionBar/Params/Controls.tsx +42 -7
  80. package/src/features/CommandMenu/useCommandMenu.ts +4 -14
  81. package/src/features/ResourceManager/components/Editor/index.tsx +2 -3
  82. package/src/features/ResourceManager/components/Explorer/Header/index.tsx +13 -17
  83. package/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx +1 -1
  84. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/TruncatedFileName.tsx +130 -0
  85. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +36 -4
  86. package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +4 -3
  87. package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +58 -2
  88. package/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx +58 -6
  89. package/src/features/ResourceManager/components/Explorer/MoveToFolderModal.tsx +2 -5
  90. package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +9 -5
  91. package/src/features/ResourceManager/components/Explorer/index.tsx +11 -56
  92. package/src/features/ResourceManager/components/Header/AddButton.tsx +5 -6
  93. package/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx +382 -0
  94. package/src/features/ResourceManager/components/LibraryHierarchy/index.tsx +396 -0
  95. package/src/features/ResourceManager/components/LibraryHierarchy/styles.ts +19 -0
  96. package/src/features/ResourceManager/components/LibraryHierarchy/treeState.ts +178 -0
  97. package/src/features/ResourceManager/components/LibraryHierarchy/types.ts +10 -0
  98. package/src/features/ResourceManager/index.tsx +3 -0
  99. package/src/layout/GlobalProvider/GroupWizardProvider.tsx +6 -29
  100. package/src/locales/default/auth.ts +1 -1
  101. package/src/locales/default/file.ts +2 -0
  102. package/src/locales/default/metadata.ts +2 -2
  103. package/src/server/modules/AgentRuntime/AgentRuntimeCoordinator.ts +30 -30
  104. package/src/server/modules/AgentRuntime/AgentStateManager.ts +23 -23
  105. package/src/server/modules/AgentRuntime/InMemoryAgentStateManager.ts +16 -16
  106. package/src/server/modules/AgentRuntime/InMemoryStreamEventManager.ts +13 -13
  107. package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +2 -2
  108. package/src/server/modules/AgentRuntime/StreamEventManager.ts +18 -18
  109. package/src/server/modules/AgentRuntime/types.ts +21 -21
  110. package/src/server/routers/lambda/__tests__/agentGroup.test.ts +8 -8
  111. package/src/server/routers/lambda/agentGroup.ts +10 -12
  112. package/src/server/services/document/index.ts +1 -0
  113. package/src/store/agentGroup/slices/curd.test.ts +4 -4
  114. package/src/store/file/slices/fileManager/action.ts +12 -4
  115. package/src/store/home/slices/homeInput/action.ts +0 -3
  116. package/src/store/home/slices/sidebarUI/action.ts +9 -0
  117. package/src/store/session/slices/session/action.ts +5 -9
  118. package/src/app/[variants]/(mobile)/chat/settings/features/AgentTeamSettings/index.tsx +0 -95
  119. package/src/features/GroupChatSettings/AgentCard.tsx +0 -154
  120. package/src/features/GroupChatSettings/AgentTeamChatSettings.tsx +0 -179
  121. package/src/features/GroupChatSettings/AgentTeamMembersSettings.tsx +0 -244
  122. package/src/features/GroupChatSettings/AgentTeamMetaSettings.tsx +0 -94
  123. package/src/features/GroupChatSettings/AgentTeamSettings.tsx +0 -54
  124. package/src/features/GroupChatSettings/GroupCategory/index.tsx +0 -30
  125. package/src/features/GroupChatSettings/GroupCategory/useGroupCategory.tsx +0 -42
  126. package/src/features/GroupChatSettings/GroupChatSettingsProvider.tsx +0 -19
  127. package/src/features/GroupChatSettings/HostMemberCard.tsx +0 -113
  128. package/src/features/GroupChatSettings/StoreUpdater.tsx +0 -34
  129. package/src/features/GroupChatSettings/hooks/useGroupChatSettings.ts +0 -25
  130. package/src/features/GroupChatSettings/index.ts +0 -16
  131. package/src/features/GroupChatSettings/store/action.ts +0 -105
  132. package/src/features/GroupChatSettings/store/index.ts +0 -18
  133. package/src/features/GroupChatSettings/store/initialState.ts +0 -23
  134. package/src/features/GroupChatSettings/store/selectors.ts +0 -13
  135. package/src/features/ResourceManager/components/Tree/index.tsx +0 -883
  136. /package/src/features/ResourceManager/components/{Tree → LibraryHierarchy}/TreeSkeleton.tsx +0 -0
@@ -0,0 +1,118 @@
1
+ # Page 模块 E2E 测试覆盖
2
+
3
+ 本目录包含 Page(文稿)模块的所有 E2E 测试用例。
4
+
5
+ ## 模块概述
6
+
7
+ Page 模块是 LobeHub 的文档管理功能,允许用户创建、编辑和管理文稿页面。
8
+
9
+ **路由**: `/page`, `/page/[id]`
10
+
11
+ ## 功能清单与测试覆盖
12
+
13
+ ### 1. 侧边栏 - 文稿列表管理
14
+
15
+ | 功能点 | 描述 | 优先级 | 状态 | 测试文件 |
16
+ | ------------ | ------------------------------ | ------ | ---- | -------------- |
17
+ | 创建文稿 | 点击 + 按钮创建新文稿 | P0 | ✅ | `crud.feature` |
18
+ | 重命名文稿 | 右键菜单 / 三点菜单重命名 | P0 | ✅ | `crud.feature` |
19
+ | 复制文稿 | 复制文稿(自动添加 Copy 后缀) | P1 | ✅ | `crud.feature` |
20
+ | 删除文稿 | 删除文稿(带确认弹窗) | P0 | ✅ | `crud.feature` |
21
+ | 复制全文 | 复制文稿内容到剪贴板 | P2 | ⏳ | |
22
+ | 列表分页设置 | 设置显示数量(20/40/60/100) | P2 | ⏳ | |
23
+ | 全部文稿抽屉 | 打开完整列表 + 搜索 | P2 | ⏳ | |
24
+ | 搜索文稿 | 按标题 / 内容搜索过滤 | P1 | ⏳ | |
25
+
26
+ ### 2. 编辑器 - 文稿头部
27
+
28
+ | 功能点 | 描述 | 优先级 | 状态 | 测试文件 |
29
+ | ------------- | -------------------------- | ------ | ---- | --------------------- |
30
+ | 返回按钮 | 返回上一页 | P2 | ⏳ | |
31
+ | 标题编辑 | 大标题输入框,自动保存 | P0 | ✅ | `editor-meta.feature` |
32
+ | Emoji 选择 | 点击选择 / 更换 / 删除图标 | P1 | ✅ | `editor-meta.feature` |
33
+ | 自动保存提示 | 显示保存状态 | P2 | ⏳ | |
34
+ | 全宽模式切换 | 大屏幕下切换全宽 / 定宽 | P2 | ⏳ | |
35
+ | 复制链接 | 复制文稿 URL | P2 | ⏳ | |
36
+ | 导出 Markdown | 导出为 .md 文件 | P2 | ⏳ | |
37
+ | 页面信息 | 显示最后编辑时间 | P2 | ⏳ | |
38
+
39
+ ### 3. 编辑器 - 富文本编辑
40
+
41
+ | 功能点 | 描述 | 优先级 | 状态 | 测试文件 |
42
+ | ------------- | ------------------------ | ------ | ---- | ------------------------ |
43
+ | 基础文本输入 | 输入和编辑文本 | P0 | ✅ | `editor-content.feature` |
44
+ | 斜杠命令 (/) | 打开命令菜单 | P1 | ✅ | `editor-content.feature` |
45
+ | 标题 H1/H2/H3 | 插入标题 | P1 | ✅ | `editor-content.feature` |
46
+ | 任务列表 | 插入待办事项 | P2 | ✅ | `editor-content.feature` |
47
+ | 无序列表 | 插入项目符号列表 | P2 | ✅ | `editor-content.feature` |
48
+ | 有序列表 | 插入编号列表 | P2 | ⏳ | |
49
+ | 图片上传 | 插入图片 | P2 | ⏳ | |
50
+ | 分隔线 | 插入水平分隔线 | P2 | ⏳ | |
51
+ | 表格 | 插入表格 | P2 | ⏳ | |
52
+ | 代码块 | 插入代码块(带语法高亮) | P2 | 🚧 | `editor-content.feature` |
53
+ | LaTeX 公式 | 插入数学公式 | P2 | ⏳ | |
54
+ | 文本加粗 | 使用快捷键加粗 | P1 | ✅ | `editor-content.feature` |
55
+ | 文本斜体 | 使用快捷键斜体 | P2 | ✅ | `editor-content.feature` |
56
+
57
+ ### 4. Copilot 侧边栏
58
+
59
+ | 功能点 | 描述 | 优先级 | 状态 | 测试文件 |
60
+ | --------------- | ------------------- | ------ | ---- | ----------------- |
61
+ | 打开 / 关闭面板 | 展开 / 收起 Copilot | P1 | ⏳ | `copilot.feature` |
62
+ | Ask Copilot | 选中文本后询问 | P0 | ⏳ | `copilot.feature` |
63
+ | Agent 切换 | 选择不同的 Agent | P2 | ⏳ | |
64
+ | 新建话题 | 创建新的对话话题 | P2 | ⏳ | |
65
+ | 话题历史 | 查看和切换历史话题 | P2 | ⏳ | |
66
+ | 对话交互 | 发送消息、接收回复 | P0 | ⏳ | `copilot.feature` |
67
+ | 模型选择 | 切换使用的模型 | P2 | ⏳ | |
68
+ | 文件上传 | 拖放上传文件 | P2 | ⏳ | |
69
+
70
+ ## 测试文件结构
71
+
72
+ ```
73
+ e2e/src/features/page/
74
+ ├── README.md # 本文档
75
+ ├── crud.feature # 侧边栏 CRUD 操作 (5 scenarios)
76
+ ├── editor-meta.feature # 编辑器元数据(标题、Emoji)(6 scenarios)
77
+ └── editor-content.feature # 富文本编辑功能 (8 scenarios)
78
+ ```
79
+
80
+ ## 测试统计
81
+
82
+ - **总场景数**: 19 (通过) + 1 (跳过)
83
+ - **总步骤数**: 109+
84
+ - **执行时间**: \~3 分钟
85
+
86
+ ## 测试执行
87
+
88
+ ```bash
89
+ # 运行 Page 模块所有测试
90
+ cd e2e
91
+ BASE_URL=http://localhost:3006 \
92
+ DATABASE_URL=postgresql://postgres:postgres@localhost:5433/postgres \
93
+ pnpm exec cucumber-js --config cucumber.config.js --tags "@page and not @skip"
94
+
95
+ # 运行特定测试
96
+ pnpm exec cucumber-js --config cucumber.config.js --tags "@PAGE-CREATE-001"
97
+
98
+ # 调试模式(显示浏览器)
99
+ HEADLESS=false pnpm exec cucumber-js --config cucumber.config.js --tags "@PAGE-TITLE-001"
100
+ ```
101
+
102
+ ## 状态说明
103
+
104
+ - ✅ 已完成 - 测试用例已实现并通过
105
+ - ⏳ 待实现 - 功能已识别,测试待编写
106
+ - 🚧 进行中 - 测试用例正在开发中或需要修复
107
+
108
+ ## 已知问题
109
+
110
+ 1. **代码块测试 (@PAGE-SLASH-005)**: 斜杠命令 `/codeblock` 触发不稳定,已标记 @skip
111
+
112
+ ## 更新记录
113
+
114
+ | 日期 | 更新内容 |
115
+ | ---------- | ----------------------------------------- |
116
+ | 2025-01-12 | 初始化功能清单,完成侧边栏 CRUD |
117
+ | 2025-01-12 | 完成编辑器标题 / Emoji 测试 (6 scenarios) |
118
+ | 2025-01-12 | 完成富文本编辑测试 (8 scenarios,1 跳过) |
@@ -0,0 +1,62 @@
1
+ @journey @P0 @page
2
+ Feature: Page 文稿 CRUD 操作
3
+
4
+ 作为用户,我希望能够创建、编辑和管理文稿页面,
5
+ 以便记录和组织我的笔记和文档
6
+
7
+ Background:
8
+ Given 用户已登录系统
9
+
10
+ # ============================================
11
+ # 创建
12
+ # ============================================
13
+
14
+ @PAGE-CREATE-001
15
+ Scenario: 创建新文稿
16
+ Given 用户在 Page 页面
17
+ When 用户点击新建文稿按钮
18
+ Then 应该创建一个新的文稿
19
+ And 文稿列表中应该显示新文稿
20
+
21
+ # ============================================
22
+ # 重命名
23
+ # ============================================
24
+
25
+ @PAGE-RENAME-001
26
+ Scenario: 通过右键菜单重命名文稿
27
+ Given 用户在 Page 页面有一个文稿
28
+ When 用户右键点击该文稿
29
+ And 用户在菜单中选择重命名
30
+ And 用户输入新的文稿名称 "My Renamed Page"
31
+ Then 该文稿名称应该更新为 "My Renamed Page"
32
+
33
+ @PAGE-RENAME-002 @P1
34
+ Scenario: 重命名文稿后按 Enter 确认
35
+ Given 用户在 Page 页面有一个文稿
36
+ When 用户右键点击该文稿
37
+ And 用户在菜单中选择重命名
38
+ And 用户输入新的文稿名称 "Enter Confirmed Page" 并按 Enter
39
+ Then 该文稿名称应该更新为 "Enter Confirmed Page"
40
+
41
+ # ============================================
42
+ # 复制
43
+ # ============================================
44
+
45
+ @PAGE-DUPLICATE-001 @P1
46
+ Scenario: 复制文稿
47
+ Given 用户在 Page 页面有一个文稿 "Original Page"
48
+ When 用户右键点击该文稿
49
+ And 用户在菜单中选择复制
50
+ Then 文稿列表中应该出现 "Original Page (Copy)"
51
+
52
+ # ============================================
53
+ # 删除
54
+ # ============================================
55
+
56
+ @PAGE-DELETE-001
57
+ Scenario: 删除文稿
58
+ Given 用户在 Page 页面有一个文稿
59
+ When 用户右键点击该文稿
60
+ And 用户在菜单中选择删除
61
+ And 用户在弹窗中确认删除
62
+ Then 该文稿应该从列表中移除
@@ -0,0 +1,93 @@
1
+ @journey @P0 @page
2
+ Feature: Page 编辑器富文本编辑
3
+
4
+ 作为用户,我希望能够使用富文本编辑器编写内容,
5
+ 以便创建格式丰富的文档
6
+
7
+ Background:
8
+ Given 用户已登录系统
9
+
10
+ # ============================================
11
+ # 基础文本编辑
12
+ # ============================================
13
+
14
+ @PAGE-CONTENT-001
15
+ Scenario: 输入基础文本内容
16
+ Given 用户打开一个文稿编辑器
17
+ When 用户点击编辑器内容区域
18
+ And 用户输入文本 "这是一段测试内容"
19
+ Then 编辑器应该显示输入的文本
20
+
21
+ @PAGE-CONTENT-002 @P1
22
+ Scenario: 编辑已有内容
23
+ Given 用户打开一个文稿编辑器
24
+ When 用户在编辑器中输入内容 "原始内容"
25
+ And 用户选中所有内容
26
+ And 用户输入文本 "修改后的内容"
27
+ Then 编辑器应该显示 "修改后的内容"
28
+
29
+ # ============================================
30
+ # 斜杠命令
31
+ # ============================================
32
+
33
+ @PAGE-SLASH-001 @P1
34
+ Scenario: 使用斜杠命令打开菜单
35
+ Given 用户打开一个文稿编辑器
36
+ When 用户点击编辑器内容区域
37
+ And 用户输入斜杠 "/"
38
+ Then 应该显示斜杠命令菜单
39
+
40
+ @PAGE-SLASH-002 @P1
41
+ Scenario: 通过斜杠命令插入一级标题
42
+ Given 用户打开一个文稿编辑器
43
+ When 用户点击编辑器内容区域
44
+ And 用户输入斜杠命令 "/h1"
45
+ And 用户按下 Enter 键
46
+ And 用户输入文本 "一级标题内容"
47
+ Then 编辑器应该包含一级标题
48
+
49
+ @PAGE-SLASH-003 @P1
50
+ Scenario: 通过斜杠命令插入无序列表
51
+ Given 用户打开一个文稿编辑器
52
+ When 用户点击编辑器内容区域
53
+ And 用户输入斜杠命令 "/ul"
54
+ And 用户按下 Enter 键
55
+ And 用户输入文本 "列表项一"
56
+ Then 编辑器应该包含无序列表
57
+
58
+ @PAGE-SLASH-004 @P2
59
+ Scenario: 通过斜杠命令插入任务列表
60
+ Given 用户打开一个文稿编辑器
61
+ When 用户点击编辑器内容区域
62
+ And 用户输入斜杠命令 "/tl"
63
+ And 用户按下 Enter 键
64
+ And 用户输入文本 "待办事项"
65
+ Then 编辑器应该包含任务列表
66
+
67
+ @PAGE-SLASH-005 @P2 @skip
68
+ Scenario: 通过斜杠命令插入代码块
69
+ Given 用户打开一个文稿编辑器
70
+ When 用户点击编辑器内容区域
71
+ And 用户输入斜杠命令 "/codeblock"
72
+ And 用户按下 Enter 键
73
+ Then 编辑器应该包含代码块
74
+
75
+ # ============================================
76
+ # 文本格式化
77
+ # ============================================
78
+
79
+ @PAGE-FORMAT-001 @P1
80
+ Scenario: 使用快捷键加粗文本
81
+ Given 用户打开一个文稿编辑器
82
+ When 用户在编辑器中输入内容 "加粗文本"
83
+ And 用户选中所有内容
84
+ And 用户按下快捷键 "Meta+B"
85
+ Then 选中的文本应该被加粗
86
+
87
+ @PAGE-FORMAT-002 @P2
88
+ Scenario: 使用快捷键斜体文本
89
+ Given 用户打开一个文稿编辑器
90
+ When 用户在编辑器中输入内容 "斜体文本"
91
+ And 用户选中所有内容
92
+ And 用户按下快捷键 "Meta+I"
93
+ Then 选中的文本应该变为斜体
@@ -0,0 +1,60 @@
1
+ @journey @P0 @page
2
+ Feature: Page 编辑器元数据编辑
3
+
4
+ 作为用户,我希望能够编辑文稿的标题和图标,
5
+ 以便更好地组织和识别我的文档
6
+
7
+ Background:
8
+ Given 用户已登录系统
9
+
10
+ # ============================================
11
+ # 标题编辑
12
+ # ============================================
13
+
14
+ @PAGE-TITLE-001
15
+ Scenario: 编辑文稿标题
16
+ Given 用户打开一个文稿编辑器
17
+ When 用户点击标题输入框
18
+ And 用户输入标题 "我的测试文稿"
19
+ And 用户按下 Enter 键
20
+ Then 文稿标题应该更新为 "我的测试文稿"
21
+
22
+ @PAGE-TITLE-002 @P1
23
+ Scenario: 编辑标题后点击其他区域保存
24
+ Given 用户打开一个文稿编辑器
25
+ When 用户点击标题输入框
26
+ And 用户输入标题 "Click Away Title"
27
+ And 用户点击编辑器内容区域
28
+ Then 文稿标题应该更新为 "Click Away Title"
29
+
30
+ @PAGE-TITLE-003 @P1
31
+ Scenario: 清空标题后显示占位符
32
+ Given 用户打开一个文稿编辑器
33
+ When 用户点击标题输入框
34
+ And 用户清空标题内容
35
+ Then 应该显示标题占位符
36
+
37
+ # ============================================
38
+ # Emoji 图标
39
+ # ============================================
40
+
41
+ @PAGE-EMOJI-001 @P1
42
+ Scenario: 为文稿添加 Emoji 图标
43
+ Given 用户打开一个文稿编辑器
44
+ When 用户点击选择图标按钮
45
+ And 用户选择一个 Emoji
46
+ Then 文稿应该显示所选的 Emoji 图标
47
+
48
+ @PAGE-EMOJI-002 @P1
49
+ Scenario: 更换文稿的 Emoji 图标
50
+ Given 用户打开一个带有 Emoji 的文稿
51
+ When 用户点击已有的 Emoji 图标
52
+ And 用户选择另一个 Emoji
53
+ Then 文稿图标应该更新为新的 Emoji
54
+
55
+ @PAGE-EMOJI-003 @P2
56
+ Scenario: 删除文稿的 Emoji 图标
57
+ Given 用户打开一个带有 Emoji 的文稿
58
+ When 用户点击已有的 Emoji 图标
59
+ And 用户点击删除图标按钮
60
+ Then 文稿不应该显示 Emoji 图标
@@ -7,7 +7,7 @@ import { Given, Then, When } from '@cucumber/cucumber';
7
7
  import { expect } from '@playwright/test';
8
8
 
9
9
  import { llmMockManager, presetResponses } from '../../mocks/llm';
10
- import { CustomWorld } from '../../support/world';
10
+ import { CustomWorld, WAIT_TIMEOUT } from '../../support/world';
11
11
 
12
12
  // ============================================
13
13
  // Given Steps
@@ -29,19 +29,19 @@ Given('用户进入 Lobe AI 对话页面', async function (this: CustomWorld) {
29
29
  console.log(' 📍 Step: 导航到首页...');
30
30
  // Navigate to home page first
31
31
  await this.page.goto('/');
32
- await this.page.waitForLoadState('networkidle', { timeout: 10_000 });
32
+ await this.page.waitForLoadState('networkidle', { timeout: WAIT_TIMEOUT });
33
33
 
34
34
  console.log(' 📍 Step: 查找 Lobe AI...');
35
35
  // Find and click on "Lobe AI" agent in the sidebar/home
36
36
  const lobeAIAgent = this.page.locator('text=Lobe AI').first();
37
- await expect(lobeAIAgent).toBeVisible({ timeout: 10_000 });
37
+ await expect(lobeAIAgent).toBeVisible({ timeout: WAIT_TIMEOUT });
38
38
 
39
39
  console.log(' 📍 Step: 点击 Lobe AI...');
40
40
  await lobeAIAgent.click();
41
41
 
42
42
  console.log(' 📍 Step: 等待聊天界面加载...');
43
43
  // Wait for the chat interface to be ready
44
- await this.page.waitForLoadState('networkidle', { timeout: 10_000 });
44
+ await this.page.waitForLoadState('networkidle', { timeout: WAIT_TIMEOUT });
45
45
 
46
46
  console.log(' 📍 Step: 查找输入框...');
47
47
  // The input is a rich text editor with contenteditable