feat(aihr): finalize practice growth and access boundaries
This commit is contained in:
@@ -42,6 +42,13 @@ test('训练页提交失败会回滚本次乐观追加的对话', async () => {
|
||||
assert.match(source, /uni\.showToast\(\{ title: message\.value \|\| '提交失败', icon: 'none'/);
|
||||
});
|
||||
|
||||
test('训练主操作使用当前已发布的场景,而不覆盖为内置默认场景', async () => {
|
||||
const source = await pageSource('../src/pages/user/practice/index.vue');
|
||||
|
||||
assert.match(source, /@click="start\(selectedScenarioId\)"/);
|
||||
assert.match(source, /const start = async \(scenarioId = selectedScenarioId\.value, assignmentId\?: number\)/);
|
||||
});
|
||||
|
||||
test('训练求助先留存会话事件,再以 practice_help 来源检索 SOP', async () => {
|
||||
const [practicePage, practiceService, knowledgeService] = await Promise.all([
|
||||
pageSource('../src/pages/user/practice/index.vue'),
|
||||
@@ -347,10 +354,37 @@ test('员工练习页显示当前岗位而不是固定生活顾问', async () =>
|
||||
|
||||
assert.match(source, /getSelectedPosition/);
|
||||
assert.match(source, /const positionLabel = ref\(getSelectedPosition\(\) \|\| '生活顾问'\)/);
|
||||
assert.match(source, /\{\{ positionLabel \}\} · 业主服务场景/);
|
||||
assert.match(source, /const selectedScenarioDescription = computed\(\(\) =>/);
|
||||
assert.match(source, /\{\{ selectedScenarioDescription \}\}/);
|
||||
assert.doesNotMatch(source, /scenario-desc">生活顾问 · 业主服务场景/);
|
||||
});
|
||||
|
||||
test('场景目录加载失败时清空旧场景并禁止开始训练', async () => {
|
||||
const source = await pageSource('../src/pages/user/practice/index.vue');
|
||||
|
||||
assert.match(source, /selectedScenarioId\.value = ''/);
|
||||
assert.match(source, /activeScenarioName\.value = '暂无可用训练场景'/);
|
||||
assert.match(source, /handleError\(scenarioResult\.reason, '训练场景加载失败'\)/);
|
||||
assert.match(source, /:disabled="!canStartPractice \|\| busy"/);
|
||||
assert.match(source, /!curriculumLoading\.value/);
|
||||
});
|
||||
|
||||
test('无已发布场景时不展示默认预习卡或训练入口', async () => {
|
||||
const source = await pageSource('../src/pages/user/practice/index.vue');
|
||||
|
||||
assert.match(source, /v-if="loggedIn && practiceView === 'prep' && availableScenarios\.length" class="panel scenario-card employee-card"/);
|
||||
assert.match(source, /const activeScenario = nextScenarios\.find\([\s\S]*?\|\| nextScenarios\[0\];[\s\S]*?else \{\s*selectedScenarioId\.value = '';\s*activeScenarioName\.value = '暂无可用训练场景';\s*prepCard\.value = null;/);
|
||||
});
|
||||
|
||||
test('待训练专项等待目录加载,并对下线或待发布场景给出明确提示', async () => {
|
||||
const source = await pageSource('../src/pages/user/practice/index.vue');
|
||||
|
||||
assert.match(source, /if \(assignmentLoading\.value \|\| curriculumLoading\.value\) return;/);
|
||||
assert.match(source, /startAssignment\(item\);\s*uni\.removeStorageSync\(pendingAssignmentKey\);/);
|
||||
assert.match(source, /const scenario = availableScenarios\.value\.find\(\(entry\) => entry\.id === scenarioId\);/);
|
||||
assert.match(source, /本次专项关联的场景已下线或待发布,请联系内容运营后再练习/);
|
||||
});
|
||||
|
||||
test('员工问师傅页显示当前岗位而不是固定生活顾问', async () => {
|
||||
const source = await pageSource('../src/pages/user/sop/index.vue');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user