fix: distinguish review, output validation and connection failures in grading UI

This commit is contained in:
2026-10-17 20:19:23 +08:00
parent ef9edecff2
commit ef5c3ecab2
3 changed files with 50 additions and 5 deletions
+34
View File
@@ -149,6 +149,40 @@ test('failed scoring shows the network error and retry guidance on the page', as
await expect(page.getByText(/已经成功的评分和教师复核会保留/)).toBeVisible();
});
test('batch progress exposes failures separately from teacher review', async ({ page }) => {
await setup(page);
await page.route('**/api/scoring-batches', route => route.fulfill({ json: [{
id: 71, course_version_id: 1, project_ids: [11], status: 'partial',
progress_done: 22, progress_total: 22, needs_review: 2, failed: 1, unscorable: 0,
}] }));
await page.goto('/?page=batches');
const row = page.getByRole('row').filter({ hasText: '#71' });
await expect(row).toContainText('评分失败 1');
await expect(row).toContainText('待复核 2');
await expect(row).toContainText('处理结束,仍有未评分项');
});
test('output validation and insufficient evidence are not presented as network failures', async ({ page }) => {
await setup(page);
await page.route('**/api/projects/11/scores?*', route => route.fulfill({ json: {
student_no: '9000000001', name: '学生甲', topic: '项目', totals: { overall: null }, facts: {},
rows: [
{ criterion: { criterion_id: 'stage2.experiment', category: 'stage2', name: '实验方案', max_score: 20 },
status: 'failed', error: '模型证据未关联该片段的检索目标', evidence: [] },
{ criterion: { criterion_id: 'stage3.plan', category: 'stage3', name: '下一阶段计划', max_score: 10 },
status: 'needs_review', error: '模型认为现有正文证据不足以判断该项,转教师复核。',
evidence: [], missing_evidence: ['计划'], evidence_gaps: [], model_comment: '当前片段不足。' },
],
} }));
await page.goto('/?page=scores&batch_id=71&project_id=11');
await expect(page.getByText('模型输出校验失败', { exact: true })).toBeVisible();
await expect(page.getByText('模型调用失败', { exact: true })).toHaveCount(0);
await expect(page.getByText(/输出校验失败可重试/)).toBeVisible();
await page.getByRole('row').filter({ hasText: '下一阶段计划' }).getByRole('button', { name: '查看证据/复核' }).click();
await expect(page.getByText('本项证据不足以自动评分,需要教师复核', { exact: true })).toBeVisible();
await expect(page.getByText(/缺少或尚不足以支撑判断的目标:计划/)).toBeVisible();
});
test('a slow project list keeps the student specified in a multi-project batch link', async ({ page }) => {
const state = await setup(page);
await page.route('**/api/scoring-batches', route => route.fulfill({ json: [{