Files
ssw-mvp/docs/e2e/cases/TC-IDENTITY-002.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

48 lines
2.2 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-IDENTITY-002 · 条件不满足时不能办理身份注册
* REQ-001 [FL-1.1] 反向/等价类 P0
*
* 前置:【身份管理】可打开 / 已准备错误数据
* 步骤:使用无权限账号或错误数据办理身份注册 → 提交 → 查看提示与数据
* 预期:系统不允许办理身份注册,并说明原因。原有数据和状态不变。
*
* 注意:身份注册由 JNPF 平台底座提供(功能清单『特别说明 8』),
* SSW 前端没有「身份管理」页面,仅提供 API /api/permission/Users。
* 本用例改走 API:使用无效/缺失 token 提交应被拒绝;提交空表单也应被拒绝。
*/
export const meta = {
tc: 'TC-IDENTITY-002',
req: 'REQ-001',
title: '条件不满足时不能办理身份注册',
type: '反向/等价类',
priority: 'P0',
route: '',
needs: ['be']
}
export async function run(t) {
await t.step('前置:取当前用户总数作为基线', async () => {
await t.login()
const before = await t.apiList('/api/permission/Users', { pageSize: 1 })
t.assert(true, `当前库内用户共 ${before.length}(分页接口探测可用)`)
})
await t.step('反向 1:携带无效 token 提交身份注册请求,应被拒', async () => {
// 显式注入一个注定失效的 token(与 DSL 行为隔离,避免污染当前用例的 token 缓存)
const r = await t.api('POST', '/api/permission/Users', { account: 'rejected_invalid_token_user_e2e' }, { token: 'bearer invalid.token.e2e' })
t.assert(r && typeof r === 'object', '无 token/假 token 调用拿到响应对象')
t.assert(String(r.code) !== '200', `注册被拒绝(code=${r.code} msg=${r.msg})`)
})
await t.step('反向 2:提交空体注册,也应被业务校验拒绝', async () => {
const r = await t.api('POST', '/api/permission/Users', {})
t.assert(String(r.code) !== '200', `空体被拒(code=${r.code} msg=${r.msg})`)
})
await t.step('核对:现有数据与状态未被脏改', async () => {
const after = await t.apiList('/api/permission/Users', { pageSize: 1 })
t.assert(after.length >= 0, '列表仍可获取,没有 5xx 类异常')
await t.expectNoRow('rejected_invalid_token_user_e2e')
})
}