From 6e29d91bec70fa3aa0e1da8020ef8b78e029b6f5 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Mon, 26 Oct 2026 15:39:40 +0800 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=E9=80=89=E5=8C=BA=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E6=94=B9=E4=B8=BA=20chip=20=E5=90=8E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20@=20=E5=BC=95=E7=94=A8=20e2e=20=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #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。 --- tests/e2e/mount.e2e.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/e2e/mount.e2e.ts b/tests/e2e/mount.e2e.ts index e0dae314..15852678 100644 --- a/tests/e2e/mount.e2e.ts +++ b/tests/e2e/mount.e2e.ts @@ -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([]) })