/** * 通知管理「真·端到端浏览器验证」E2E —— ceshi 账号 · 真实 UI 登录 + 从菜单点进去 * ============================================================================ * 本 spec 的存在意义:补齐 notice-reality.spec.ts 一直绕过的「菜单导航」环节。 * - notice-reality:seedAuth 注入 token + page.goto('/page/e732c4b0…') 直连 URL, * 完全绕过登录表单与左侧菜单 ⇒ 「菜单能不能点进去」从未被真正验证。 * - 本 spec:必须 真实填写登录表单(ceshi/111111)+提交 → 从左侧菜单 * 「信息站 > 通知管理 > 通知管理(叶子)」逐级展开并点击 → 断言打开列表页 Tab * 并渲染出真实数据(266 条那批)。这一步若不通,就是要抓的前端导航 bug。 * * 为什么用 ceshi 而非 admin: * admin 看不到「信息站 > 通知管理」菜单;ceshi 多角色可见。 * (历史坑:sysadmin e2e 会把 ceshi 临时停用 isactive=0,中途死会留停用态。 * 本 spec 在 beforeAll 自动检测并置回 isactive=1,避免登录被后端拦。) * * 步骤(每步截图,artifacts/notice-ceshi-menu/): * 01-login-workbench 真实表单登录 ceshi/111111 → 进工作台 * 02-menu-tree 展开「信息站 > 通知管理」,断言菜单可见「通知管理」叶子 * 03-list-via-menu 从菜单点「通知管理」叶子 → 断言 URL/Tab 切到列表页 + 数据渲染 * 04-pagination 翻第 2 页,首行 ≠ 第 1 页 * 05-person-col 拟稿人列显示姓名(非 GUID/纯工号) * 06a/06b/06c 添加弹窗:富文本 / 接收人带姓名选项 / 确认取消各一 * 07-view-readonly 查看弹窗只读回显(非死桩) * * 环境(都在跑,勿重启):前端 5173 / 后端 8093 / psql 5433。 * 列表叶子 templateId = e732c4b0-2402-4e73-8cc4-786c8a8c52af。 */ import { expect, test, type Page, type Locator } from '@playwright/test'; import { execSync } from 'node:child_process'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const ACCOUNT = 'ceshi'; const PASSWORD = '111111'; const NOTICE_LEAF_TEMPLATE_ID = 'e732c4b0-2402-4e73-8cc4-786c8a8c52af'; const NOTICE_PAGE_PATH = `/page/${NOTICE_LEAF_TEMPLATE_ID}`; const ARTIFACTS = path.join(__dirname, 'artifacts', 'notice-ceshi-menu'); // 每个用例都独立「真实登录 + 菜单导航」后再断言一个点,互不依赖。 // 故意【不用 serial】:serial 下首个用例失败会跳过其余,掩盖其他点的真实结论; // 用 default(workers=1 顺序跑) 让 6 点逐条独立给出 通过/失败,不放水不互相掩盖。 test.describe.configure({ mode: 'default' }); // ── psql(仅用于 ceshi isactive 自愈 + DB 真相校验,不改业务数据)────────────── // 注意:用全限定表名 eip3.sys_user,不在 SQL 里写 `set search_path` —— 否则 psql 会 // 先回显一行 "SET" 污染 -A 输出,导致 isactive 误判。 function psqlQuery(sql: string): string { return execSync( `psql -h localhost -p 5433 -d eip4dev -U zhengwr -t -A -c "${sql.replace(/"/g, '\\"')}"`, { encoding: 'utf8' }, ).trim(); } function psqlExec(sql: string): void { execSync( `psql -h localhost -p 5433 -d eip4dev -U zhengwr -c "${sql.replace(/"/g, '\\"')}"`, { encoding: 'utf8', stdio: 'pipe' }, ); } // ── ceshi 账号自愈:若被历史 e2e 停用则置回 isactive=1,否则登录会被后端拦 ────────── test.beforeAll(() => { try { const row = psqlQuery( `select isactive from eip3.sys_user where account='${ACCOUNT}'`, ); if (row !== '1') { // eslint-disable-next-line no-console console.warn(`[ceshi-menu] ceshi isactive=${row || '(空)'},自动置回 1 以便登录`); psqlExec(`update eip3.sys_user set isactive=1, state=1 where account='${ACCOUNT}'`); const after = psqlQuery( `select isactive from eip3.sys_user where account='${ACCOUNT}'`, ); expect(after, 'ceshi isactive 置回 1 失败').toBe('1'); } else { // eslint-disable-next-line no-console console.log('[ceshi-menu] ceshi isactive=1(可登录)'); } } catch (err) { // eslint-disable-next-line no-console console.warn('[ceshi-menu] isactive 自愈检查失败(不中断,登录步骤会暴露真相):', err); } }); // ════════════════════════════════════════════════════════════════════════════ // 真实 UI 登录:填表单 + 提交(绝不注入 token),落工作台 // ════════════════════════════════════════════════════════════════════════════ async function realLogin(page: Page, shot?: string): Promise { await page.goto('/login'); // 登录表单字段无 name,按 autocomplete / type 精确定位(见 LoginPage.tsx) const accountInput = page.locator('input[autocomplete="username"]'); const passwordInput = page.locator('input[type="password"]'); await expect(accountInput, '登录表单未渲染出账号输入框').toBeVisible({ timeout: 20_000 }); await accountInput.fill(ACCOUNT); await passwordInput.fill(PASSWORD); // 真实点击「登录」按钮提交(非编程式 navigate) await page.locator('button[type="submit"]', { hasText: /登录/ }).click(); // 登录成功 ⇒ 跳工作台 /workbench,AppShell 外壳(侧栏 .sidebar + Tab 条 .tabbar)出现 await expect(page, '登录后未跳转到工作台').toHaveURL(/\/workbench$/, { timeout: 20_000 }); await expect(page.locator('nav.sidebar'), '工作台外壳侧栏未渲染').toBeVisible({ timeout: 20_000 }); await expect(page.locator('.tabbar'), '工作台 Tab 条未渲染').toBeVisible({ timeout: 10_000 }); // 侧栏菜单从 /api/menu 异步加载,等根节点「信息站」出现,确认菜单真到位 await expect( page.locator('nav.sidebar .sm-item .sm-name', { hasText: '信息站' }).first(), '侧栏未加载出「信息站」根菜单(菜单接口失败?)', ).toBeVisible({ timeout: 20_000 }); if (shot) await page.screenshot({ path: path.join(ARTIFACTS, shot), fullPage: false }); } // 定位某层级菜单项的 .sm-item 容器(按可见文本精确匹配 .sm-name) function smItemByName(page: Page, name: string): Locator { return page .locator('nav.sidebar .sm-item') .filter({ has: page.locator('.sm-name', { hasText: new RegExp(`^${name}$`) }) }); } // 展开一个分组菜单项(仅当其未展开时点击 —— 通过 .tree-toggle.open 判断) async function expandGroup(page: Page, item: Locator): Promise { const toggle = item.locator('.tree-toggle').first(); // 分组才有 .tree-toggle;已展开则带 .open class const cls = (await toggle.getAttribute('class').catch(() => '')) ?? ''; if (!cls.includes('open')) { await item.click(); // 等展开动画/子节点挂载 await page.waitForTimeout(300); } } // ════════════════════════════════════════════════════════════════════════════ // 真·菜单导航:展开「信息站 > 通知管理」,点叶子「通知管理」→ 进列表页 // 返回打开后的列表页 Page(同一个 page,已切到 /page/e732c4b0…) // ════════════════════════════════════════════════════════════════════════════ async function navigateNoticeViaMenu(page: Page): Promise { // 1) 「信息站」是 root[0],SideMenu 默认展开第一个根 ⇒ 一般已展开;保险起见确保展开 const xinxizhan = smItemByName(page, '信息站').first(); await expect(xinxizhan, '菜单中找不到「信息站」根节点').toBeVisible({ timeout: 10_000 }); await expandGroup(page, xinxizhan); // 2) 展开「通知管理」分组(注意:有两个同名「通知管理」——分组(带 chevron)与叶子(无 chevron))。 // 分组 = 含 .tree-toggle 的 .sm-item;叶子 = 不含 .tree-toggle 的 .sm-item。 const noticeGroup = page .locator('nav.sidebar .sm-item') .filter({ has: page.locator('.sm-name', { hasText: /^通知管理$/ }) }) .filter({ has: page.locator('.tree-toggle') }) .first(); await expect(noticeGroup, '菜单中找不到「通知管理」分组节点').toBeVisible({ timeout: 10_000 }); await expandGroup(page, noticeGroup); // 3) 断言「通知管理」叶子(无 chevron)出现 —— 这是 ceshi 可见权限的硬证据 const noticeLeaf = page .locator('nav.sidebar .sm-item') .filter({ has: page.locator('.sm-name', { hasText: /^通知管理$/ }) }) .filter({ hasNot: page.locator('.tree-toggle') }) .first(); await expect( noticeLeaf, '展开「信息站 > 通知管理」后,菜单里看不到指向列表页的「通知管理」叶子项(ceshi 权限/菜单渲染异常)', ).toBeVisible({ timeout: 10_000 }); // 4) 点击叶子 → handleMenuOpen → openTab('/page/e732c4b0…') → navigate await noticeLeaf.click(); // 5) 强断言:URL 真切到列表页(菜单点击真的触发了导航,而非无反应/白屏) await expect( page, '点击「通知管理」菜单后 URL 未切到列表页(菜单导航未触发,疑似前端导航 bug)', ).toHaveURL(new RegExp(NOTICE_PAGE_PATH.replace(/[/]/g, '\\/')), { timeout: 15_000 }); // 6) 强断言:Tab 条里出现该列表页 Tab 且处于激活态 const activeTab = page.locator('.tabbar .wtab.on'); await expect(activeTab, '点击菜单后未生成/激活列表页 Tab').toBeVisible({ timeout: 10_000 }); // 7) 强断言:amis 列表真实渲染 + 数据落地(非白屏/骨架/报错) await expect( page.locator('[data-testid="amis-host"]'), '列表页 amis 宿主未渲染(白屏/报错)', ).toBeVisible({ timeout: 45_000 }); await page.waitForSelector('tbody tr', { timeout: 20_000 }); await expect .poll(async () => (await firstRowTitle(page)) || '', { timeout: 15_000 }) .not.toBe(''); } // 列表首行「主题」列(第 3 列:含 checkbox 列 + 隐藏主键列,主题在 nth(2)) async function firstRowTitle(page: Page): Promise { const t = await page.locator('tbody tr').first().locator('td').nth(2).textContent(); return (t ?? '').trim(); } // 选中列表第一行(amis 隐藏原生 checkbox,点 label.cxd-Checkbox 触发 React onChange) async function selectFirstRow(page: Page): Promise { const firstCell = page.locator('tbody tr').first().locator('td').first(); const label = firstCell.locator('label.cxd-Checkbox, .cxd-Checkbox').first(); if (await label.count().catch(() => 0)) { await label.click({ force: true }).catch(async () => { await firstCell.locator('input[type="checkbox"]').dispatchEvent('click').catch(() => {}); }); } else { await firstCell.locator('input[type="checkbox"]').dispatchEvent('click'); } } // 一站式:真实登录 + 菜单导航到列表页(每个独立用例复用) async function loginAndOpenNoticeViaMenu(page: Page): Promise { await realLogin(page); await navigateNoticeViaMenu(page); } // ════════════════════════════════════════════════════════════════════════════ // 步骤 1+2+3:真实登录 → 菜单可见「通知管理」→ 从菜单点进列表页(本次核心结论) // ════════════════════════════════════════════════════════════════════════════ test('导航:真实表单登录 ceshi → 从菜单点「通知管理」进列表页', async ({ page }) => { // 1) 真实表单登录 → 工作台 await realLogin(page, '01-login-workbench.png'); // 2) 展开「信息站 > 通知管理」并断言「通知管理」叶子可见,截菜单树 const xinxizhan = smItemByName(page, '信息站').first(); await expandGroup(page, xinxizhan); const noticeGroup = page .locator('nav.sidebar .sm-item') .filter({ has: page.locator('.sm-name', { hasText: /^通知管理$/ }) }) .filter({ has: page.locator('.tree-toggle') }) .first(); await expect(noticeGroup, '菜单缺「通知管理」分组(ceshi 应可见)').toBeVisible({ timeout: 10_000 }); await expandGroup(page, noticeGroup); const noticeLeaf = page .locator('nav.sidebar .sm-item') .filter({ has: page.locator('.sm-name', { hasText: /^通知管理$/ }) }) .filter({ hasNot: page.locator('.tree-toggle') }) .first(); await expect(noticeLeaf, '菜单缺指向列表页的「通知管理」叶子').toBeVisible({ timeout: 10_000 }); await page.screenshot({ path: path.join(ARTIFACTS, '02-menu-tree.png'), fullPage: false }); // 3) 从菜单点击叶子 → 断言导航 + Tab + 数据 await noticeLeaf.click(); await expect(page, '菜单点击未导航到列表页 URL').toHaveURL( new RegExp(NOTICE_PAGE_PATH.replace(/[/]/g, '\\/')), { timeout: 15_000 }, ); await expect(page.locator('.tabbar .wtab.on'), '未激活列表页 Tab').toBeVisible({ timeout: 10_000 }); await expect(page.locator('[data-testid="amis-host"]'), 'amis 宿主未渲染').toBeVisible({ timeout: 45_000, }); await page.waitForSelector('tbody tr', { timeout: 20_000 }); await expect .poll(async () => (await firstRowTitle(page)) || '', { timeout: 15_000 }) .not.toBe(''); await page.screenshot({ path: path.join(ARTIFACTS, '03-list-via-menu.png'), fullPage: false }); }); // ════════════════════════════════════════════════════════════════════════════ // 步骤 4 ①分页:翻第 2 页,首行 ≠ 第 1 页 // ════════════════════════════════════════════════════════════════════════════ test('修点①分页:第2页首行标题 ≠ 第1页', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const p1 = await firstRowTitle(page); expect(p1, 'P1 首行标题应非空').not.toBe(''); const pager2 = page .locator('ul.cxd-Pagination li.cxd-Pagination-pager-item', { hasText: /^2$/ }) .first(); await expect(pager2, '应存在第 2 页页码(266 条多页)').toBeVisible({ timeout: 10_000 }); await pager2.locator('a').click(); await expect .poll( async () => ( await page.locator('li.cxd-Pagination-pager-item.is-active').first().textContent() )?.trim(), { timeout: 15_000 }, ) .toBe('2'); await page.waitForTimeout(1200); const p2 = await firstRowTitle(page); await page.screenshot({ path: path.join(ARTIFACTS, '04-pagination.png'), fullPage: false }); expect(p2, 'P2 首行标题应非空').not.toBe(''); expect(p2, `分页未真换页:P1=P2="${p1}"`).not.toBe(p1); }); // ════════════════════════════════════════════════════════════════════════════ // 步骤 4 ②人员列:拟稿人列显示姓名(非 GUID / 非纯工号 / 非裸 ADMIN) // ════════════════════════════════════════════════════════════════════════════ test('修点②人员列:拟稿人显示姓名(非GUID/纯工号)', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const headers = await page.locator('thead').first().locator('th').allTextContents(); const idx = headers.findIndex((h) => h.trim().includes('拟稿人')); expect(idx, '应找到「拟稿人」列').toBeGreaterThanOrEqual(0); const cells = await page.locator(`tbody tr td:nth-child(${idx + 1})`).allTextContents(); const values = cells.map((c) => c.trim()).filter(Boolean); expect(values.length, '拟稿人列应有数据').toBeGreaterThanOrEqual(1); await page.screenshot({ path: path.join(ARTIFACTS, '05-person-col.png'), fullPage: false }); const GUID_RE = /^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/; const RAW_GUID_NODASH_RE = /^[0-9a-fA-F]{32}$/; const PURE_DIGITS_RE = /^\d+$/; let nameHits = 0; for (const v of values) { expect(GUID_RE.test(v), `拟稿人显示为 GUID: "${v}"`).toBe(false); expect(RAW_GUID_NODASH_RE.test(v), `拟稿人显示为无连字符 GUID: "${v}"`).toBe(false); expect(PURE_DIGITS_RE.test(v), `拟稿人显示为纯工号: "${v}"`).toBe(false); expect(v, `拟稿人显示为裸 ADMIN: "${v}"`).not.toBe('ADMIN'); if (/[一-龥]/.test(v)) nameHits += 1; } expect(nameHits, `拟稿人列无姓名样式(含中文名)单元格: ${JSON.stringify(values)}`).toBeGreaterThanOrEqual( 1, ); }); // ════════════════════════════════════════════════════════════════════════════ // 步骤 4 ③添加弹窗:(a) 富文本 (b) 接收人带姓名选项 (c) 确认/取消各一 // ════════════════════════════════════════════════════════════════════════════ // 打开「添加」弹窗,返回 modal Locator(已等到表单字段渲染) async function openAddDialog(page: Page): Promise { await page.locator('button', { hasText: '添加' }).first().click(); await page.waitForSelector('.cxd-Modal', { timeout: 15_000 }); await expect(page.locator('.cxd-Modal .cxd-Form-item').first()).toBeVisible({ timeout: 15_000 }); await page.waitForTimeout(2000); // 富文本(tinymce)初始化 return page.locator('.cxd-Modal').last(); } // ── (a) 内容 = 富文本编辑器(tinymce),非单行 input ── test('修点③a 添加弹窗:内容字段为富文本编辑器(非单行input)', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const modal = await openAddDialog(page); const contentItem = modal.locator('.cxd-Form-item', { hasText: '内容' }).first(); await expect(contentItem, '弹窗应含「内容」字段').toBeVisible({ timeout: 5_000 }); const rich = await contentItem.evaluate((el: Element) => ({ richControl: !!el.querySelector('.cxd-RichTextControl, [class*="RichText"]'), tinymce: !!el.querySelector('.tox-tinymce, .mce-tinymce, iframe[id*="mce"], iframe[id*="tiny"]'), froala: !!el.querySelector('.fr-box, .fr-element, [class*="froala"]'), contenteditable: !!el.querySelector('[contenteditable="true"]'), iframeCount: el.querySelectorAll('iframe').length, plainTextInput: !!el.querySelector('input[type="text"]:not([type=hidden])'), })); await page.screenshot({ path: path.join(ARTIFACTS, '06a-add-richtext.png'), fullPage: false }); const isRich = rich.richControl && (rich.tinymce || rich.froala || rich.contenteditable || rich.iframeCount >= 1); expect(isRich, `内容字段未渲染为富文本编辑器: ${JSON.stringify(rich)}`).toBe(true); expect(rich.plainTextInput && !rich.richControl, '内容字段退化为单行 input').toBe(false); }); // ── (b) 接收人下拉展开有带姓名选项(picker 不为空) ── test('修点③b 添加弹窗:接收人下拉有带姓名选项', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const modal = await openAddDialog(page); const recvItem = modal.locator('.cxd-Form-item', { hasText: '接收人' }).first(); await expect(recvItem, '弹窗应含「接收人」字段').toBeVisible({ timeout: 5_000 }); // 捕获接收人 picker 的远程请求(拿真实 URL + 响应做缺陷取证;非源码硬编码)。 const pickerReqPromise = page .waitForResponse( (resp) => /list|picker|user/i.test(resp.url()) && (resp.request().resourceType() === 'fetch' || resp.request().resourceType() === 'xhr'), { timeout: 8_000 }, ) .catch(() => null); await recvItem.locator('.cxd-Select').first().evaluate((el: Element) => { (el.querySelector('.cxd-Select-valueWrap') || el).dispatchEvent( new MouseEvent('click', { bubbles: true }), ); }); // 等下拉浮层出现(无论有无结果,amis 都会渲染 .cxd-PopOver-overlay / 菜单容器)。 await page .locator('.cxd-PopOver-overlay, .cxd-Select-menu') .first() .waitFor({ state: 'visible', timeout: 8_000 }) .catch(() => {}); await page.waitForTimeout(800); // 给远程 source 渲染选项的时间 await page.screenshot({ path: path.join(ARTIFACTS, '06b-receiver-dropdown.png'), fullPage: false }); // 取证:picker 请求 URL + 响应体(写日志,便于报告里给出根因)。 const pickerResp = await pickerReqPromise; if (pickerResp) { let body = ''; try { body = JSON.stringify(await pickerResp.json()).slice(0, 800); } catch { body = '(非 JSON 响应)'; } // eslint-disable-next-line no-console console.log( `[修点③b][接收人 picker] URL=${pickerResp.url()} HTTP=${pickerResp.status()} body=${body}`, ); } else { // eslint-disable-next-line no-console console.warn('[修点③b][接收人 picker] 8s 内未观察到 list/picker/user 远程请求'); } // 「未找到任何结果」死文案是 amis Select 空选项的硬证据 —— 直接判定 picker 失效。 const emptyHint = await page .locator('.cxd-PopOver-overlay, .cxd-Select-menu') .first() .evaluate((el) => /未找到任何结果|暂无数据|无结果/.test(el.textContent || '')) .catch(() => false); const opts = (await page.locator('.cxd-Select-option').allTextContents()) .map((t) => t.trim()) .filter(Boolean); // 强断言(不放水):接收人下拉展开后应有选项;空(如「未找到任何结果」)即真实缺陷。 expect( opts.length, `接收人下拉展开后选项为空(picker 失效${emptyHint ? ',浮层显示「未找到任何结果」' : ''})`, ).toBeGreaterThanOrEqual(1); const named = opts.filter((t) => /[一-龥]/.test(t)); expect(named.length, `接收人选项无带姓名项: ${JSON.stringify(opts.slice(0, 5))}`).toBeGreaterThanOrEqual( 1, ); }); // ── (c) 弹窗确认/取消恰好各一个 ── test('修点③c 添加弹窗:确认/取消按钮恰好各一个', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const modal = await openAddDialog(page); const footer = (await modal.locator('.cxd-Modal-footer button').allTextContents()) .map((t) => t.trim()) .filter(Boolean); const confirmCount = footer.filter((t) => t === '确认' || t === '确定' || t === '提交').length; const cancelCount = footer.filter((t) => t === '取消').length; await page.screenshot({ path: path.join(ARTIFACTS, '06c-footer-buttons.png'), fullPage: false }); expect(confirmCount, `确认类按钮应恰好1,footer=${JSON.stringify(footer)}`).toBe(1); expect(cancelCount, `取消按钮应恰好1,footer=${JSON.stringify(footer)}`).toBe(1); }); // ════════════════════════════════════════════════════════════════════════════ // 步骤 4 ④查看只读:选中行 → 查看 → 弹窗只读回显(非死桩) // ════════════════════════════════════════════════════════════════════════════ test('修点④查看只读:弹窗只读回显(非死桩)', async ({ page }) => { await loginAndOpenNoticeViaMenu(page); const rowTitle = await firstRowTitle(page); expect(rowTitle, '首行标题应非空').not.toBe(''); await selectFirstRow(page); await expect(page.locator('button', { hasText: '查看' }).first()).toBeEnabled({ timeout: 8_000 }); await page.locator('button', { hasText: '查看' }).first().click(); await page.waitForSelector('.cxd-Modal', { timeout: 15_000 }); await expect(page.locator('.cxd-Modal .cxd-Form-item').first()).toBeVisible({ timeout: 15_000 }); await page.waitForTimeout(1500); await page.screenshot({ path: path.join(ARTIFACTS, '07-view-readonly.png'), fullPage: false }); const modal = page.locator('.cxd-Modal').last(); const modalText = (await modal.textContent()) ?? ''; // 非「未配编辑表单」死桩 expect(modalText, '查看弹窗为占位/死桩(未配编辑表单/待转换)').not.toMatch( /未配|未配置编辑表单|待.{0,6}转换/, ); // 表单真实加载(含主题/内容字段) await expect(modal.locator('.cxd-Form-item', { hasText: '主题' }).first()).toBeVisible({ timeout: 5_000, }); await expect(modal.locator('.cxd-Form-item', { hasText: '内容' }).first()).toBeVisible({ timeout: 5_000, }); // 只读:无可编辑输入 const editableCount = await modal.evaluate((el: Element) => { const inputs = Array.from(el.querySelectorAll('input, textarea')); return inputs.filter((i) => { const e = i as HTMLInputElement | HTMLTextAreaElement; return ( !e.disabled && !e.readOnly && e.type !== 'hidden' && (e as unknown as HTMLElement).offsetParent !== null ); }).length; }); expect(editableCount, `查看弹窗存在 ${editableCount} 个可编辑输入(应只读)`).toBe(0); // 真实回显首行标题 expect(modalText, `查看弹窗未回显行标题 "${rowTitle}"`).toContain(rowTitle); });