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

66 lines
2.6 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-TRADE-004 · 条件不满足时不能办理需求中心
* REQ-020 [FL-17.2] 反向/等价类 P0
*
* 前置:1. 服务平台的【数据交易】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开服务平台的【数据交易】
* 2. 使用无权限账号或错误数据办理需求中心
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理需求中心,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-TRADE-004',
req: 'REQ-020',
title: '条件不满足时不能办理需求中心',
type: '反向/等价类',
priority: 'P0',
route: '/tds/market',
needs: ['fe', 'be']
}
export async function run(t) {
let before = 0
await t.step('前置:登录并记录「需求广场」当前条数', async () => {
await t.login()
await t.goto('/tds/market')
before = (await t.apiList('/api/ssw/tdc/Demand')).length
t.assert(true, `提交前需求广场共 ${before} 条`)
})
await t.step('缺必填项提交:需求标题留空', async () => {
await t.openCreate()
await t.fillForm({
期望数据类型: '文本',
描述: `需求中心反向 ${t.runId}`
})
await t.save()
await t.expectReject('不能为空')
await t.shot('需求标题必填校验')
t.assert(await t.drawer().isVisible(), '校验未通过时抽屉保持打开,未误提交')
await t.cancelDrawer()
})
await t.step('对已关闭的需求再点「关闭」应被拒绝(状态机不允许)', async () => {
const list = await t.apiList('/api/ssw/tdc/Demand', { pageSize: 50 })
const closed = list.find((r) => r.status === 'CLOSED')
if (!closed) t.skip('库里没有 CLOSED 的需求,跳过本步')
const r = await t.api('PUT', `/api/ssw/tdc/Demand/${closed.id}/Close`)
t.assert(r.code !== 200, `CLOSED 再关闭被拒(实际 code=${r.code})`)
t.assert(/状态|不允许|失败|错误/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('关闭不存在的需求应被拒绝', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Demand/non-exist-id-yyy/Close')
t.assert(r.code !== 200, `不存在的 ID 关闭被拒(实际 code=${r.code})`)
})
await t.step('核对原有数据和状态不变', async () => {
const after = (await t.apiList('/api/ssw/tdc/Demand')).length
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
await t.expectNoRow(`需求中心反向 ${t.runId}`)
})
t.expectConsoleClean()
}