test: add wechat miniprogram auth smoke
This commit is contained in:
@@ -143,6 +143,20 @@ https://你的H5业务域名/#auth_provider=wechat&auth_token=<系统JWT>&auth_b
|
||||
|
||||
## 7. 验收口径
|
||||
|
||||
可重复自动化 smoke:
|
||||
|
||||
```bash
|
||||
npm run check:wechat-miniprogram-auth
|
||||
```
|
||||
|
||||
该命令固定覆盖三段链路:
|
||||
|
||||
1. 静态确认 `miniprogram/pages/web-view/index.js` 会请求 `/api/auth/wechat/miniprogram-login`,携带 `mini_program / wechat_mini_program` 客户端来源头,并把 `auth_provider/auth_token/auth_binding_status` 拼入 H5 hash。
|
||||
2. 运行 `api-server` 定向测试 `wechat_miniprogram_login_returns_system_token_and_marks_session_source`,断言小程序登录返回 `token/bindingStatus/user`、写入 refresh cookie,并且 `/api/auth/sessions` 能看到 `clientType=mini_program`、`clientRuntime=wechat_mini_program`、`miniProgramAppId`。
|
||||
3. 运行前端 `authService` 定向测试,断言 `consumeAuthCallbackResult()` 会消费 `#auth_provider=wechat&auth_token=...&auth_binding_status=...`、保存 access token,并清理地址栏 hash。
|
||||
|
||||
手工联调仍按以下口径确认真实微信与域名配置:
|
||||
|
||||
1. 微信开发者工具打开项目根目录后,识别 `miniprogram/` 为小程序源码目录。
|
||||
2. 未填写 `WEB_VIEW_ENTRY_URL` 或 `API_BASE_URL` 时,页面显示配置提示,不出现空白页。
|
||||
3. 填写已配置业务域名后,小程序先请求 `/api/auth/wechat/miniprogram-login`。
|
||||
|
||||
Reference in New Issue
Block a user