Files
ssw-mvp/docs/e2e/cases/TC-PLATFORM-005.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

71 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-PLATFORM-005 · 查询数据产品封装时显示正确结果
* REQ-036 [FL-10.1] 正向/边界值 P1
*
* 前置:已准备一条可查看记录、一条无权限记录和一个不存在的查询条件。
* 步骤:1. 用正确条件查询数据产品封装
* 2. 用不存在的条件查询
* 3. 用无权限账号查询
* 预期:正确条件能查到记录;没有数据时显示空结果;无权限时不显示数据。
*/
export const meta = {
tc: 'TC-PLATFORM-005',
req: 'REQ-036',
title: '查询数据产品封装时显示正确结果',
type: '正向/边界值',
priority: 'P1',
route: '/tdc/products',
needs: ['fe', 'be']
}
export async function run(t) {
let target = null
await t.step('前置:登录并挑选一条可查看的产品', async () => {
await t.login()
const list = await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })
if (!list.length) t.skip('库中没有任何产品,先执行 TC-PLATFORM-001')
target = list[0]
t.assert(true, `已就绪:${target.productCode} / ${target.name}`)
})
await t.step('打开【产品发布】并用正确条件查询', async () => {
await t.goto('/tdc/products')
await t.search(target.productCode)
await t.expectRow(target.productCode)
t.assert(true, '正确条件能命中目标记录')
})
await t.step('用不存在的产品标识查询:列表应为空', async () => {
await t.search(`NOPE-${t.runId}-xxxxxx`)
// 等待列表刷新
await t.waitIdle()
await t.refresh()
const n = await t.rowCount()
t.assert(n === 0, `不存在的关键字查询返回空列表(实际 ${n} 行)`)
await t.shot('不存在条件空结果')
})
await t.step('按发布状态筛选:列表只剩命中状态的记录', async () => {
await t.resetQuery()
await t.selectFilter('发布状态', '已发布')
await t.waitIdle()
const rows = await t.page.$$eval('.ant-table-tbody tr.ant-table-row', (trs) =>
trs.map((tr) => [...tr.querySelectorAll('td')].map((td) => td.innerText.trim()))
)
for (const r of rows) {
// 列表中状态标签文案应为「已发布」
t.assert(r.some((c) => c.includes('已发布')), '筛选「已发布」后每行都带「已发布」标签')
}
})
await t.step('用无权限账号查询:API 拒绝、UI 也应拿不到数据', async () => {
// 切到一个无效 token 后查
const r = await t.api('GET', '/api/ssw/tdc/Product', undefined, {
token: 'bearer invalid-token-xxx'
})
t.assert(r.code !== 200 || !r.data, `无效 token 被拒(实际 code=${r.code})`)
})
t.expectConsoleClean()
}