Files
workspace/code/g3soft-erp/web/e2e/support/global-setup.ts
T
2026-10-14 17:25:47 +08:00

18 lines
722 B
TypeScript
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.
import { apiTarget, devAccount, loginForE2E, saveSession } from './session'
/**
* 整轮测试唯一的登录点。
*
* 在 globalSetup(主进程、worker 起来之前)登录一次,token 落 `e2e/.auth/session.json`,
* worker 里的 fixtures 只读文件。**不要在 fixture / 用例里再登录**——
* 同一账号重复登录会互踢(详见 session.ts 的说明),并发用例会互相踢下线。
*/
export default async function globalSetup(): Promise<void> {
const { orgId, account } = devAccount()
const session = await loginForE2E()
saveSession(session)
console.log(
`[e2e] 已登录 ${orgId}/${account}(后端 ${apiTarget()}),会话写入 e2e/.auth/session.json`,
)
}