/** * TC-PRODUCT_API-003 · 查看数据产品登记的办理结果 * REQ-051 [FL-4.1] 反向/错误推测 P1 * * 前置:1. 已完成一次数据产品登记操作 * 2. 用户有查看记录的权限 * 步骤:1. 打开通过已认证的调用方连接器调用"数据产品登记"接口 * 2. 查询刚办理的记录 * 3. 查看详情和相关记录 * 预期:能查到正确的数据产品登记结果,列表、详情和相关记录一致。 * * 注:核对三条查询链路:列表关键字查询 / info 详情 / 过滤查询(按 status/auditStatus)。 * info 接口回显与登记一致才算「列表、详情和相关记录一致」。 */ export const meta = { tc: 'TC-PRODUCT_API-003', req: 'REQ-051', title: '查看数据产品登记的办理结果', type: '反向/错误推测', priority: 'P1', route: '/tds/products', needs: ['be'] } export async function run(t) { const code = t.uid('E2E-PROD-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', category: '金融', tags: 'view,e2e' }) t.assert(create.code === 200, `建产品成功(code=${create.code})`) t._newId = create.data }) await t.step('用 productCode 关键字查询能命中该记录', 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=DRAFT 过滤查询能命中该记录', async () => { const list = await t.apiList('/api/ssw/tds/DataProduct', { status: 'DRAFT', pageSize: 100 }) t.assert(Array.isArray(list), `按 status 过滤返回数组(${list.length} 条)`) t.assert(list.some((r) => r.productCode === code), `DRAFT 过滤结果包含本用例新建产品`) }) await t.step('用 classifyLevel=PUBLIC 过滤查询能命中该记录', async () => { const list = await t.apiList('/api/ssw/tds/DataProduct', { classifyLevel: 'PUBLIC', pageSize: 100 }) t.assert(Array.isArray(list), `按分级过滤返回数组(${list.length} 条)`) t.assert(list.some((r) => r.productCode === code), `PUBLIC 过滤结果包含本用例新建产品`) }) 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 可查(code=${info.code})`) t.assert(info.data.productCode === code, `info productCode 一致`) t.assert(info.data.name.startsWith('查看-测评-'), `info name 一致(${info.data.name})`) t.assert(info.data.classifyLevel === 'PUBLIC', `info 分级=PUBLIC(实际 ${info.data.classifyLevel})`) t.assert(info.data.status === 'DRAFT', `info status=DRAFT(实际 ${info.data.status})`) t.assert(info.data.auditStatus === 'DRAFT', `info auditStatus=DRAFT(实际 ${info.data.auditStatus})`) }) }