Files
ssw-mvp/docs/e2e/cases/TC-IDENTITY_API-006.mjs
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

50 lines
2.1 KiB
JavaScript
Raw Permalink 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_API-006 · 查看身份认证的办理结果(接口级)
* REQ-048 [FL-1.2] 正向/边界值 P1
*
* 前置:已完成一次身份认证操作 / 用户有查看记录的权限
* 步骤:调用"身份认证"接口 → 查询刚办理的记录 → 查看详情和相关记录
* 预期:能查到正确的身份认证结果,列表、详情和相关记录一致。
*/
export const meta = {
tc: 'TC-IDENTITY_API-006',
req: 'REQ-048',
title: '查看身份认证的办理结果',
type: '正向/边界值',
priority: 'P1',
route: '',
needs: ['be']
}
export async function run(t) {
let token = null
await t.step('前置:完成一次身份认证(login)拿到 token', async () => {
await t.login()
token = t.token
t.assert(!!token && token.startsWith('bearer '), `已拿到 token(${token?.slice(0, 24)}…)`)
})
await t.step('核对 1:CurrentUser 返回的身份会话信息完整', async () => {
const r = await t.api('GET', '/api/oauth/CurrentUser')
t.assert(r.code === 200, `CurrentUser code=${r.code}`)
const u = r.data?.userInfo
t.assert(!!u && !!u.userId && !!u.userName, `返回 userId=${u?.userId} userName=${u?.userName}`)
t.assert(!!r.data?.menuList, `返回菜单 ${r.data?.menuList?.length ?? 0} 条`)
})
await t.step('核对 2:用户列表接口拿到的当前用户与 CurrentUser 一致', async () => {
const cu = await t.api('GET', '/api/oauth/CurrentUser')
const myId = cu.data.userInfo.userId
const myName = cu.data.userInfo.userName
const list = await t.apiList('/api/permission/Users', { keyword: myName })
const me = list.find((u) => String(u.id) === String(myId))
// 超级管理员(admin)是平台保留账号,不出现在普通用户列表里,属正常行为,跳过比对即可
if (!me) {
t.skip(`当前用户(${myName}/${myId})不在 /api/permission/Users 普通列表中(超级管理员为保留账号),无法做列表↔CurrentUser 一致性比对`)
return
}
t.assert(String(me.id) === String(myId), `列表 id(${me.id})与 CurrentUser userId(${myId})一致`)
})
}