修复 AGC 运行时配置模型方案测试断言
将推理档断言迁移到模型方案管理面板的推理档位选择器 补充持久化测试 fixture 的 modelProfiles 与选中方案字段 同步保存回写断言中的模型方案结构
This commit is contained in:
@@ -725,9 +725,17 @@ export function registerRuntimeSettingsTests() {
|
||||
expect(
|
||||
await screen.findByRole('dialog', { name: '运行时配置' }),
|
||||
).not.toBeNull();
|
||||
fireEvent.keyDown(screen.getByLabelText('推理档'), {
|
||||
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
|
||||
expect(
|
||||
await screen.findByRole('dialog', { name: '模型方案管理' }),
|
||||
).not.toBeNull();
|
||||
fireEvent.keyDown(screen.getByLabelText('陶泥儿智能创作 显示名称'), {
|
||||
key: 'Escape',
|
||||
});
|
||||
expect(screen.getByRole('dialog', { name: '模型方案管理' })).not.toBeNull();
|
||||
|
||||
fireEvent.keyDown(window, { key: 'Escape' });
|
||||
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
|
||||
expect(screen.getByRole('dialog', { name: '运行时配置' })).not.toBeNull();
|
||||
|
||||
fireEvent.keyDown(window, { key: 'Escape' });
|
||||
@@ -869,6 +877,16 @@ export function registerPublishedRuntimeSettingsTests() {
|
||||
baseUrl: 'http://127.0.0.1:8082',
|
||||
apiKey: 'editor-loaded-secret',
|
||||
},
|
||||
modelProfiles: [
|
||||
{
|
||||
id: 'default',
|
||||
name: '陶泥儿智能创作',
|
||||
modelId: 'gpt-test',
|
||||
enabled: true,
|
||||
reasoningEffort: 'medium',
|
||||
},
|
||||
],
|
||||
selectedModelProfileId: 'default',
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -933,12 +951,24 @@ export function registerPublishedRuntimeSettingsTests() {
|
||||
expect(screen.getByText('已启用')).not.toBeNull();
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /常用设置/ }));
|
||||
expect(screen.getByLabelText('推理档')).toHaveProperty('value', 'medium');
|
||||
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
|
||||
await screen.findByRole('dialog', {
|
||||
name: '模型方案管理',
|
||||
});
|
||||
const reasoningSelect = screen.getByLabelText('陶泥儿智能创作 推理档位');
|
||||
expect(reasoningSelect.textContent).toContain('medium');
|
||||
fireEvent.click(reasoningSelect);
|
||||
expect(
|
||||
within(screen.getByLabelText('推理档')).getByRole('option', {
|
||||
within(
|
||||
screen.getByRole('listbox', {
|
||||
name: '陶泥儿智能创作 推理档位',
|
||||
}),
|
||||
).getByRole('option', {
|
||||
name: 'max',
|
||||
}),
|
||||
).not.toBeNull();
|
||||
fireEvent.click(screen.getByRole('button', { name: '完成' }));
|
||||
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
|
||||
fireEvent.click(screen.getByLabelText('流式输出'));
|
||||
fireEvent.click(screen.getByLabelText('联网检索'));
|
||||
fireEvent.click(screen.getByRole('button', { name: /高级参数/ }));
|
||||
@@ -997,6 +1027,16 @@ export function registerPublishedRuntimeSettingsTests() {
|
||||
baseUrl: 'https://dev.genarrative.world',
|
||||
apiKey: '',
|
||||
},
|
||||
modelProfiles: [
|
||||
{
|
||||
id: 'default',
|
||||
name: '陶泥儿智能创作',
|
||||
modelId: 'gpt-test',
|
||||
enabled: true,
|
||||
reasoningEffort: 'medium',
|
||||
},
|
||||
],
|
||||
selectedModelProfileId: 'default',
|
||||
},
|
||||
});
|
||||
expect(JSON.stringify(persistedConfig)).not.toContain(
|
||||
@@ -1058,7 +1098,15 @@ export function registerPublishedRuntimeSettingsTests() {
|
||||
expect(screen.queryByLabelText('LLM API Key')).toBeNull();
|
||||
expect(screen.queryByLabelText('LLM Base URL')).toBeNull();
|
||||
expect(screen.queryByLabelText('LLM 模型')).toBeNull();
|
||||
expect(screen.getByLabelText('推理档')).toHaveProperty('value', 'max');
|
||||
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
|
||||
await screen.findByRole('dialog', {
|
||||
name: '模型方案管理',
|
||||
});
|
||||
expect(
|
||||
screen.getByLabelText('陶泥儿智能创作 推理档位').textContent,
|
||||
).toContain('max');
|
||||
fireEvent.click(screen.getByRole('button', { name: '完成' }));
|
||||
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
|
||||
expect(screen.getByLabelText('联网检索')).toHaveProperty('checked', true);
|
||||
fireEvent.click(screen.getByRole('button', { name: /Agent 分工/ }));
|
||||
expect(screen.getByText('已启用')).not.toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user