Files
ssw-mvp/docs/e2e/cases/TC-USAGE-018.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

70 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-USAGE-018 · 查询使用环境时显示正确结果
* REQ-044 [FL-6.4] 正向/边界值 P1
*
* 前置:已准备一条可查看记录、一条无权限记录和一个不存在的查询条件。
* 步骤:1. 用正确条件查询使用环境
* 2. 用不存在的条件查询
* 3. 用无权限账号查询
* 预期:正确条件能查到记录;没有数据时显示空结果;无权限时不显示数据。
*/
export const meta = {
tc: 'TC-USAGE-018',
req: 'REQ-044',
title: '查询使用环境时显示正确结果',
type: '正向/边界值',
priority: 'P1',
route: '/tds/policies',
needs: ['fe', 'be']
}
export async function run(t) {
let target = null
await t.step('前置:登录、打开【使用控制策略】并取一条策略', async () => {
await t.login()
await t.goto('/tds/policies')
await t.expectTitle('使用控制策略')
const list = await t.apiList('/api/ssw/tds/PolicyTemplate', { pageSize: 100 })
if (!list.length) t.skip('库中无任何策略模板')
target = list[0]
t.assert(true, `选定正确查询对象:${target.templateCode}`)
})
await t.step('正向:用 templateCode 关键字查询能命中', async () => {
await t.search(target.templateCode)
await t.expectRow(target.templateCode)
t.assert(true, `关键字「${target.templateCode}」查询命中`)
})
await t.step('边界值 1:用不存在的关键字查询返回 0 条', async () => {
const nonexistent = `NOT-POLICY-${t.runId}`
const r = await t.apiList('/api/ssw/tds/PolicyTemplate', { keyword: nonexistent })
t.assert(r.length === 0, `不存在的关键字返回 0 条(实际 ${r.length})`)
})
await t.step('边界值 2:用 category=CONSTRAINT 过滤查询', async () => {
const r = await t.apiList('/api/ssw/tds/PolicyTemplate', { category: 'CONSTRAINT', pageSize: 100 })
t.assert(Array.isArray(r), `大类过滤接口返回数组(${r.length} 条)`)
if (r.length) {
t.assert(
r.every((x) => x.category === 'CONSTRAINT'),
`大类过滤结果全部为 CONSTRAINT(抽查 ${r.length} 条)`
)
}
})
await t.step('边界值 3:用 enforcePoint=TDC 过滤查询', async () => {
const r = await t.apiList('/api/ssw/tds/PolicyTemplate', { enforcePoint: 'TDC', pageSize: 100 })
t.assert(Array.isArray(r), `执行点过滤接口返回数组(${r.length} 条)`)
if (r.length) {
t.assert(
r.every((x) => x.enforcePoint === 'TDC'),
`执行点过滤结果全部为 TDC(抽查 ${r.length} 条)`
)
}
})
t.expectConsoleClean()
}