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

76 lines
2.9 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-CONTRACT-001 · 正常办理策略模板
* REQ-011 [FL-5.1] 正向/场景法 P0
*
* 前置:1. 已获数据提供方角色的机构用户
* 2. 服务平台的【数字合约管理】可以正常打开
* 3. 已准备好测试数据
* 步骤:1. 打开服务平台的【数字合约管理】
* 2. 按页面提示填写或选择正确的数据
* 3. 点击提交,查看办理结果
* 预期:策略模板办理成功,系统按要求完成处理,状态和记录正确。
*
* 注:本用例对应【使用控制策略】模板页(/tds/policies)。
* 国标基线:内置 34 种策略(约束类 16 + 行为类 18)+ 组合模板,下方断言以此为依据。
*/
export const meta = {
tc: 'TC-CONTRACT-001',
req: 'REQ-011',
title: '正常办理策略模板',
type: '正向/场景法',
priority: 'P0',
route: '/tds/policies',
needs: ['fe', 'be']
}
export async function run(t) {
const code = t.uid('E2E-POLICY')
const name = `测评策略-${t.runId}`
await t.step('前置:以运营方身份登录并打开【使用控制策略】', async () => {
await t.login()
await t.goto('/tds/policies')
await t.expectTitle('使用控制策略')
await t.expectVisible('.ant-table', '策略模板列表已渲染')
await t.pickSpace()
})
await t.step('核对国标基线:内置 34 种策略已 seed', async () => {
const cat = await t.api('GET', '/api/ssw/tds/PolicyTemplate/Catalog')
t.assert(cat.code === 200, `Catalog 接口返回 200(实际 ${cat.code})`)
const d = cat.data || {}
t.assert((d.constraint?.length ?? 0) >= 16, `约束类策略种类 ≥ 16(实际 ${d.constraint?.length ?? 0})`)
t.assert((d.action?.length ?? 0) >= 18, `行为类策略种类 ≥ 18(实际 ${d.action?.length ?? 0})`)
t.assert(d.baselineSatisfied === true, `国标基线达标(baselineSatisfied=${d.baselineSatisfied})`)
})
await t.step('新建一条空间自定义策略模板', async () => {
await t.openCreate()
await t.fillForm({
策略标识: code,
策略名称: name,
策略类型: '时限',
适用场景: '单次最多 24 小时',
规则内容: '{"maxHours":24}'
})
await t.save()
await t.expectToast('新增成功')
await t.shot('新增策略模板后')
})
await t.step('核对办理结果:列表可见且记录正确', async () => {
await t.search(code)
await t.expectRow(code)
await t.expectRow(name)
})
await t.step('核对落库记录:接口侧数据与界面一致', 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.name === name, `落库名称一致(${row.name})`)
t.assert(row.category === 'CONSTRAINT', `默认大类为 CONSTRAINT(实际 ${row.category})`)
})
t.expectConsoleClean()
}