test(e2e): 选区引用改为 chip 后更新 @ 引用 e2e 断言

#1052 把「添加到对话」的多行选区改成引用 chip(正文只在发送时展开),
#1002 留下的 mount e2e 仍按旧的 plain-text 围栏断言(3 chips + 围栏正文),
合并后 plugin-mount 在真实 DSH 上红:实际 4 chips。改为断言第 4 枚 chip
落地、label 带来源文件、且不产生 plain-text reference;围栏正文的逐字
载荷由 tests/selection-payload.spec.ts 在单测层钉住。

验证:本地 (真实 DSH 0.2.1-rc.1)1 passed。
This commit is contained in:
Menghuan1918 committed 2026-10-26 15:39:40 +08:00
1 parent c7d0e12341
commit 6e29d91bec
1 file changed
+15 -6
+15 -6
View File
@@ -1073,14 +1073,23 @@ test('the explorer @-reference button keeps earlier chips (no whole-draft rewrit
const quoteButton = page.getByRole('button', { name: /Add to conversation|添加到对话/ })
await expect(quoteButton, 'the selection popup must offer the quote').toHaveCount(1, { timeout: 10_000 })
await quoteButton.click()
// Since the selection-to-chat rework (#1052) the quote lands as its own
// reference CHIP — the fenced body is serialized only when the draft is
// sent — so the chip count grows to four and the three earlier chips stay
// intact. `buildSelectionInsert` in the unit suite pins the verbatim payload
// (fences + newlines); the DOM only carries the compact `path:lines` label.
await expect(
chips,
'the multi-line quote must leave every chip intact',
).toHaveCount(3, { timeout: 15_000 })
const composed = await composer.evaluate((element) => element.textContent ?? '')
expect(composed, 'the quote must arrive verbatim, fences and newlines included').toContain('```')
expect(composed, 'the quote must keep its line breaks').toContain('\n')
expect(composed).toContain('tail text')
'the multi-line quote must land as its own chip and leave every earlier chip intact',
).toHaveCount(4, { timeout: 15_000 })
await expect(
chips.last(),
'the quote chip must carry the file its selection came from',
).toContainText(SEEDED_MD_FILE, { timeout: 10_000 })
await expect(
page.locator('[data-composer-text-ref]'),
'the quote must not degrade into decorated plain text',
).toHaveCount(1)
expect(pageErrors, 'no page error while inserting references').toEqual([])
})