From 62a30c1fd6a3692b5b396bf0d593d33c71cca4d8 Mon Sep 17 00:00:00 2001 From: margrop <1731827+margrop@users.noreply.github.com> Date: Fri, 4 Dec 2026 16:00:44 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E5=A4=8D=20E2E=20=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E4=B8=8B=E6=8B=89=E9=80=89=E6=8B=A9=E5=99=A8=E3=80=81?= =?UTF-8?q?=E5=B0=8F=E9=97=AE=E5=BE=97=E5=88=86=E6=A0=87=E7=AD=BE=E4=B8=8E?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9D=83=E9=99=90=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e2e/admin-settings.spec.ts | 13 +++++++------ e2e/sub-question-results.spec.ts | 2 +- e2e/upload-correction.spec.ts | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) 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' } } });