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

69 lines
2.8 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-024 · 查询控制策略执行时显示正确结果
* REQ-045 [FL-6.5] 正向/边界值 P1
*
* 前置:已准备一条可查看记录、一条无权限记录和一个不存在的查询条件。
* 步骤:1. 用正确条件查询控制策略执行
* 2. 用不存在的条件查询
* 3. 用无权限账号查询
* 预期:正确条件能查到记录;没有数据时显示空结果;无权限时不显示数据。
*
* 注:控制策略执行 = 策略模板 + 冲突检测结果。
* 校验点:1) 策略模板列表的多维过滤;2) 冲突检测接口的多场景查询。
*/
export const meta = {
tc: 'TC-USAGE-024',
req: 'REQ-045',
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 })
target = list.find((r) => r.builtinMark === 0) || list[0]
if (!target) t.skip('库中无任何策略模板')
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-EXEC-${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:用 denyAction=REJECT 过滤查询', async () => {
const r = await t.apiList('/api/ssw/tds/PolicyTemplate', { pageSize: 100 }).catch(() => [])
// denyAction 不是 filterColumn,按枚举过滤是 pageSize 内的全量扫描过滤
const filtered = r.filter((x) => x.denyAction === 'REJECT')
t.assert(filtered.length > 0, `存在 denyAction=REJECT 的策略(${filtered.length} 条)`)
})
await t.step('边界值 3:用 builtinMark=1 过滤查询内置策略', async () => {
const r = await t.apiList('/api/ssw/tds/PolicyTemplate', { builtinMark: 1, pageSize: 100 })
t.assert(Array.isArray(r), `来源过滤接口返回数组(${r.length} 条)`)
if (r.length) {
t.assert(
r.every((x) => x.builtinMark === 1),
`来源过滤结果全部为内置(抽查 ${r.length} 条)`
)
}
})
t.expectConsoleClean()
}