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

83 lines
3.7 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-PRODUCT_API-004 · 正常办理数据产品上架
* REQ-052 [FL-4.4] 正向/场景法 P0
*
* 前置:1. 已获数据提供方角色的机构用户
* 2. 通过已认证的调用方连接器调用"数据产品上架"接口可以正常打开
* 3. 已准备好测试数据
* 步骤:1. 打开通过已认证的调用方连接器调用"数据产品上架"接口
* 2. 按页面提示填写或选择正确的数据
* 3. 点击提交,查看办理结果
* 预期:数据产品上架办理成功,系统按要求完成处理,状态和记录正确。
*
* 注:上架状态机:DRAFT -> Submit -> PENDING -> Audit(PASS) -> Online。
* 后端 DataProductController.online 要求 auditStatus=PASS 才允许上架,
* 上架后 status=ONLINE,onlineTime 落库。
* 本用例按真实业务流跑完 Submit → Audit → Online,断言每个状态字段都正确迁移。
*/
export const meta = {
tc: 'TC-PRODUCT_API-004',
req: 'REQ-052',
title: '正常办理数据产品上架',
type: '正向/场景法',
priority: 'P0',
route: '/tds/products',
needs: ['be']
}
export async function run(t) {
const code = t.uid('E2E-ONLINE')
await t.step('前置:登录并准备一条 DRAFT 产品', async () => {
await t.login()
const spaces = await t.apiList('/api/ssw/tds/Space', { pageSize: 10 })
const space = spaces.find((s) => s.status === 'ONLINE' || s.status === 'ENABLED') || spaces[0]
if (!space) t.skip('库中无任何空间')
const conns = await t.apiList('/api/ssw/tds/Connector', { pageSize: 50 })
const conn = conns.find((c) => c.auditStatus === 'PASS') || conns[0]
if (!conn) t.skip('库中无任何连接器')
const create = await t.api('POST', '/api/ssw/tds/DataProduct', {
productCode: code,
name: `上架-测评-${t.runId}`,
spaceId: space.id,
providerConnectorId: conn.id,
category: '交通物流',
classifyLevel: 'PUBLIC'
})
t.assert(create.code === 200, `建 DRAFT 产品成功(code=${create.code})`)
t._newId = create.data
})
await t.step('提交审核:DRAFT -> PENDING', async () => {
const r = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Submit`)
t.assert(r.code === 200, `提交审核成功(code=${r.code}, msg=${r.msg || ''})`)
})
await t.step('审核通过:PENDING -> PASS', async () => {
const r = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Audit`, {
auditStatus: 'PASS',
auditOpinion: 'e2e 自动通过'
})
t.assert(r.code === 200, `审核通过成功(code=${r.code})`)
})
await t.step('上架:status -> ONLINE,onlineTime 落库', async () => {
const r = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Online`)
t.assert(r.code === 200, `上架成功(code=${r.code}, msg=${r.msg || ''})`)
})
await t.step('核对办理结果:状态字段全部到位', async () => {
const info = await t.api('GET', `/api/ssw/tds/DataProduct/${t._newId}`)
t.assert(info.code === 200 && info.data, `info 可查(code=${info.code})`)
t.assert(info.data.status === 'ONLINE', `上架后 status=ONLINE(实际 ${info.data.status})`)
t.assert(info.data.auditStatus === 'PASS', `审核状态=PASS(实际 ${info.data.auditStatus})`)
t.assert(!!info.data.onlineTime, `onlineTime 已落库(${info.data.onlineTime})`)
})
await t.step('核对服务目录(4.4)已收录该产品', async () => {
const r = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList')
const list = r?.data || []
t.assert(Array.isArray(list) && list.length > 0, `服务目录返回数组(${list.length} 条)`)
t.assert(list.some((p) => p.id === t._newId), `服务目录包含刚上架的产品`)
})
}