Files
gochat/docs/test-report-2026-07-08.md
T
rogee a1ae852eb2 Fix widget i18n missing locale files and clean up unused locales
- widget/i18n/index.js: only import en.json and zh_CN.json (the only
  locale files present); remove 40+ imports for missing locale JSONs
  that caused Vite compile failure and global white screen
- dashboard/i18n/index.js: remove unused locale imports for consistency
- Remove 62 unused locale JSON files from widget/i18n/locale/
- Minor: update index.html, test helpers, e2e test, languages spec
2026-07-08 09:57:00 +08:00

8.9 KiB

GoChat 前端功能测试报告

  • 测试日期: 2026-07-08
  • 测试人员: Hermes Agent (自动化浏览器测试)
  • 测试环境:
    • 前端: Vite dev server http://localhost:3036
    • 后端: Go backend http://localhost:3000
    • 数据库: PostgreSQL 17 + pgvector (port 5444)
    • 登录账号: admin@gochat.local / changeme
  • 测试方式: CDP 连接浏览器, 逐页导航 + 控制台错误检查 + DOM 快照验证
  • 测试重点: 页面切换是否报错、白屏问题

一、测试范围

序号 页面 URL
1 登录页 /app/login
2 Dashboard /app/accounts/1/dashboard
3 会话详情 点击会话列表项进入
4 Contacts /app/accounts/1/contacts
5 Reports Overview /app/accounts/1/reports/overview
6 Reports Conversations /app/accounts/1/reports/conversation
7 Settings General /app/accounts/1/settings/general
8 Settings Agents /app/accounts/1/settings/agents
9 Settings Inboxes /app/accounts/1/settings/inboxes
10 Campaigns /app/accounts/1/campaigns
11 Help Center /app/accounts/1/portals

二、问题汇总

共发现 5 类问题, 按严重程度排序:

编号 严重程度 问题 影响页面
ISS-01 P0 严重 Reports 图表永久卡在 "Loading chart data..." Reports > Conversations 等 timeseries 页
ISS-02 P0 严重 Settings > General 页面白屏 Settings > General
ISS-03 P0 严重 widget/i18n 缺失 locale 文件导致全局白屏 Campaigns → 全局 (已临时修复)
ISS-04 P2 中等 每次页面导航产生 29 个 JS 异常 (SidebarGroup) 所有 Settings 子页面
ISS-05 P3 低 非致命控制台警告 全局

三、问题详情

ISS-01: Reports 图表永久卡在 "Loading chart data..." [P0]

影响范围: Reports > Conversations、Reports > Agents、Reports > Labels 等所有依赖 timeseries 数据的报表页

现象:

  • 页面加载后 7 个图表全部显示 "Loading chart data..." 且永不完成
  • 每次加载产生 9+ 个 JS 异常 (前端图表组件因 API 500 错误反复重试)
  • Reports Overview 页面的指标卡片和表格正常 (使用不同的 API 端点)

根因:

后端 analytics_query_helpers.go:40 使用 GORM 查询 reporting_events_rollups 表时引用了 date 列:

s.db.Where("account_id = ? AND date = ?", accountID, d).Count(&count)

但数据库迁移文件 000001_init_schema.up.sql:338-351 中建表语句的列名与 GORM 模型完全不匹配:

迁移文件 (SQL) 实际列 GORM 模型期望列
dimension date
dimension_value dimension_type
metric_name dimension_id
value metric
value_in_business_hours count
period sum_value
— sum_value_business_hours

后端日志:

ERROR: column "date" does not exist (SQLSTATE 42703)
SELECT count(*) FROM "reporting_events_rollups" WHERE (account_id = 1 AND date = '2026-07-01 00:00:00')
HTTP GET /api/v2/accounts/1/reports 500

涉及文件:

  • backend/internal/service/analytics_query_helpers.go:40 — 查询代码
  • backend/migrations/000001_init_schema.up.sql:337-353 — 建表语句
  • backend/internal/model/reporting_event.go:68-78 — GORM 模型定义

ISS-02: Settings > General 页面白屏 [P0]

影响范围: /app/accounts/1/settings/general (Account Settings 主页)

现象:

  • 页面完全空白, 无任何内容渲染
  • 控制台报 19 个 JS 异常
  • Vue 警告指向两个组件渲染失败

根因:

  1. AccountId.vue 渲染失败: currentAccount.value.id.toString() 在 currentAccount 为空对象 {} 时报错

    • accounts/getAccount getter (store/modules/accounts.js:26) 在 store 无匹配记录时返回 findRecordById 的结果 || {} (空对象)
    • currentAccount.value.id 为 undefined, 调用 .toString() 抛出 TypeError
    • AccountId.vue:11: const getAccountId = computed(() => currentAccount.value.id.toString());
  2. BuildInfo 组件渲染失败: 同样依赖未正确加载的账户数据

  3. SidebarGroup mounted hooks 失败: Inbox/Conversation/Captain/Contacts/Companies/Reports/Campaigns/Portals/Settings 共 9 个 SidebarGroup 的 mounted hook 执行出错

