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

79 lines
3.5 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-022 · 查看控制策略执行的办理结果
* REQ-045 [FL-6.5] 反向/错误推测 P1
*
* 前置:1. 已完成一次控制策略执行操作
* 2. 用户有查看记录的权限
* 步骤:1. 打开【交付平台】或【数据使用控制】
* 2. 查询刚办理的记录
* 3. 查看详情和相关记录
* 预期:能查到正确的控制策略执行结果,列表、详情和相关记录一致。
*
* 注:策略冲突检测(PolicyConflictView)也属于控制策略执行能力的一部分。
* 本用例同时核对:1) 策略模板列表能查;2) 策略冲突检测接口能跑通;
* 3) 冲突日志会写到 tds_policy_conflict_log 表。
*/
export const meta = {
tc: 'TC-USAGE-022',
req: 'REQ-045',
title: '查看控制策略执行的办理结果',
type: '反向/错误推测',
priority: 'P1',
route: '/tds/policy-conflict',
needs: ['fe', 'be']
}
export async function run(t) {
let target = null
await t.step('前置:登录、打开【策略冲突检测】并准备一条策略', async () => {
await t.login()
await t.goto('/tds/policy-conflict')
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('调用冲突检测接口(同一资源 + ALLOW 与 DENY 并存必冲突)', async () => {
const policyContent = JSON.stringify([
{ policyCode: target.templateCode, effect: 'ALLOW', target: 'table.user', point: 'DELIVERY' },
{ policyCode: target.templateCode, effect: 'DENY', target: 'table.user', point: 'DELIVERY' }
])
const res = await t.api('POST', '/api/ssw/tds/PolicyConflict/Check', {
productId: `E2E-${t.runId}`,
policyContent: policyContent
})
t.assert(res.code === 200, `冲突检测接口可调(code=${res.code})`)
t.assert(typeof res.data?.pass === 'boolean', `返回 pass 字段为布尔(${res.data?.pass})`)
t.assert(Array.isArray(res.data?.conflicts), `返回 conflicts 为数组(${res.data?.conflicts?.length} 条)`)
// 同资源同执行点 ALLOW/DENY 并存,按 FL-6.9 规则应判为冲突
t.assert(res.data.pass === false, `同资源 ALLOW 与 DENY 并存被判定为冲突(pass=${res.data.pass})`)
})
await t.step('调用冲突检测接口(无冲突样本 → pass)', async () => {
const policyContent = JSON.stringify([
{ policyCode: target.templateCode, effect: 'ALLOW', target: 'table.user', point: 'DELIVERY' }
])
const res = await t.api('POST', '/api/ssw/tds/PolicyConflict/Check', {
productId: `E2E-${t.runId}`,
policyContent: policyContent
})
t.assert(res.code === 200, `无冲突检测返回成功(code=${res.code})`)
t.assert(res.data.pass === true, `单条 ALLOW 通过校验(pass=${res.data.pass})`)
})
await t.step('核对页面元素:检测结果面板可操作', async () => {
// 触发「填入示例」按钮并跑一次检测,把页面交互也走通
await t.page.getByRole('button', { name: '填入示例' }).click()
await t.page.waitForTimeout(200)
await t.page.getByRole('button', { name: '开始检测' }).click()
await t.waitIdle()
// 检测完成后页面会出现「检测结果」面板
await t.expectVisible('检测结果', '检测结果面板已渲染')
})
t.expectConsoleClean()
}