From 7acfef0a1f6d1b59f6fca5e544d05df364257802 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 11 Oct 2026 17:58:12 +0000 Subject: [PATCH] Assert the count element instead of the concatenated card text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: card text renders as num+label (e.g. 0切片), so whole-text regexes never matched. Evidence: scripts/e2e.sh rerun in this task. Impact: test-only. --- e2e/rdm-audit.playwright.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/rdm-audit.playwright.ts b/e2e/rdm-audit.playwright.ts index bd2646f..a75ce77 100644 --- a/e2e/rdm-audit.playwright.ts +++ b/e2e/rdm-audit.playwright.ts @@ -59,7 +59,7 @@ test.describe.serial('U4 项目追溯审计工作区', () => { await expect(page.locator('.rdm-audit-card')).toHaveCount(9) await expect(page.getByText(/截至水位 \d+/)).toBeVisible() // 主项目应有切片与章节(种子 structure 装载 + ingest 保证)。 - await expect(card(page, '切片')).toContainText(/[1-9]/) + await expect(card(page, '切片').locator('.rdm-audit-card-num')).toHaveText(/[1-9]/) await expect(card(page, '章节')).toContainText(/[1-9]/) }) @@ -108,7 +108,7 @@ test.describe.serial('U4 项目追溯审计工作区', () => { // 切到隔离项目:概览计数应为 0 且无残留「加载中…」。 await page.locator('.rdm-audit-project').selectOption({ label: ISOLATED }) await expect(page.getByText('加载中…')).toHaveCount(0, { timeout: 10_000 }) - await expect(card(page, '切片')).toContainText(/^0$/) + await expect(card(page, '切片').locator('.rdm-audit-card-num')).toHaveText('0') // 空态:文档树与时间线给出可理解提示。 await page.getByRole('tab', { name: '资料与文档' }).click() await expect(page.getByText('暂无文档')).toBeVisible() @@ -118,7 +118,7 @@ test.describe.serial('U4 项目追溯审计工作区', () => { await page.getByRole('tab', { name: '概览' }).click() await page.locator('.rdm-audit-project').selectOption({ label: MAIN }) await expect(page.getByText('加载中…')).toHaveCount(0, { timeout: 10_000 }) - await expect(card(page, '切片')).toContainText(/[1-9]/) + await expect(card(page, '切片').locator('.rdm-audit-card-num')).toHaveText(/[1-9]/) await expect(page.locator('.rdm-audit-project')).toHaveValue( await page.locator('.rdm-audit-project option', { hasText: MAIN }).getAttribute('value') ?? '', )