- 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
76 lines
2.8 KiB
JavaScript
76 lines
2.8 KiB
JavaScript
/**
|
||
* TC-CONTRACT-002 · 条件不满足时不能办理策略模板
|
||
* REQ-011 [FL-5.1] 反向/状态迁移 P0
|
||
*
|
||
* 前置:1. 服务平台的【数字合约管理】可以正常打开
|
||
* 2. 已准备无权限账号或错误数据
|
||
* 步骤:1. 打开服务平台的【数字合约管理】
|
||
* 2. 使用无权限账号或错误数据办理策略模板
|
||
* 3. 点击提交,查看提示和数据
|
||
* 预期:系统不允许办理策略模板,并说明原因。原有数据和状态不变。
|
||
*
|
||
* 注:本用例对应【使用控制策略】模板页(/tds/policies)。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-CONTRACT-002',
|
||
req: 'REQ-011',
|
||
title: '条件不满足时不能办理策略模板',
|
||
type: '反向/状态迁移',
|
||
priority: 'P0',
|
||
route: '/tds/policies',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let before = 0
|
||
|
||
await t.step('前置:登录并打开页面,记录当前模板数量', async () => {
|
||
await t.login()
|
||
await t.goto('/tds/policies')
|
||
before = (await t.apiList('/api/ssw/tds/PolicyTemplate', { pageSize: 50 })).length
|
||
t.assert(true, `操作前模板共 ${before} 条`)
|
||
})
|
||
|
||
await t.step('缺必填项提交:策略标识/名称/大类均不填', async () => {
|
||
await t.openCreate()
|
||
await t.fillForm({ 适用场景: '无关场景' })
|
||
await t.save()
|
||
await t.expectReject('不能为空')
|
||
await t.shot('必填校验拦截')
|
||
})
|
||
|
||
await t.step('只补策略标识仍缺名称/大类,依然被拦截', async () => {
|
||
await t.fillForm({ 策略标识: `缺名称-${t.runId}` })
|
||
await t.save()
|
||
await t.expectReject('不能为空')
|
||
t.assert(await t.drawer().isVisible(), '校验未通过时抽屉保持打开,未误提交')
|
||
await t.cancelDrawer()
|
||
})
|
||
|
||
await t.step('接口侧:缺必填字段同样被拒', async () => {
|
||
const r = await t.api('POST', '/api/ssw/tds/PolicyTemplate', {
|
||
templateCode: '',
|
||
name: '',
|
||
category: ''
|
||
})
|
||
t.assert(r.code !== 200, `缺必填字段被拒(实际 code=${r.code})`)
|
||
t.assert(/不能为空|为空|必填/i.test(r.msg || ''), `错误信息含「不能为空/必填」(实际「${r.msg}」)`)
|
||
})
|
||
|
||
await t.step('接口侧:category 取非法值被拒', async () => {
|
||
const r = await t.api('POST', '/api/ssw/tds/PolicyTemplate', {
|
||
templateCode: t.uid('E2E-BAD'),
|
||
name: '非法大类',
|
||
category: 'NOT_A_VALID_CATEGORY'
|
||
})
|
||
t.assert(r.code !== 200, `非法大类被拒(实际 code=${r.code},msg=「${r.msg}」)`)
|
||
})
|
||
|
||
await t.step('核对原有数据和状态不变', async () => {
|
||
const after = (await t.apiList('/api/ssw/tds/PolicyTemplate', { pageSize: 50 })).length
|
||
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
|
||
await t.expectNoRow(`缺名称-${t.runId}`)
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |