Files
ssw-mvp/docs/e2e/cases/TC-TRADE-002.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-002 · 条件不满足时不能办理数据市场
* REQ-019 [FL-17.2] 反向/等价类 P0
*
* 前置:1. 服务平台的【数据交易】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开服务平台的【数据交易】
* 2. 使用无权限账号或错误数据办理数据市场
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理数据市场,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-TRADE-002',
req: 'REQ-019',
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('不存在的 ID 调 Publish 应被拒绝', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Demand/non-exist-id-xxxx/Publish')
t.assert(r.code !== 200, `不存在的 ID 发布被拒(实际 code=${r.code})`)
t.assert(/不存在|失败|错误/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('对已发布的需求再点 Publish 应被拒绝', async () => {
const list = await t.apiList('/api/ssw/tdc/Demand', { pageSize: 50 })
const published = list.find((r) => r.status === 'PUBLISHED')
if (!published) t.skip('库里没有 PUBLISHED 的需求,跳过本步')
const r = await t.api('PUT', `/api/ssw/tdc/Demand/${published.id}/Publish`)
t.assert(r.code !== 200, `PUBLISHED 再发布被拒(实际 code=${r.code})`)
t.assert(/DRAFT|不允许|状态|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
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()
}