feat(aihr): harden M0-M2 mobile training flows

This commit is contained in:
2026-07-23 21:18:13 +08:00
parent 06322c994b
commit 927458b9e0
44 changed files with 1674 additions and 119 deletions
@@ -42,6 +42,32 @@ test('训练页提交失败会回滚本次乐观追加的对话', async () => {
assert.match(source, /uni\.showToast\(\{ title: message\.value \|\| '提交失败', icon: 'none'/);
});
test('训练求助先留存会话事件,再以 practice_help 来源检索 SOP', async () => {
const [practicePage, practiceService, knowledgeService] = await Promise.all([
pageSource('../src/pages/user/practice/index.vue'),
pageSource('../src/services/practice.ts'),
pageSource('../src/services/knowledge.ts')
]);
assert.match(practiceService, /sessions\/\$\{encodeURIComponent\(sessionId\)\}\/help/);
assert.match(practicePage, /await recordPracticeHelp\(sessionId\.value, roundIndex\.value\)/);
assert.match(practicePage, /'practice_help'/);
assert.match(knowledgeService, /'practice_help'/);
});
test('语音 profile 透传方言枚举,并保持普通话默认值', async () => {
const [apiTypes, speechService] = await Promise.all([
pageSource('../src/types/api.ts'),
pageSource('../src/services/speech.ts')
]);
assert.match(apiTypes, /dialect\?: 'mandarin' \| 'cantonese' \| 'sichuanese'/);
assert.match(speechService, /dialect: 'mandarin'/);
assert.match(speechService, /customerVoiceProfile = \([\s\S]*?dialect:/);
assert.match(speechService, /dialect === 'cantonese'.*'zh-HK'/);
assert.match(speechService, /dialect === 'sichuanese'[\s\S]*?当前设备语音不支持四川话/);
});
test('训练结果回到顶部,SOP 答案生成后定位到回答区', async () => {
const [practiceSource, sopSource, navigationSource] = await Promise.all([
pageSource('../src/pages/user/practice/index.vue'),
@@ -99,6 +125,15 @@ test('登录页按高保真原型保留品牌结构和紧凑验证码行', async
assert.doesNotMatch(source, /grid-template-columns:\s*1fr;[\s\S]*?\.code-button/);
});
test('移动端短信登录不再让客户端选择租户', async () => {
const source = await pageSource('../src/pages/auth/login/index.vue');
const loginRequest = source.match(/url: '\/auth\/mobile\/sms-login',[\s\S]*?auth: false/)?.[0] || '';
assert.match(loginRequest, /phonenumber: value/);
assert.match(loginRequest, /smsCode: formData\.smsCode\.trim\(\)/);
assert.doesNotMatch(loginRequest, /tenantId:/);
});
test('共享视觉基座包含员工端主色和卡片圆角 token', async () => {
const source = await pageSource('../src/styles/base.css');