- e2e: fix 9 failing cases (contract/hosting/delivery/usage/security); add dsl.createSandboxTask() self-provision helper; cli/runner now default headless, --ob opens visible browser - backend: tdc/tds controller adjustments (delivery, hosting, contract, chain-evidence, catalog, product, policy-conflict, etc.) - web: ssw views/components adjustments (contract, product, hosting, connector) - docs: AGENTS.md, e2e README; .gitignore; project memory update Excludes docs/e2e/results artifacts (screenshots + results.json).
84 lines
3.6 KiB
JavaScript
84 lines
3.6 KiB
JavaScript
/**
|
||
* TC-PLATFORM-009 · 正常办理数据产品目录
|
||
* REQ-038 [FL-10.3] 正向/场景法 P0
|
||
*
|
||
* 前置:1. 已获数据提供方角色的机构用户
|
||
* 2. 【数据提供】或【数据使用】可以正常打开
|
||
* 3. 已准备好测试数据
|
||
* 步骤:1. 打开【数据提供】或【数据使用】
|
||
* 2. 按页面提示填写或选择正确的数据
|
||
* 3. 点击提交,查看办理结果
|
||
* 预期:数据产品目录办理成功,系统按要求完成处理,状态和记录正确。
|
||
*
|
||
* 注:目录的「办理」含义 = 把一条本地产品「收录」到对外可浏览的目录。
|
||
* 这对应发布上架:DRAFT → PUBLISHING → PUBLISHED。已发布的产品自动出现在目录里,
|
||
* 可以被使用方检索到。这里用「录入审核结果 = PUBLISHED」把一个 DRAFT 推到 PUBLISHED,
|
||
* 完成目录收录动作。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-PLATFORM-009',
|
||
req: 'REQ-038',
|
||
title: '正常办理数据产品目录',
|
||
type: '正向/场景法',
|
||
priority: 'P0',
|
||
route: '/tdc/products',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let target = null
|
||
let resource = null
|
||
const code = `E2E-CAT-${t.runId}`
|
||
const name = `目录收录产品-${t.runId}`
|
||
|
||
await t.step('前置:登录并准备一条 DRAFT 产品', async () => {
|
||
await t.login()
|
||
const res = await t.apiList('/api/ssw/tdc/Resource', { pageSize: 50 })
|
||
resource = res[0]
|
||
if (!resource) t.skip('库里没有数据资源,无法办理目录收录')
|
||
// 后端 Publish 必须有 tdsSpaceId(发布到哪个 TDS 空间),否则只回「请先选择要发布到的可信数据空间」。
|
||
const tdsSpaces = await t.apiList('/api/ssw/tds/Space', { pageSize: 50 })
|
||
const tdsSpace = tdsSpaces.find((s) => s.spaceCode?.startsWith('E2E-SP')) || tdsSpaces[0]
|
||
if (!tdsSpace) t.skip('TDS 侧无空间,无法办理目录收录')
|
||
const r = await t.api('POST', '/api/ssw/tdc/Product', {
|
||
productCode: code,
|
||
name,
|
||
resourceId: resource.id,
|
||
tdsSpaceId: tdsSpace.id,
|
||
publishStatus: 'DRAFT',
|
||
publishFields: 'id,name',
|
||
deliveryConfig: '{"endpoint":"https://e2e.local/catalog"}'
|
||
})
|
||
t.assert(r.code === 200, `准备 DRAFT 产品成功(实际 code=${r.code})`)
|
||
target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
|
||
t.assert(target.publishStatus === 'DRAFT', `初始状态为 DRAFT(实际 ${target.publishStatus})`)
|
||
})
|
||
|
||
await t.step('打开【产品发布】', async () => {
|
||
await t.goto('/tdc/products')
|
||
await t.expectTitle('产品发布')
|
||
})
|
||
|
||
await t.step('点「发布到 TDS」→ 录入审核结果,目录收录完成', async () => {
|
||
await t.doAction(code, '发布到 TDS')
|
||
await t.waitIdle()
|
||
target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
|
||
t.assert(target.publishStatus === 'PUBLISHING', `第一步:状态变为 PUBLISHING(实际 ${target.publishStatus})`)
|
||
await t.refresh()
|
||
await t.doAction(code, '录入审核结果', 'PUBLISHED')
|
||
await t.waitIdle()
|
||
target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
|
||
t.assert(target.publishStatus === 'PUBLISHED', `第二步:状态变为 PUBLISHED(实际 ${target.publishStatus})`)
|
||
await t.shot('目录收录完成')
|
||
})
|
||
|
||
await t.step('在「已发布」筛选下能命中该目录收录产品', async () => {
|
||
await t.selectFilter('发布状态', '已发布')
|
||
await t.waitIdle()
|
||
await t.search(code)
|
||
await t.expectRow(code)
|
||
await t.shot('已发布筛选下目录产品')
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |