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

90 lines
4.1 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-009 · 正常办理数据产品检索
* REQ-053 [FL-4.2] 正向/场景法 P0
*
* 前置:1. 已获数据提供方角色的机构用户
* 2. 通过已认证的调用方连接器调用"数据产品检索"接口可以正常打开
* 3. 已准备好测试数据
* 步骤:1. 打开通过已认证的调用方连接器调用"数据产品检索"接口
* 2. 按页面提示填写或选择正确的数据
* 3. 点击提交,查看办理结果
* 预期:数据产品检索办理成功,系统按要求完成处理,状态和记录正确。
*
* 注:Catalog 是四类目录的只读聚合视图(4.4 ~ 4.7),后端 CatalogController 直接 list 现有产品:
* - ServiceList: status=ONLINE 的产品
* - ProviderList: 按 providerOrgId 聚合
* - ConsumerList: 按合约 consumerOrgId 聚合
* - TrialList: trialMark=1 的产品
* 「检索办理成功」=至少调通一个目录接口,拿到非空数组 / 含本用例新建产品的子集。
*/
export const meta = {
tc: 'TC-PRODUCT_API-009',
req: 'REQ-053',
title: '正常办理数据产品检索',
type: '正向/场景法',
priority: 'P0',
route: '/tds/catalog',
needs: ['be']
}
export async function run(t) {
const code = t.uid('E2E-CAT')
await t.step('前置:登录、建一条产品并上架(让 ServiceList 能命中)', 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,
classifyLevel: 'PUBLIC'
})
t.assert(create.code === 200, `建产品成功(code=${create.code})`)
t._newId = create.data
const submit = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Submit`)
t.assert(submit.code === 200, `Submit 成功`)
const audit = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Audit`, {
auditStatus: 'PASS',
auditOpinion: 'e2e'
})
t.assert(audit.code === 200, `Audit PASS 成功`)
const online = await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Online`)
t.assert(online.code === 200, `Online 成功`)
})
await t.step('正向:调通 ServiceList(服务目录 4.4)并命中', async () => {
const r = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList')
const arr = r?.data || []
t.assert(Array.isArray(arr), `ServiceList 返回数组(${arr.length} 条)`)
t.assert(arr.some((p) => p.id === t._newId), `ServiceList 包含刚上架的产品`)
})
await t.step('正向:调通 ProviderList(提供方目录 4.5)', async () => {
const r = await t.api('GET', '/api/ssw/tds/Catalog/ProviderList')
const arr = r?.data || []
t.assert(Array.isArray(arr), `ProviderList 返回数组(${arr.length} 条)`)
// 提供方目录是按组织聚合的,至少要是数组,结构含 providerOrgId/productCount
if (arr.length) {
t.assert('providerOrgId' in arr[0] && 'productCount' in arr[0], `聚合字段齐全(${Object.keys(arr[0]).join(',')})`)
}
})
await t.step('正向:调通 ConsumerList(使用方目录 4.6)', async () => {
const r = await t.api('GET', '/api/ssw/tds/Catalog/ConsumerList')
const arr = r?.data || []
t.assert(Array.isArray(arr), `ConsumerList 返回数组(${arr.length} 条)`)
})
await t.step('正向:调通 TrialList(试用目录 4.7)', async () => {
const r = await t.api('GET', '/api/ssw/tds/Catalog/TrialList')
const arr = r?.data || []
t.assert(Array.isArray(arr), `TrialList 返回数组(${arr.length} 条)`)
// 没标记 trial 的不会进;断言接口不报错即可
})
}