两个都是"看着不对劲"的问题: 1. 侧栏把二级分类全堆在一级分类后面(按 depth 排序的副作用), 「技术」和它的上级「我的备忘」隔着十几行,看着像一棵假树。 后端改成按树的先序返回(父分类后紧跟它的子分类,兄弟仍按 sort_order、name), 前端照 depth 缩进就是个真树;二级以下再加一个「·」标记,小屏也分得清。 2. 点开已发布的知识只有「归档」,没有改的入口——因为后端原来硬性拒绝 修改已发布内容(7003)。但"发布"是给团队看的,写错了总要能改: 现在已发布的可以直接 PATCH,改完立刻重建检索切片(chunk_count 当场更新), 状态和版本号照常推进;归档的仍然要先「恢复成草稿」再改。 Web 与安卓同步:抽屉/详情里已发布也显示「编辑」,安卓分类标签区不再锁。 验证:pytest 95 passed(新增"分类按树返回"用例、发布后可改用例)、 ruff 全绿、tsc 0、vite build ✓;`knowledge-notebook.mjs` 17 项、 `knowledge.mjs` 9 项 e2e 全绿。安卓仍未编译(JDK 25 / Gradle 8.7 不兼容)。
This commit is contained in:
@@ -77,6 +77,15 @@ try {
|
||||
await page.getByRole("button", { name: /^部署/, exact: false }).first().waitFor();
|
||||
check("能在侧栏建出「研发 / 部署」两级分类", true);
|
||||
|
||||
// 树要按「父在前、子紧跟」排:部署必须紧挨在研发后面,而不是堆在别的根分类后面
|
||||
const navTexts = await page.locator("aside nav button").allInnerTexts();
|
||||
const navNames = navTexts.map((t) => t.replace(/[·\d]/g, "").trim());
|
||||
check(
|
||||
"侧栏分类按树的顺序排(子紧跟在父后面)",
|
||||
navNames.indexOf("部署") === navNames.indexOf("研发") + 1,
|
||||
navNames.join(" / "),
|
||||
);
|
||||
|
||||
// ② 记一条:一个面板里填完标题/类型/分类/标签/正文
|
||||
await page.getByRole("button", { name: "记一条", exact: true }).click();
|
||||
await page.getByLabel("标题").fill("回滚前先停灰度");
|
||||
|
||||
@@ -108,6 +108,13 @@ try {
|
||||
const published = await page.getByText(/发布于 /, { exact: false }).first().isVisible();
|
||||
check("核对后可以发布", published);
|
||||
|
||||
// 发布之后也得能改:点「编辑」回到编辑器,改完还是已发布
|
||||
const editButton = page.getByRole("button", { name: "编辑", exact: true }).last();
|
||||
check("已发布的知识也有「编辑」按钮", await editButton.isVisible());
|
||||
await editButton.click();
|
||||
await page.locator(".vditor-ir").first().waitFor({ timeout: 10_000 });
|
||||
check("点「编辑」回到编辑器", (await page.locator(".vditor-ir").count()) > 0);
|
||||
|
||||
const again = await fetch(`${API}/workspaces/${ws.id}/knowledge`, {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
}).then((r) => r.json());
|
||||
|
||||
Reference in New Issue
Block a user