/** * TC-PRODUCT_API-006 · 查看数据产品上架的办理结果 * REQ-052 [FL-4.4] 正向/边界值 P1 * * 前置:1. 已完成一次数据产品上架操作 * 2. 用户有查看记录的权限 * 步骤:1. 打开通过已认证的调用方连接器调用"数据产品上架"接口 * 2. 查询刚办理的记录 * 3. 查看详情和相关记录 * 预期:能查到正确的数据产品上架结果,列表、详情和相关记录一致。 * * 注:上架成功的特征字段:status=ONLINE、onlineTime 非空;服务目录按 status=ONLINE 过滤能命中。 * 本用例不仅看「详情回显」,还要看「跨表一致」——同一 id 既在 DataProduct 详情里 ONLINE, * 也在 Catalog/ServiceList 数组里命中。 */ export const meta = { tc: 'TC-PRODUCT_API-006', req: 'REQ-052', title: '查看数据产品上架的办理结果', type: '正向/边界值', priority: 'P1', route: '/tds/products', needs: ['be'] } export async function run(t) { const code = t.uid('E2E-ONLINE-VIEW') await t.step('前置:登录、建一条产品并上架', 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('关键字查询能命中该记录', async () => { const list = await t.apiList('/api/ssw/tds/DataProduct', { keyword: code, pageSize: 20 }) t.assert(list.some((r) => r.productCode === code), `关键字命中(${list.length} 条)`) }) await t.step('用 status=ONLINE 过滤查询能命中该记录', async () => { const list = await t.apiList('/api/ssw/tds/DataProduct', { status: 'ONLINE', pageSize: 100 }) t.assert(Array.isArray(list) && list.length > 0, `ONLINE 过滤返回数组(${list.length} 条)`) t.assert(list.some((r) => r.productCode === code), `ONLINE 过滤包含本用例新建产品`) t.assert( list.every((r) => r.status === 'ONLINE'), `ONLINE 过滤结果全为 ONLINE(抽查 ${list.length} 条)` ) }) await t.step('info 接口回显上架结果', async () => { const info = await t.api('GET', `/api/ssw/tds/DataProduct/${t._newId}`) t.assert(info.code === 200 && info.data, `info 可查`) t.assert(info.data.status === 'ONLINE', `info status=ONLINE`) t.assert(info.data.auditStatus === 'PASS', `info auditStatus=PASS`) t.assert(!!info.data.onlineTime, `info onlineTime 非空(${info.data.onlineTime})`) }) await t.step('核对服务目录与服务目录过滤结果一致', async () => { const list = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList') const arr = list?.data || [] t.assert(arr.some((p) => p.id === t._newId), `Catalog/ServiceList 含该产品`) }) }