/** * TC-PRODUCT_API-011 · 查看数据产品检索的办理结果 * REQ-053 [FL-4.2] 正向/边界值 P1 * * 前置:1. 已完成一次数据产品检索操作 * 2. 用户有查看记录的权限 * 步骤:1. 打开通过已认证的调用方连接器调用"数据产品检索"接口 * 2. 查询刚办理的记录 * 3. 查看详情和相关记录 * 预期:能查到正确的数据产品检索结果,列表、详情和相关记录一致。 * * 注:「检索的办理结果」=检索后能从四个目录接口拉出已上架的产品,且 info 详情回显一致。 * 还要核对边界:未上架产品不出现在 ServiceList,但出现在 DataProduct 关键字查询里。 */ export const meta = { tc: 'TC-PRODUCT_API-011', req: 'REQ-053', title: '查看数据产品检索的办理结果', type: '正向/边界值', priority: 'P1', route: '/tds/catalog', needs: ['be'] } export async function run(t) { const code = t.uid('E2E-CAT-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 }) t.assert(create.code === 200, `建产品成功`) t._newId = create.data await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Submit`) await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Audit`, { auditStatus: 'PASS', auditOpinion: 'ok' }) await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Online`) }) await t.step('ServiceList 与 DataProduct 关键字查询结果一致', async () => { const catalog = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList') const catalogIds = new Set((catalog?.data || []).map((p) => p.id)) const list = await t.apiList('/api/ssw/tds/DataProduct', { keyword: code }) const hit = list.find((r) => r.productCode === code) t.assert(!!hit, `DataProduct 关键字查询命中`) t.assert(catalogIds.has(hit.id), `同一产品既在 ServiceList 也在 DataProduct 关键字结果中`) }) 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.productCode === code, `info productCode 一致`) t.assert(info.data.status === 'ONLINE', `info status=ONLINE`) t.assert(info.data.auditStatus === 'PASS', `info auditStatus=PASS`) }) }