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

86 lines
3.3 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-PLATFORM-002 · 条件不满足时不能办理数据产品封装
* REQ-036 [FL-10.1] 反向/状态迁移 P0
*
* 前置:1. 【数据提供】或【数据使用】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开【数据提供】或【数据使用】
* 2. 使用无权限账号或错误数据办理数据产品封装
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理数据产品封装,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-PLATFORM-002',
req: 'REQ-036',
title: '条件不满足时不能办理数据产品封装',
type: '反向/状态迁移',
priority: 'P0',
route: '/tdc/products',
needs: ['fe', 'be']
}
export async function run(t) {
let before = 0
await t.step('前置:登录并记录产品当前条数', async () => {
await t.login()
await t.goto('/tdc/products')
before = (await t.apiList('/api/ssw/tdc/Product')).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', async () => {
await t.openCreate()
await t.fillForm({
产品标识: `E2E-NORES-${t.runId}`,
产品名称: `缺资源-${t.runId}`
})
await t.save()
await t.expectReject('不能为空')
await t.shot('资源 ID 必填校验')
t.assert(await t.drawer().isVisible(), '校验未通过时抽屉保持打开,未误提交')
await t.cancelDrawer()
})
await t.step('产品标识重复应被拒', async () => {
const list = await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })
const dup = list[0]
if (!dup) t.skip('库里没有任何产品,无法验证重复标识')
const r = await t.api('POST', '/api/ssw/tdc/Product', {
productCode: dup.productCode,
name: `重复标识-${t.runId}`,
resourceId: dup.resourceId ?? 'placeholder'
})
t.assert(r.code !== 200, `重复 productCode 被拒(实际 code=${r.code})`)
t.assert(/已存在|重复|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('对已发布产品 PUBLISHED 调 Publish 应被拒', async () => {
const list = await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })
const published = list.find((r) => r.publishStatus === 'PUBLISHED' || r.publishStatus === 'PUBLISHING')
if (!published) t.skip('库里没有 PUBLISHED/PUBLISHING 的产品,跳过本步')
const r = await t.api('PUT', `/api/ssw/tdc/Product/${published.id}/Publish`, {})
t.assert(r.code !== 200, `已发布再发布被拒(实际 code=${r.code})`)
})
await t.step('核对原有数据和状态不变', async () => {
const after = (await t.apiList('/api/ssw/tdc/Product')).length
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
await t.expectNoRow(`缺资源-${t.runId}`)
await t.expectNoRow(`缺标识-${t.runId}`)
})
t.expectConsoleClean()
}