补齐 LLM 子菜单路由,落地模型列表与供应商管理页面交互,同时引入功能与视觉回归用例以便后续页面持续验证。 Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
2.1 KiB
TypeScript
49 lines
2.1 KiB
TypeScript
import { expect, test } from '../fixtures/auth';
|
|
|
|
test.describe('大模型 / 模型列表', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/llm/models');
|
|
await page.getByRole('table').waitFor();
|
|
});
|
|
|
|
test('展示列表及主要操作', async ({ page }) => {
|
|
await expect(page.getByRole('button', { name: '新增模型' })).toBeVisible();
|
|
await expect(page.getByRole('table')).toBeVisible();
|
|
await expect(page.getByText('GPT-4o', { exact: true })).toBeVisible();
|
|
});
|
|
|
|
test('可新增模型', async ({ page }) => {
|
|
await page.getByRole('button', { name: '新增模型' }).click();
|
|
const dialog = page.getByRole('dialog', { name: '新增模型' });
|
|
await expect(dialog).toBeVisible();
|
|
|
|
await dialog.getByLabel('模型名称').fill('测试模型');
|
|
await dialog.getByLabel('模型 ID').fill('test-model');
|
|
await dialog.getByRole('button', { name: '保 存' }).click();
|
|
|
|
await expect(page.getByText('测试模型', { exact: true })).toBeVisible();
|
|
});
|
|
|
|
test('可切换模型状态并查看用量', async ({ page }) => {
|
|
const statusSwitch = page.getByRole('switch', { name: 'GPT-4o状态' });
|
|
await expect(statusSwitch).toBeChecked();
|
|
await statusSwitch.click();
|
|
await expect(statusSwitch).not.toBeChecked();
|
|
|
|
const row = page.getByRole('row').filter({ hasText: 'GPT-4o' });
|
|
await row.getByRole('button', { name: '用量' }).click();
|
|
await expect(page.getByText('GPT-4o 用量详情')).toBeVisible();
|
|
await expect(page.getByText('近 7 日用量趋势')).toBeVisible();
|
|
});
|
|
|
|
test('可调整排序并删除模型', async ({ page }) => {
|
|
await page.getByRole('spinbutton', { name: 'GPT-4o排序' }).fill('2');
|
|
await expect(page.locator('.ant-table-tbody .ant-table-row').first()).toContainText('Claude-3.5-Sonnet');
|
|
|
|
const row = page.getByRole('row').filter({ hasText: 'GPT-4o' });
|
|
await row.getByRole('button', { name: '删除' }).click();
|
|
await page.getByRole('button', { name: '确 定' }).click();
|
|
await expect(page.getByText('GPT-4o', { exact: true })).toHaveCount(0);
|
|
});
|
|
});
|