diff --git a/e2e/admin-settings.spec.ts b/e2e/admin-settings.spec.ts index a206b66f..fa423832 100644 --- a/e2e/admin-settings.spec.ts +++ b/e2e/admin-settings.spec.ts @@ -72,15 +72,16 @@ test('Admin can configure OpenAI settings with multi-instance support', async ({ await page.getByRole('button', { name: '设置' }).click(); // 等待对话框显示 - await expect(page.getByRole('dialog')).toBeVisible({ timeout: 5000 }); + const dialog = page.getByRole('dialog'); + await expect(dialog).toBeVisible({ timeout: 5000 }); // Switch to AI Tab (支持中英文) - await page.getByRole('tab', { name: /AI Provider|AI 提供商/ }).click(); + await dialog.getByRole('tab', { name: /AI Provider|AI 提供商/ }).click(); // Verify values match // First combobox should be AI Provider, second should be instance selector - await expect(page.locator('button[role="combobox"]').first()).toHaveText('OpenAI / Compatible'); - await expect(page.locator('input[placeholder="sk-..."]')).toHaveValue(apiKey); - await expect(page.locator('input[placeholder="https://api.openai.com/v1"]')).toHaveValue(baseURL); - await expect(page.locator('input[placeholder="gpt-6.2-sol"]')).toHaveValue(modelName); + await expect(dialog.locator('button[role="combobox"]').first()).toHaveText('OpenAI / Compatible'); + await expect(dialog.locator('input[placeholder="sk-..."]')).toHaveValue(apiKey); + await expect(dialog.locator('input[placeholder="https://api.openai.com/v1"]')).toHaveValue(baseURL); + await expect(dialog.locator('input[placeholder="gpt-6.2-sol"]')).toHaveValue(modelName); }); diff --git a/e2e/sub-question-results.spec.ts b/e2e/sub-question-results.spec.ts index e89f8732..1d5dc5cb 100644 --- a/e2e/sub-question-results.spec.ts +++ b/e2e/sub-question-results.spec.ts @@ -32,7 +32,7 @@ test('[E2E-M06] 试卷逐小问录入结果与得分汇总', async ({ page, scen await expect(card.getByText('第 2 小问', { exact: true })).toBeVisible(); await card.getByRole('radio', { name: '做对', exact: true }).first().click(); await card.getByRole('radio', { name: '做错', exact: true }).nth(1).click(); - const scores = card.locator('input[id^="sub-score-"]'); + const scores = card.getByLabel('得分', { exact: true }); await expect(scores).toHaveCount(2); await scores.nth(0).fill('2'); await scores.nth(1).fill('1'); diff --git a/e2e/upload-correction.spec.ts b/e2e/upload-correction.spec.ts index 60d4ce84..2918ebdc 100644 --- a/e2e/upload-correction.spec.ts +++ b/e2e/upload-correction.spec.ts @@ -3,6 +3,8 @@ import { importImage } from './support/flows'; import { acceptConfirmDialog } from './helpers'; test('没有卷别分组时也能首次校对保存,随后刷新并删除', async ({ page, scenario }) => { + // 只有管理员账号在错题与错题本详情页保留删除入口 + await scenario.db.user.update({ where: { id: scenario.user.id }, data: { role: 'admin' } }); await scenario.db.paperGroup.deleteMany({ where: { userId: scenario.user.id } }); const item = await importImage(page, scenario, true); const group = await scenario.db.paperGroup.findUniqueOrThrow({ where: { userId_key: { userId: scenario.user.id, key: 'a' } } });