Vue 警告:

[Vue warn]: Unhandled error during execution of render function
  at <SectionLayout title="Account ID" ...>
  at <AccountId>
  at <Index key="/app/accounts/1/settings/general">

涉及文件:

  • frontend/.../settings/account/components/AccountId.vue:11 — 未做空值保护
  • frontend/.../settings/account/Index.vue — 包含 BuildInfo 组件
  • frontend/.../composables/useAccount.js:25 — currentAccount 可能为空对象
  • frontend/.../store/modules/accounts.js:9-10 — findRecordById 返回 || {}

备注: 其他 Settings 子页面 (Agents/Inboxes/Teams 等) 正常工作, 仅 General 页面白屏


ISS-03: widget/i18n 缺失 locale 文件导致全局白屏 [P0] (已临时修复)

影响范围: 最初导致 Campaigns 页面白屏, 后蔓延至全局 (Dashboard 等所有页面)

现象:

  • Campaigns 页面直接显示 Vite 编译错误页面而非应用内容
  • 错误溯源至 widget/i18n/index.js:1 的 import 语句
  • 后续 Dashboard 等页面也受影响 (因 widget 模块被间接引用)

根因:

widget/i18n/index.js 导入了 40+ 个 locale JSON 文件:

import ar from './locale/ar.json';
import bg from './locale/bg.json';
// ...共 40 个 import

但 locale/ 目录下实际只有 2 个文件:

en.json
zh_CN.json

缺失 38 个 locale 文件, 导致 Vite 编译失败。

临时修复:

已将 index.js 改为只导入存在的两个 locale:

import en from './locale/en.json';
import zh_CN from './locale/zh_CN.json';

export default {
  en,
  zh_CN,
};

涉及文件:

  • frontend/app/javascript/widget/i18n/index.js (已修复)
  • frontend/app/javascript/widget/i18n/locale/ — 缺失 38 个 locale JSON 文件

备注: 临时修复仅保留 en 和 zh_CN, 如需多语言支持需补充 locale 文件或改为动态加载


ISS-04: 每次页面导航产生 29 个 JS 异常 (SidebarGroup) [P2]

影响范围: 所有 Settings 子页面导航 (也出现在其他页面导航中)

现象:

  • 即使页面内容正常渲染, 控制台固定报 29 个空 message 的 exception
  • 异常来源: SidebarGroup (Inbox/Conversation/Captain/Contacts/Companies/Reports/Campaigns/Portals/Settings) 的 mounted hooks 执行出错
  • 不影响页面功能, 但属于不健康的异常噪音

可能原因: SidebarGroup 组件的 mounted hook 依赖某个 store getter 或 feature flag 在路由切换时未正确初始化, 需要进一步排查

涉及文件:

  • frontend/.../components-next/sidebar/Sidebar.vue
  • frontend/.../components-next/sidebar/ 下的 SidebarGroup 相关组件

ISS-05: 非致命控制台警告 [P3]

警告 说明 影响
Vue Router warn: No match found for path "/" 根路由 / 未定义路由, 登录后重定向时触发 无功能影响
onClose prop 弃用警告 (4处) Chatwoot 原始代码使用已弃用的 onClose prop, 应改用 close 事件 无功能影响, 需迁移
ServiceWorker 注册失败 (SecurityError) Vite dev server 返回 text/html MIME 类型, SW 需要 JS 类型 开发环境正常现象, 生产环境不影响
Lit dev mode + 多版本加载 Lit 处于开发模式且加载了多个版本 开发环境警告, 需检查依赖去重

四、正常工作的页面

页面 状态 说明
登录页 ✅ 正常 表单完整, 登录成功, 无 JS 错误
Dashboard ✅ 正常 侧边栏 + 会话列表完整 (修复 i18n 后)
会话详情 ✅ 正常 消息列表 + 回复框 + 联系人信息完整渲染
Contacts ✅ 正常 联系人编辑表单完整 (姓名/邮箱/电话/社交链接等)
Reports Overview ✅ 正常 指标卡片 (Open/Unattended/Unassigned) + Agent Status + 表格正常
Settings Agents ✅ 正常 代理列表 + 搜索框 + 添加按钮正常
Settings Inboxes ✅ 正常 收件箱列表 (Test Website Inbox) + 添加按钮正常
Campaigns ✅ 正常 修复 i18n 后正常, Live Chat/SMS 子菜单 + 空状态正常
Help Center ✅ 正常 文章列表 + 分类 + 语言切换 + 新建按钮正常

五、测试结论

  1. 核心阻断问题: ISS-01 (Reports 500) 和 ISS-02 (Settings General 白屏) 是当前最严重的两个问题, 直接阻断对应功能页面的使用
  2. 已修复问题: ISS-03 (widget/i18n) 已临时修复, 恢复了全局可用性
  3. 可用功能: 登录、Dashboard、会话、联系人、Help Center、Campaigns、Settings 大部分子页面均可正常使用
  4. 建议: 优先修复 ISS-01 和 ISS-02, 然后排查 ISS-04 的 SidebarGroup 异常