Files
ssw-mvp/docs/e2e/cases/TC-PLATFORM-006.mjs
T
admin 4585d15d5f chore: snapshot source work — e2e fixes, backend/web, docs
- 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).
2026-08-06 14:02:07 +08:00

80 lines
3.4 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-006 · 正常办理数据产品上架
* REQ-037 [FL-10.2] 正向/场景法 P0
*
* 前置:1. 已获数据提供方角色的机构用户
* 2. 【数据提供】或【数据使用】可以正常打开
* 3. 已准备好测试数据
* 步骤:1. 打开【数据提供】或【数据使用】
* 2. 按页面提示填写或选择正确的数据
* 3. 点击提交,查看办理结果
* 预期:数据产品上架办理成功,系统按要求完成处理,状态和记录正确。
*
* 注:上架是产品 DRAFT → 提交「发布到 TDS」(PUBLISHING) → 录入审核结果(PUBLISHED)的两段式。
* 这里走完整的正向链:发布 → 审核回调 PASS。
*/
export const meta = {
tc: 'TC-PLATFORM-006',
req: 'REQ-037',
title: '正常办理数据产品上架',
type: '正向/场景法',
priority: 'P0',
route: '/tdc/products',
needs: ['fe', 'be']
}
export async function run(t) {
let target = null
let resource = null
const code = `E2E-PUB-${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 空间),否则只回「请先选择要发布到的可信数据空间」。
// 这里从 TDS Space 接口取一个 E2E 种子空间挂上。
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"}'
})
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」动作,状态推进到 PUBLISHING', 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})`)
t.assert(!!target.publishTime, `记录了发布时间(${target.publishTime})`)
await t.shot('发布到 TDS 后')
})
await t.step('第二步:点「录入审核结果」回调为 PUBLISHED', async () => {
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('上架完成 PUBLISHED')
})
t.expectConsoleClean()
}