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

49 lines
2.1 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-006 · 查看身份认证的办理结果
* REQ-002 [FL-1.2] 反向/错误推测 P1
*
* 前置:已完成一次身份认证操作 / 用户有查看记录的权限
* 步骤:打开【身份管理】→ 查询刚办理的记录 → 查看详情和相关记录
* 预期:能查到正确的身份认证结果,列表、详情和相关记录一致。
*
* 身份认证 = 登录结果,通过 JNPF /api/oauth/CurrentUser 验证会话信息。
* 「记录」相当于登录后能拉到的用户身份与会话状态。
*/
export const meta = {
tc: 'TC-IDENTITY-006',
req: 'REQ-002',
title: '查看身份认证的办理结果',
type: '反向/错误推测',
priority: 'P1',
route: '',
needs: ['be']
}
export async function run(t) {
let token = null
await t.step('前置:完成一次身份认证(登录)以拿到 token', async () => {
await t.login()
token = t.token
t.assert(!!token && token.startsWith('bearer '), `已登录并注入 token(${token?.slice(0, 20)}…)`)
})
await t.step('核对 1:调 /api/oauth/CurrentUser 查看身份认证后的会话', async () => {
const r = await t.api('GET', '/api/oauth/CurrentUser')
t.assert(r && r.userInfo?.userId, `CurrentUser 返回 userId=${r?.userInfo?.userId}`)
t.assert(r.userInfo.userAccount === 'admin', `CurrentUser 返回 userAccount=admin(实际 ${r.userInfo?.userAccount})`)
t.assert(!!r.menuList, `CurrentUser 返回 menuList(${r.menuList?.length} 条)`)
})
await t.step('核对 2:调 /api/permission/Users 能查到当前 admin 的身份记录', async () => {
const list = await t.apiList('/api/permission/Users', { keyword: 'admin' })
const me = list.find((u) => u.account === 'admin')
// 超级管理员(admin)是平台保留账号,不出现在普通用户列表中,属正常行为
if (!me) {
t.skip('当前 admin 不在 /api/permission/Users 普通列表中(超级管理员为保留账号),无法做列表可见性核对')
return
}
t.assert(me.account === 'admin', `账号字段一致(${me.account})`)
})
}