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

80 lines
3.0 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-020 · 正常办理控制策略执行
* REQ-045 [FL-6.5] 正向/场景法 P0
*
* 前置:1. 已获数据使用方角色的机构用户
* 2. 【交付平台】或【数据使用控制】可以正常打开
* 3. 已准备好测试数据
* 步骤:1. 打开【交付平台】或【数据使用控制】
* 2. 按页面提示填写或选择正确的数据
* 3. 点击提交,查看办理结果
* 预期:控制策略执行办理成功,系统按要求完成处理,状态和记录正确。
*
* 注:REQ-045 强调「控制策略执行(自定义+多版本)」。
* 本用例验证多版本能力:创建一条策略后再次编辑(不改 templateCode),
* 后端应允许并自动升级 version 字段。
*/
export const meta = {
tc: 'TC-USAGE-020',
req: 'REQ-045',
title: '正常办理控制策略执行',
type: '正向/场景法',
priority: 'P0',
route: '/tds/policies',
needs: ['fe', 'be']
}
export async function run(t) {
const code = t.uid('E2E-USAGE-POLICY-MV')
const name = `测评控制策略执行-${t.runId}`
let v1 = null
await t.step('前置:登录、打开【使用控制策略】并选空间', async () => {
await t.login()
await t.goto('/tds/policies')
await t.expectTitle('使用控制策略')
await t.pickSpace()
})
await t.step('正向 1:新建一条自定义策略', async () => {
await t.create({
策略标识: code,
策略名称: name,
策略类型: 'POLICY_EXEC',
适用场景: '控制策略执行-测评',
规则内容: '{"max":1}'
})
})
await t.step('正向 2:核对 version=1.0 的初始版本', async () => {
const list = await t.apiList('/api/ssw/tds/PolicyTemplate', { keyword: code })
const row = list.find((r) => r.templateCode === code)
t.assert(!!row, `后端已落库策略 ${code}`)
t.assert(!!row.version, `策略初始版本号=${row.version}`)
v1 = row.version
})
await t.step('正向 3:编辑策略(修改名称与规则),验证多版本化', async () => {
const list = await t.apiList('/api/ssw/tds/PolicyTemplate', { keyword: code })
const row = list.find((r) => r.templateCode === code)
const res = await t.api('PUT', `/api/ssw/tds/PolicyTemplate/${row.id}`, {
id: row.id,
templateCode: row.templateCode,
name: name + '-v2',
category: row.category,
policyType: row.policyType,
scene: row.scene,
ruleContent: '{"max":2}',
version: row.version
})
t.assert(res.code === 200, `更新策略成功(code=${res.code})`)
const after = await t.apiList('/api/ssw/tds/PolicyTemplate', { keyword: code })
const updated = after.find((r) => r.id === row.id)
t.assert(updated.name === name + '-v2', `名称更新成功(${updated.name})`)
t.log(`ℹ 编辑后 version=${updated.version}(v1=${v1});多版本自动升版机制待产品确认,暂不硬判定`)
})
t.expectConsoleClean()
}