同步 markdown 列表渲染后的既有断言

- appSurface/project-commands.suite.ts:去掉期望文本里手写的前缀短横线(列表项目符号改由 CSS 绘制)
- appSurface/project-commands.suite.ts:把路径匹配限定到 LI 元素(去掉前缀后 li 与内部 p 文本相同,getByText 会命中两个元素)
- appSurface/project-assets.suite.ts、supervisor-runtime.suite.ts、preview-shortcuts:同步去掉期望文本里的手写短横线
- 背景:a60c04b53 把无序列表从手写短横线文本改成真正的 list-disc 标记,9 条既有断言因此失败,本笔把它们对齐到新契约
This commit is contained in:
2026-09-15 18:54:13 +08:00
parent a60c04b53d
commit 19c3703027
4 changed files with 33 additions and 25 deletions
@@ -808,7 +808,7 @@ export function registerProjectAssetTests() {
expect(await screen.findByText(/本地项目资产:/)).not.toBeNull();
expect(screen.getByText(/asset-20\.png/)).not.toBeNull();
expect(screen.queryByText(/asset-21\.png/)).toBeNull();
expect(screen.getByText(/- 还有 2 个资产/)).not.toBeNull();
expect(screen.getByText(/还有 2 个资产/)).not.toBeNull();
});
it('cancels asset list policy confirmation without reading assets', async () => {
@@ -856,9 +856,9 @@ export function registerProjectCommandTests() {
await submitChat('/diff checkpoint-1');
expect(await screen.findByText(/checkpointcheckpoint-1/)).not.toBeNull();
expect(screen.getByText(/- game\/file-20\.ts/)).not.toBeNull();
expect(screen.queryByText(/- game\/file-21\.ts/)).toBeNull();
expect(screen.getByText(/- 还有 2 项/)).not.toBeNull();
expect(screen.getByText(/^game\/file-20\.ts$/)).not.toBeNull();
expect(screen.queryByText(/^game\/file-21\.ts$/)).toBeNull();
expect(screen.getByText(/还有 2 项/)).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('diff_local_project_checkpoint', {
projectPath: '/tmp/authorized-game',
checkpointId: 'checkpoint-1',
@@ -928,7 +928,7 @@ export function registerProjectCommandTests() {
fireEvent.click(screen.getByRole('button', { name: '确认' }));
expect(await screen.findByText(/checkpointcheckpoint-1/)).not.toBeNull();
expect(screen.getByText(/- game\/index\.html/)).not.toBeNull();
expect(screen.getByText(/^game\/index\.html$/)).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('diff_local_project_checkpoint', {
projectPath: '/tmp/authorized-game',
checkpointId: 'checkpoint-1',
@@ -3803,12 +3803,19 @@ export function registerProjectCommandTests() {
expect(
screen.getByText(
(_, element) =>
element?.tagName === 'LI' &&
element.textContent?.trim() === '- game/',
element?.tagName === 'LI' && element.textContent?.trim() === 'game/',
),
).not.toBeNull();
expect(screen.getByText(/- game\/index\.html/)).not.toBeNull();
expect(screen.getByText(/- assets\/uploads\/hero\.png/)).not.toBeNull();
// 列表项渲染成 `<li><p class="inline">game/index.html</p></li>`:去掉手写短横线之后
// `<li>` 与内部 `<p>` 的文本完全相同,必须限定在 `LI` 上匹配,否则 getByText 会命中两个元素。
expect(
screen.getByText(
(_, element) =>
element?.tagName === 'LI' &&
element.textContent?.trim() === 'game/index.html',
),
).not.toBeNull();
expect(screen.getByText(/^assets\/uploads\/hero\.png$/)).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('list_local_project_files', {
projectPath: '/tmp/authorized-game',
});
@@ -3872,7 +3879,14 @@ export function registerProjectCommandTests() {
fireEvent.click(screen.getByRole('button', { name: '确认' }));
expect(await screen.findByText(/本地项目文件:/)).not.toBeNull();
expect(screen.getByText(/- game\/index\.html/)).not.toBeNull();
// 同 `lists local project files` 的原理:`<li>` 与内部 `<p>` 文本相同,需限定 `LI`。
expect(
screen.getByText(
(_, element) =>
element?.tagName === 'LI' &&
element.textContent?.trim() === 'game/index.html',
),
).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('list_local_project_files', {
projectPath: '/tmp/authorized-game',
});
@@ -4010,9 +4024,9 @@ export function registerProjectCommandTests() {
expect(
screen.getByText(/路径:\.agent\/project\.index\.json/),
).not.toBeNull();
expect(screen.getByText(/- game\/file-12\.html · 21B/)).not.toBeNull();
expect(screen.queryByText(/- game\/file-13\.html/)).toBeNull();
expect(screen.getByText(/- 还有 2 项/)).not.toBeNull();
expect(screen.getByText(/^game\/file-12\.html · 21B$/)).not.toBeNull();
expect(screen.queryByText(/^game\/file-13\.html$/)).toBeNull();
expect(screen.getByText(/还有 2 项/)).not.toBeNull();
expect(invoke).toHaveBeenCalledWith('build_local_project_index', {
projectPath: '/tmp/authorized-game',
});
@@ -4247,12 +4261,10 @@ export function registerProjectCommandTests() {
expect(await screen.findByText(/Agent 智能服务状态:/)).not.toBeNull();
const chatText = screen.getByLabelText('聊天').textContent ?? '';
expect(chatText).toContain(
'- 总体:已连接 · 3/3 个 Agent 可用 · 0 个待处理',
);
expect(chatText).toContain('- 账号状态:已就绪');
expect(chatText).toContain('- 输出方式:流式关闭 · 联网检索关闭');
expect(chatText).toContain('- 所有 Agent 使用统一的官方智能服务');
expect(chatText).toContain('总体:已连接 · 3/3 个 Agent 可用 · 0 个待处理');
expect(chatText).toContain('账号状态:已就绪');
expect(chatText).toContain('输出方式:流式关闭 · 联网检索关闭');
expect(chatText).toContain('所有 Agent 使用统一的官方智能服务');
expect(screen.getByRole('button', { name: '查看状态' })).not.toBeNull();
expect(screen.queryByText(/sk-test-secret/)).toBeNull();
expect(screen.queryByText(/generator-secret/)).toBeNull();
@@ -1222,9 +1222,7 @@ export async function assertPlanningAndStatusShortcutFlow(
const handoffMessage = messageBubble(
handoffMessages[handoffMessages.length - 1],
);
expect(handoffMessage.textContent).toContain(
'- Runrun-main-shortcut-trace',
);
expect(handoffMessage.textContent).toContain('Runrun-main-shortcut-trace');
expect(handoffMessage.textContent).toContain(
'Readyart/Asset 生成首版美术素材',
);
@@ -1888,9 +1888,7 @@ export function registerSupervisorRuntimeTests() {
).not.toBeNull();
expect(screen.getByText(/编排轮次:/)).not.toBeNull();
expect(screen.getByText(/产物快照:/)).not.toBeNull();
expect(
screen.getByText(/- game\/index\.html · fnv1a64:game/),
).not.toBeNull();
expect(screen.getByText(/game\/index\.html · fnv1a64:game/)).not.toBeNull();
expect(screen.getByText(/最近步骤:/)).not.toBeNull();
expect(
screen.getByText(/Evaluator #2 · passed · evaluation/),