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

78 lines
3.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-SPACE-002 · 条件不满足时不能办理配置修改(空间)
* REQ-014 [FL-2.1] 反向/等价类 P0
*
* 前置:【可信数据空间管理】可打开 / 已准备错误数据
* 步骤:使用错误数据办理配置修改 → 提交 → 查看提示与数据
* 预期:系统不允许办理并说明原因;原有数据和状态不变
*/
export const meta = {
tc: 'TC-SPACE-002',
req: 'REQ-014',
title: '条件不满足时不能办理配置修改',
type: '反向/等价类',
priority: 'P0',
route: '/tds/spaces',
needs: ['fe', 'be']
}
export async function run(t) {
let before = 0
await t.step('前置:记录当前空间条数', async () => {
await t.login()
before = (await t.apiList('/api/ssw/tds/Space', { pageSize: 1 })).length
t.assert(true, `记录前条数 ${before}`)
})
await t.step('前置:打开页面', async () => {
await t.goto('/tds/spaces')
})
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('接口侧:缺 spaceCode / name / 超长标识均被拒', async () => {
const tooLong = 'x'.repeat(80)
const cases = [
{ body: {}, need: /标识|为空/ },
{ body: { spaceCode: t.uid('A') }, need: /名称|为空/ },
{ body: { spaceCode: tooLong, name: '超长' }, need: /长度|超过/ }
]
for (const c of cases) {
const r = await t.api('POST', '/api/ssw/tds/Space', c.body)
t.assert(r.code !== 200, `非法 body 被拒(code=${r.code} msg=${r.msg})`)
t.assert(c.need.test(r.msg || ''), `提示命中「${c.need}」(实际「${r.msg}」)`)
}
})
await t.step('RUNNING 空间重复上线被拒', async () => {
const list = await t.apiList('/api/ssw/tds/Space', { pageSize: 50 })
const running = list.find((r) => r.status === 'RUNNING')
if (!running) t.skip('库中没有 RUNNING 空间,跳过')
const r = await t.api('PUT', `/api/ssw/tds/Space/${running.id}/Online`)
t.assert(r.code !== 200, `重复上线被拒(code=${r.code})`)
t.assert(/运行|状态|不允许|已/.test(r.msg || ''), `提示说明原因(实际「${r.msg}」)`)
})
await t.step('核对原有数据和状态不变', async () => {
const after = (await t.apiList('/api/ssw/tds/Space', { pageSize: 1 })).length
t.assert(after === before || after >= before, `列表条数未因错误操作变脏(${before} → ${after})`)
await t.expectNoRow(`非法空间-${t.runId}`)
})
t.expectConsoleClean()
}