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

54 lines
2.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-REL-006 · 错误数据不崩溃不丢失
* REQ-Q-REL 质量特性-可靠性 正向 P0
*
* 前置:1. 已登录系统 2. 具有相应操作权限
* 步骤:1. 输入错误格式/越界数据 2. 观察系统
* 预期:1. 系统不崩溃、不异常退出、不丢失资料
*/
export const meta = {
tc: 'TC-REL-006',
req: 'Q-REL',
title: '错误数据不崩溃不丢失',
type: '正向',
priority: 'P0',
route: '/tds/contracts',
needs: ['fe', 'be']
}
export async function run(t) {
let baseline = 0
await t.step('前置:登录、取合约基线条数', async () => {
await t.login()
baseline = (await t.apiList('/api/ssw/tds/Contract')).length
t.assert(true, `基线条数=${baseline}`)
})
await t.step('错误格式/越界:超长、负数、特殊字符', async () => {
const r1 = await t.api('POST', '/api/ssw/tds/Contract', { contractCode: 'A'.repeat(5000) })
t.assert(r1.code !== 200, `超长合同编号被拒(code=${r1.code})`)
const r2 = await t.api('POST', '/api/ssw/tds/Contract', { contractCode: 'NEG', validDays: -99999 })
t.assert(r2.code !== 200, `负数有效期被拒(code=${r2.code})`)
const r3 = await t.api('POST', '/api/ssw/tds/Contract', { contractCode: 'NP', dateField: 'not-a-date' })
t.assert(r3.code !== 200, `错误日期格式被拒(code=${r3.code})`)
})
await t.step('前端越界:number 控件输入远超上限', async () => {
await t.goto('/tds/contracts')
await t.openCreate()
const numField = t.drawer().locator('.ant-form-item:has(label:text-is("有效期"))').first()
if (await numField.count()) {
await numField.locator('.ant-input-number-input').fill('999999999999999')
}
await t.save()
await t.expectReject()
await t.cancelDrawer()
})
await t.step('核对数据条数未变(无脏数据写入)', async () => {
const after = (await t.apiList('/api/ssw/tds/Contract')).length
t.assert(after === baseline, `条数未变(${baseline} → ${after})`)
})
t.expectConsoleClean()
}