Files
ssw-mvp/docs/e2e/cases/TC-REL-007.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

84 lines
3.3 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-REL-007 · 重要删除有警告与确认
* REQ-Q-REL 质量特性-可靠性 正向 P0
*
* 前置:1. 已登录系统 2. 具有相应操作权限
* 步骤:1. 执行重要数据删除操作 2. 观察系统
* 预期:1. 系统对重要删除操作给出警告及确认提示
*
* 注:连接器页新建会因已知缺陷(缺 spaceId defaults)被「所属空间不能为空」挡住,
* 本用例改走 API 直接创建一条合约用于删除流程演示;删除操作走 UI。
*/
export const meta = {
tc: 'TC-REL-007',
req: 'Q-REL',
title: '重要删除有警告与确认',
type: '正向',
priority: 'P0',
route: '/tds/contracts',
needs: ['fe', 'be']
}
export async function run(t) {
const code = t.uid('E2E-DEL')
const name = `待删除合约-${t.runId}`
await t.step('前置:API 直接落一条合约作为删除对象', async () => {
await t.login()
await t.goto('/tds/contracts')
// 必须用真实 spaceId(不是 DOM 文案),否则合约挂在错空间 → 页面按当前空间过滤查不到。
const sp = await t.pickSpaceRef()
if (!sp) t.skip('本页没有空间可选,跳过')
const conns = await t.apiList('/api/ssw/tds/Connector', { spaceId: sp.id, pageSize: 20 })
const prods = await t.apiList('/api/ssw/tds/DataProduct', { spaceId: sp.id, pageSize: 5 })
if (conns.length < 2 || !prods.length) t.skip(`当前空间需至少 2 连接器 + 1 产品(实际 ${conns.length} / ${prods.length})`)
const r = await t.api('POST', '/api/ssw/tds/Contract', {
contractCode: code,
name: '可靠性烟测',
spaceId: sp.id,
productId: prods[0].id,
providerConnectorId: conns[0].id,
consumerConnectorId: conns[1].id,
providerOrgName: '尚数网提供方',
consumerOrgName: '尚数网使用方',
purpose: '可靠性烟测',
deliveryType: 'API',
priceMode: 'BY_CALL'
})
t.assert(r.code === 200, `API 落合约成功(code=${r.code})`)
})
await t.step('前置:打开【数字合约管理】并定位该记录', async () => {
// 列表已按 pickSpaceRef 选定的空间过滤;API 刚落的合约需刷新列表再 search。
await t.refresh()
await t.resetQuery()
await t.search(code)
await t.expectRow(code)
})
await t.step('点删除应弹出 Popconfirm 确认气泡,不直接删除', async () => {
await t.row(code).getByRole('button', { name: /删除/ }).click()
const pop = t.page.locator('.ant-popconfirm:visible')
await pop.waitFor({ state: 'visible', timeout: 5000 })
t.assert(true, '删除操作触发 Popconfirm 确认气泡(带警告语义)')
await t.shot('删除确认气泡')
await pop.locator('.ant-btn:not(.ant-btn-primary)').first().click()
})
await t.step('取消确认后数据仍在', async () => {
await t.search(code)
await t.expectRow(code)
})
await t.step('再次点删除并确认,记录消失', async () => {
await t.row(code).getByRole('button', { name: /删除/ }).click()
const pop = t.page.locator('.ant-popconfirm:visible')
await pop.waitFor({ state: 'visible', timeout: 5000 })
await pop.locator('.ant-btn-primary').click()
await t.waitIdle()
await t.search(code)
await t.expectNoRow(code)
})
t.expectConsoleClean()
}