- 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
49 lines
2.1 KiB
JavaScript
49 lines
2.1 KiB
JavaScript
/**
|
||
* TC-IDENTITY-004 · 正常办理身份认证
|
||
* REQ-002 [FL-1.2] 正向/场景法 P0
|
||
*
|
||
* 前置:已登录且具备该功能权限的用户 / 服务平台的【身份管理】可打开 / 已准备好测试数据
|
||
* 步骤:打开服务平台的【身份管理】→ 按页面提示填写或选择正确的数据 → 点击提交,查看办理结果
|
||
* 预期:身份认证办理成功,系统按要求完成处理,状态和记录正确。
|
||
*
|
||
* 身份认证由 JNPF 平台底座提供。本用例要测的就是 Login.vue → /api/oauth/Login
|
||
* 这条完整链路,所以走真实登录页 t.loginUI()。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-IDENTITY-004',
|
||
req: 'REQ-002',
|
||
title: '正常办理身份认证',
|
||
type: '正向/场景法',
|
||
priority: 'P0',
|
||
route: '/login',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.step('前置:保证当前 session 未登录(清掉 token)', async () => {
|
||
await t.logout()
|
||
t.assert(true, '已清掉 localStorage 中的 ssw_token_sswflow')
|
||
})
|
||
|
||
await t.step('走真实登录页:填账号 → 填密码 → 点登录', async () => {
|
||
await t.loginUI('admin', '123456')
|
||
// 等到路由跳到登录后页面(/projects 或 /)
|
||
await t.page.waitForURL(/\/(?!login\b)/, { timeout: 15000 }).catch(() => {})
|
||
await t.waitIdle()
|
||
})
|
||
|
||
await t.step('核对身份认证后的状态:本地 token 已注入且后端可访问', async () => {
|
||
// 浏览器跳走后,原 page 的 evaluate 会撞 SecurityError;用 context 重新读 storage
|
||
const storage = await t.context.storageState()
|
||
const origin = storage.origins.find(o => o.origin === 'http://localhost:5173')
|
||
const tok = origin?.localStorage?.find(e => e.name === 'ssw_token_sswflow')?.value
|
||
t.assert(!!tok && tok.startsWith('bearer '), `登录后 localStorage 已写入 token(${tok?.slice(0, 20)}…)`)
|
||
// 用 DSL 灌进去再调接口
|
||
if (tok) t.token = tok
|
||
const r = await t.api('GET', '/api/permission/Users?currentPage=1&pageSize=1')
|
||
t.assert(r?.code === 200, `用登录后 token 调用 Users 接口 code=${r?.code}`)
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
}
|