Refine personal Agent cards and configuration

This commit is contained in:
鲨鱼辣椒 committed 2026-10-12 17:45:02 +08:00
1 parent c14d996c05
commit 8b40463a9f
17 files changed
+555 -412

No files matched your search

+59 -225
View File
@@ -136,280 +136,114 @@ test('personal cloud Agent identity, configuration and separate published chat i
await page.getByRole('button', { name: '下一步', exact: true }).click();
const editor = page.getByTestId('cloud-agent-editor');
const workspaceNavigation = page.getByRole('navigation', { name: '智能体工作区' });
const configurationButton = workspaceNavigation.getByRole('button', { name: '配置', exact: true });
const chatButton = workspaceNavigation.getByRole('button', { name: '聊天', exact: true });
const instructionsTab = page.getByRole('tab', { name: '模型与提示词', exact: true });
const instructionsTab = page.getByRole('tab', { name: '介绍与提示词', exact: true });
const advancedTab = page.getByRole('tab', { name: '高级设置', exact: true });
const prompt = page.getByLabel('提示词', { exact: true });
const initialPrompt = '使用简洁自然的中文。先理解我的目的,再协助梳理结构。';
const revisedPrompt = initialPrompt + '补充具体例子。';
const introduction = page.getByLabel('一句话介绍', { exact: true });
const initialPrompt = ' 使用简洁自然的中文。\n先理解我的目的,再协助梳理结构。 ';
await expect(editor).toBeVisible();
await expect(page.getByTestId('titlebar-page-title')).toHaveText('智能体工作区');
await expect(page.getByTestId('titlebar-page-title')).toHaveText('我的智能体');
await expect(page.getByLabel('名称', { exact: true })).toHaveValue('我的写作搭档');
await page.getByRole('button', { name: '修改名称', exact: true }).click();
await expect(page.getByLabel('名称', { exact: true })).toBeFocused();
await expect(page.getByRole('button', { name: '修改头像', exact: true }).getByRole('img')).toHaveAttribute('src', avatar.icon_url);
await expect(configurationButton).toHaveAttribute('aria-current', 'page');
await expect(introduction).toHaveValue('');
await expect(prompt).toHaveValue('');
await expect(page.getByLabel('模型', { exact: true })).toHaveValue('test-model');
expect(await page.getByLabel('模型', { exact: true }).evaluate(el => Boolean(el.compareDocumentPosition(window.document.querySelector('textarea[aria-label="提示词"]')!) & Node.DOCUMENT_POSITION_FOLLOWING))).toBe(true);
await expect(page.getByLabel('用途', { exact: true })).toHaveCount(0);
await expect(page.getByLabel('特别要求')).toHaveCount(0);
await expect(page.getByText('模型说明不应显示在配置页', { exact: true })).toHaveCount(0);
await expect(page.getByText(/9\.99/)).toHaveCount(0);
await expect(page.getByRole('button', { name: /先给我提示|简单易懂|条理清楚|详细深入/ })).toHaveCount(0);
await expect(page.getByLabel('模型', { exact: true })).toBeHidden();
await expect(page.getByRole('button', { name: /^(聊天|自动任务|使用与接入)$/ })).toHaveCount(0);
await expect(page.getByRole('region', { name: '草稿预览', exact: true })).toHaveCount(0);
await expect(page.getByRole('separator', { name: '调整配置与试用宽度' })).toHaveCount(0);
await expect(page.getByLabel('消息', { exact: true })).toHaveCount(0);
await expect(page.getByText(/9\.99|模型说明不应显示在配置页/)).toHaveCount(0);
const created = await fixtureState();
expect(created.createInput).toMatchObject({ name: '我的写作搭档', icon: avatar.icon });
expect(created.createInput).toMatchObject({ name: '我的写作搭档', icon: avatar.icon, purpose: '' });
expect(created.createInput).not.toHaveProperty('icon_url');
expect(created.createInput.purpose).toBeTruthy();
expect(created.draft).toMatchObject({ name: '我的写作搭档', icon: avatar.icon, icon_url: avatar.icon_url, published_version: null });
expect(await messageOperations()).toEqual([]);
await page.getByRole('button', { name: '修改头像', exact: true }).click();
const avatarDialog = page.getByRole('dialog', { name: '修改头像', exact: true });
await expect(avatarDialog.getByRole('img', { name: '我的写作搭档头像', exact: true })).toHaveAttribute('src', avatar.icon_url);
await avatarDialog.getByRole('button', { name: '完成', exact: true }).click();
await introduction.fill('一起梳理故事和文章');
await prompt.fill(initialPrompt);
await page.getByRole('button', { name: '开始使用', exact: true }).click();
await expect(advancedTab).toHaveAttribute('aria-selected', 'true');
await expect(page.getByRole('button', { name: '模型', exact: true })).toHaveAttribute('aria-current', 'page');
await expect(page.getByLabel('模型', { exact: true })).toBeVisible();
await expect(page.getByLabel('模型', { exact: true })).toHaveValue('');
await expect(page.getByLabel('模型', { exact: true })).toHaveAttribute('required', '');
await expect(page.getByRole('button', { name: '确认开始使用', exact: true })).toHaveCount(0);
expect((await fixtureState()).operations).not.toContain('publish');
await page.getByLabel('模型', { exact: true }).selectOption('reasoning-model');
await page.getByRole('button', { name: '能力', exact: true }).click();
await page.getByRole('button', { name: '选择工具', exact: true }).click();
await page.getByRole('checkbox', { name: '资料整理工具', exact: true }).check();
await instructionsTab.click();
await expect(introduction).toHaveValue('一起梳理故事和文章');
await expect(prompt).toHaveValue(initialPrompt);
await expect(page.getByLabel('模型', { exact: true })).toBeHidden();
await page.getByTestId('sidebar-module-switcher-trigger').click();
await expect(page.getByRole('dialog', { name: '未保存的修改' })).toBeVisible();
await page.getByRole('button', { name: '继续编辑', exact: true }).click();
await expect(prompt).toHaveValue(initialPrompt);
await expect(page.getByLabel('模型', { exact: true })).toHaveValue('reasoning-model');
await expect(instructionsTab).toHaveAttribute('aria-selected', 'true');
await expect(page.getByRole('navigation', { name: '配置分类' })).toHaveCount(0);
await instructionsTab.focus();
await instructionsTab.press('ArrowRight');
await expect(advancedTab).toBeFocused();
await expect(advancedTab).toHaveAttribute('aria-selected', 'true');
await expect(page.getByRole('tabpanel', { name: '高级设置' })).toBeVisible();
await expect(prompt).toBeHidden();
await expect(page.getByRole('button', { name: '能力', exact: true })).toHaveAttribute('aria-current', 'page');
await page.getByRole('button', { name: '选择工具', exact: true }).click();
await page.getByRole('checkbox', { name: '资料整理工具', exact: true }).check();
await page.getByRole('button', { name: '完成选择', exact: true }).click();
await page.getByText('管理我的云端能力', { exact: true }).click();
await page.getByRole('button', { name: '添加 MCP', exact: true }).click();
await page.getByLabel('连接名称', { exact: true }).fill('尚未保存的资料连接');
await page.getByLabel('连接地址', { exact: true }).fill('https://example.com/mcp');
await instructionsTab.click();
await expect(prompt).toHaveValue(initialPrompt);
await advancedTab.click();
await expect(page.getByLabel('连接名称', { exact: true })).toHaveValue('尚未保存的资料连接');
await expect(page.getByLabel('连接地址', { exact: true })).toHaveValue('https://example.com/mcp');
await expect(page.getByRole('checkbox', { name: '资料整理工具', exact: true })).toBeChecked();
await chatButton.click();
await expect(page.getByText('保存配置后,开始使用这个智能体。', { exact: true })).toBeVisible();
await expect(page.getByLabel('消息', { exact: true })).toHaveCount(0);
await configurationButton.click();
await expect(page.getByLabel('连接名称', { exact: true })).toHaveValue('尚未保存的资料连接');
await page.getByRole('button', { name: '返回能力列表', exact: true }).click();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-advanced-tab.png') });
const configurationScroll = page.getByRole('tabpanel').locator('.agent-config-scroll');
await configurationScroll.evaluate(el => { el.scrollTop = el.scrollHeight; });
await expect.poll(() => configurationScroll.evaluate(el => el.scrollTop)).toBeGreaterThan(0);
await instructionsTab.click();
await expect.poll(() => configurationScroll.evaluate(el => el.scrollTop)).toBe(0);
await expect(page.getByLabel('模型', { exact: true })).toBeInViewport();
await expect(prompt).toBeInViewport();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-model-prompt-tab.png') });
await advancedTab.click();
await expect.poll(() => configurationScroll.evaluate(el => el.scrollTop)).toBe(0);
await page.getByRole('button', { name: '知识', exact: true }).click();
await page.getByText('管理我的知识文档', { exact: true }).click();
const knowledgeDescription = page.getByText(/上传到知识库的文档可供/);
await expect(knowledgeDescription).toContainText('embedding 向量化由平台承担,不计入用户用量、词元点数或智能体费用上限');
await expect(knowledgeDescription).toContainText('知识处理如触发对话模型调用,仍按原模型实际用量计费');
await page.getByRole('button', { name: '新建知识库', exact: true }).click();
await expect(page.getByLabel('向量模型', { exact: true })).toBeDisabled();
await page.getByText('管理员配置说明', { exact: true }).click();
await expect(page.getByText(/Embedding 只在 Yuxi 配置/)).toBeVisible();
await expect(page.getByText(/Yuxi 后台/)).toContainText('智能体管理 → 模型供应商');
await expect(page.getByText(/Yuxi 后台/)).toContainText('服务地址和 API Key');
await expect(page.getByText(/Works Square 运营后台|one-api/)).toHaveCount(0);
await page.getByLabel('知识库名称', { exact: true }).fill('我的创作资料');
await instructionsTab.click();
await expect(page.getByRole('navigation', { name: '配置分类' })).toHaveCount(0);
await expect(prompt).toHaveValue(initialPrompt);
await advancedTab.click();
await expect(page.getByRole('button', { name: '知识', exact: true })).toHaveAttribute('aria-current', 'page');
await expect(page.getByLabel('知识库名称', { exact: true })).toHaveValue('我的创作资料');
await page.screenshot({ path: testInfo.outputPath('knowledge-empty.png') });
await page.getByRole('button', { name: '刷新知识库与模型', exact: true }).click();
await page.getByLabel('向量模型', { exact: true }).selectOption('fixture:test-embedding');
await expect(page.getByLabel('知识库名称', { exact: true })).toHaveValue('我的创作资料');
await expect(page.getByRole('button', { name: '创建并选用', exact: true })).toBeEnabled();
await expect(page.getByText('管理员配置说明', { exact: true })).toHaveCount(0);
await page.getByRole('button', { name: '创建并选用', exact: true }).click();
await expect(page.getByText('上传第一份文档,让智能体用你的资料回答。')).toBeVisible();
await page.getByRole('button', { name: '上传文档', exact: true }).click();
const document = page.getByRole('article', { name: '本体(Ontology)学习路线图.pdf' });
await expect(document.getByText('等待处理', { exact: true })).toBeVisible();
await expect(page.getByText('没有可用内容', { exact: true })).toBeVisible();
await document.scrollIntoViewIfNeeded();
await page.screenshot({ path: testInfo.outputPath('knowledge-queued.png') });
await expect(document.getByText('正在解析文档', { exact: true })).toBeVisible();
await expect(document.getByText('正在建立索引', { exact: true })).toBeVisible();
await expect(document.getByText('可用于回答', { exact: true })).toBeVisible();
await expect(document.getByText(/18 段可检索内容/)).toBeVisible();
await document.scrollIntoViewIfNeeded();
expect(await document.evaluate(el => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
await page.screenshot({ path: testInfo.outputPath('knowledge-ready.png') });
await page.getByRole('button', { name: '限制', exact: true }).click();
await page.getByLabel('每次任务上限(词元点数)').fill('2.50');
await page.getByLabel('每日上限(词元点数)').fill('10.00');
await page.getByLabel('最多执行步数', { exact: true }).fill('60');
await advancedTab.focus();
await advancedTab.press('ArrowLeft');
await expect(instructionsTab).toBeFocused();
await expect(instructionsTab).toHaveAttribute('aria-selected', 'true');
await expect(page.getByLabel('每日上限(词元点数)')).toBeHidden();
await expect(prompt).toHaveValue(initialPrompt);
await instructionsTab.press('ArrowRight');
await expect(page.getByRole('button', { name: '限制', exact: true })).toHaveAttribute('aria-current', 'page');
await expect(page.getByLabel('每次任务上限(词元点数)')).toHaveValue('2.50');
await expect(page.getByLabel('每日上限(词元点数)')).toHaveValue('10.00');
await expect(page.getByLabel('最多执行步数', { exact: true })).toHaveValue('60');
await chatButton.click();
await configurationButton.click();
await expect(page.getByLabel('每日上限(词元点数)')).toHaveValue('10.00');
await page.getByRole('button', { name: '保存费用上限' }).click();
await expect(page.getByRole('button', { name: '保存费用上限' })).toBeDisabled();
await instructionsTab.click();
await page.getByRole('button', { name: '保存草稿', exact: true }).click();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeDisabled();
expect((await fixtureState()).draft).toMatchObject({
name: '我的写作搭档', icon: avatar.icon, icon_url: avatar.icon_url, system_prompt: initialPrompt, published_version: null,
configuration: { model: 'reasoning-model', tools: ['fixture-tool'], knowledges: ['kb'], max_execution_steps: 60 },
});
expect(await messageOperations()).toEqual([]);
await prompt.fill(revisedPrompt);
await prompt.press('Control+s');
await expect(page.getByText('云端已保存', { exact: true })).toBeVisible();
expect((await fixtureState()).draft.system_prompt).toBe(revisedPrompt);
expect(await messageOperations()).toEqual([]);
await page.getByTestId('sidebar-module-switcher-trigger').click();
await expect(page.getByTestId('ai-module-selection-page')).toBeVisible();
await page.getByTestId('ai-module-option-cloud_agents').click();
await expect(editor).toBeVisible();
await expect(configurationButton).toHaveAttribute('aria-current', 'page');
await expect(prompt).toHaveValue(revisedPrompt);
expect((await fixtureState()).draft).toMatchObject({ purpose: '一起梳理故事和文章', system_prompt: initialPrompt, configuration: { model: 'reasoning-model', tools: ['fixture-tool'] } });
await editor.getByRole('button', { name: '我的智能体', exact: true }).click();
const card = page.getByRole('article', { name: '我的写作搭档', exact: true });
await expect(card.getByText('一起梳理故事和文章', { exact: true })).toBeVisible();
await card.getByRole('button', { name: '继续制作', exact: true }).click();
await introduction.fill('');
await page.getByRole('button', { name: '保存草稿', exact: true }).click();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeDisabled();
await editor.getByRole('button', { name: '我的智能体', exact: true }).click();
await expect(card.getByText('一起梳理故事和文章', { exact: true })).toHaveCount(0);
await expect(card.locator('.agent-home-purpose')).toHaveCount(0);
await card.getByRole('button', { name: '继续制作', exact: true }).click();
await expect(introduction).toHaveValue('');
await expect(prompt).toHaveValue(initialPrompt);
await advancedTab.click();
await expect(page.getByRole('button', { name: '模型', exact: true })).toHaveAttribute('aria-current', 'page');
await expect(page.getByLabel('模型', { exact: true })).toHaveValue('reasoning-model');
await expect(page.getByRole('button', { name: '修改头像', exact: true }).getByRole('img')).toHaveAttribute('src', avatar.icon_url);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-advanced-model.png') });
await instructionsTab.click();
await app.evaluate(({ BrowserWindow }) => { const win = BrowserWindow.getAllWindows()[0]; win.setMinimumSize(800, 600); win.setSize(980, 680); });
await expect(introduction).toBeInViewport();
await expect(prompt).toBeInViewport();
await expect(configurationButton).toBeInViewport();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeInViewport();
await expect(page.getByRole('region', { name: '草稿预览', exact: true })).toHaveCount(0);
await expect(page.getByLabel('消息', { exact: true })).toHaveCount(0);
await expect.poll(() => editor.evaluate(el => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-config-compact.png') });
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(1366, 768));
for (const factor of [1.25, 1.5]) {
await app.evaluate(({ BrowserWindow }, zoom) => BrowserWindow.getAllWindows()[0].webContents.setZoomFactor(zoom), factor);
await expect(configurationButton).toBeInViewport();
await expect(page.getByLabel('模型', { exact: true })).toBeInViewport();
await expect(introduction).toBeInViewport();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeInViewport();
await expect.poll(() => editor.evaluate(el => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
}
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].webContents.setZoomFactor(1));
await page.screenshot({ path: testInfo.outputPath('cloud-agent-config.png') });
await app.evaluate(({ BrowserWindow }) => { const win = BrowserWindow.getAllWindows()[0]; win.webContents.setZoomFactor(1); win.setSize(1366, 768); });
await page.screenshot({ path: testInfo.outputPath('cloud-agent-introduction-prompt.png') });
expect(await messageOperations()).toEqual([]);
await workspaceNavigation.getByRole('button', { name: '使用与接入', exact: true }).click();
await expect(page.getByLabel('应用名称')).toHaveCount(0);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-start-private-use.png') });
await page.getByRole('button', { name: '开始使用', exact: true }).click();
await page.getByRole('button', { name: '确认开始使用', exact: true }).click();
const formalChat = page.getByRole('region', { name: '智能体对话', exact: true });
await expect(formalChat).toBeVisible();
await expect(chatButton).toHaveAttribute('aria-current', 'page');
await expect(prompt).toBeHidden();
await expect(formalChat.getByRole('heading', { name: '创作建议' })).toHaveCount(0);
expect((await fixtureState()).operations.filter((operation: string) => operation === 'publish')).toHaveLength(1);
expect(await messageOperations()).toEqual([]);
await formalChat.getByRole('button', { name: '你可以怎样帮助我?请举一个例子。', exact: true }).click();
await expect(formalChat.getByLabel('消息', { exact: true })).toHaveValue('你可以怎样帮助我?请举一个例子。');
expect(await messageOperations()).toEqual([]);
await formalChat.getByLabel('消息', { exact: true }).fill('先给我一些创作建议');
await formalChat.getByRole('button', { name: '发送', exact: true }).click();
await expect(formalChat.getByRole('heading', { name: '创作建议' })).toBeAttached();
expect(await messageOperations()).toEqual(['submit']);
const composer = formalChat.getByTestId('cloud-chat-composer');
const beforeScroll = await composer.boundingBox();
await formalChat.getByTestId('cloud-chat-messages').evaluate(el => { el.scrollTop = 0; });
await expect.poll(async () => (await composer.boundingBox())?.y).toBe(beforeScroll?.y);
await expect.poll(() => page.getByTestId('main-content').evaluate(el => el.scrollHeight - el.clientHeight)).toBeLessThanOrEqual(1);
expect(beforeScroll!.y + beforeScroll!.height).toBeLessThanOrEqual(await page.evaluate(() => innerHeight));
await formalChat.getByLabel('消息', { exact: true }).fill('保存后继续的问题');
await configurationButton.click();
await expect(prompt).toHaveValue(revisedPrompt);
await expect(formalChat).toBeHidden();
await expect(page.getByLabel('消息', { exact: true })).toBeHidden();
await expect(page.getByRole('region', { name: '草稿预览', exact: true })).toHaveCount(0);
await page.getByRole('button', { name: '调整智能体', exact: true }).click();
await expect(prompt).toHaveValue(initialPrompt);
await page.getByLabel('名称', { exact: true }).fill('我的新版写作搭档');
await expect(page.getByRole('button', { name: '应用最新修改', exact: true })).toBeDisabled();
await page.getByRole('button', { name: '保存草稿', exact: true }).click();
await expect(page.getByText('修改已保存,尚未应用', { exact: true })).toBeVisible();
const applyButton = page.getByRole('button', { name: '应用最新修改', exact: true });
await expect(applyButton).toBeInViewport();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-apply-visible.png') });
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(1024, 768));
await expect(applyButton).toBeInViewport();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-apply-compact.png') });
await applyButton.click();
await page.getByRole('button', { name: '应用最新修改', exact: true }).click();
await expect(page.getByRole('button', { name: '已应用', exact: true })).toBeDisabled();
await expect(page.getByText('修改已保存,尚未应用', { exact: true })).toHaveCount(0);
await chatButton.click();
await expect(formalChat.getByLabel('消息', { exact: true })).toHaveValue('保存后继续的问题');
await expect(formalChat.getByRole('heading', { name: '创作建议' })).toBeAttached();
await editor.getByRole('button', { name: '我的智能体', exact: true }).click();
await page.getByRole('article', { name: '我的新版写作搭档', exact: true }).getByRole('button', { name: '和它聊聊', exact: true }).click();
await expect(formalChat).toBeVisible();
await expect(page.getByRole('button', { name: /^(聊天|自动任务|使用与接入)$/ })).toHaveCount(0);
expect(await messageOperations()).toEqual(['submit']);
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(980, 680));
await expect.poll(async () => {
const bounds = await composer.boundingBox();
return bounds!.y + bounds!.height - await page.evaluate(() => innerHeight);
}).toBeLessThanOrEqual(0);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-chat-compact.png') });
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(1366, 768));
for (const factor of [1.25, 1.5]) {
await app.evaluate(({ BrowserWindow }, zoom) => BrowserWindow.getAllWindows()[0].webContents.setZoomFactor(zoom), factor);
await expect.poll(async () => { const bounds = await composer.boundingBox(); return bounds!.y + bounds!.height - await page.evaluate(() => innerHeight); }).toBeLessThanOrEqual(0);
await expect(formalChat.getByLabel('消息', { exact: true })).toHaveValue('保存后继续的问题');
}
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].webContents.setZoomFactor(1));
await workspaceNavigation.getByRole('button', { name: '使用与接入', exact: true }).click();
await expect(page.getByRole('heading', { name: '应用与 API', exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: '打开渠道', exact: true })).toBeVisible();
await expect(page.getByLabel('应用名称')).toBeVisible();
await expect(page.getByRole('heading', { name: '分享给指定用户', exact: true })).toHaveCount(0);
await expect(page.getByLabel('查找分享用户')).toHaveCount(0);
await expect(page.getByRole('button', { name: '复制分享链接', exact: true })).toHaveCount(0);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-access-without-user-sharing.png') });
await chatButton.click();
await expect(formalChat.getByLabel('消息', { exact: true })).toHaveValue('保存后继续的问题');
await formalChat.getByLabel('消息', { exact: true }).fill('每天早上八点半给我三个创作方向');
await formalChat.getByRole('button', { name: '发送', exact: true }).click();
await expect(formalChat.getByLabel('消息', { exact: true })).toHaveValue('');
await expect(formalChat.getByRole('heading', { name: '创作建议' })).toBeAttached();
expect(await messageOperations()).toEqual(['submit', 'submit']);
await page.getByRole('button', { name: '查看并配置自动任务' }).click();
await expect(workspaceNavigation.getByRole('button', { name: '自动任务', exact: true })).toHaveAttribute('aria-current', 'page');
await expect(page.getByLabel('任务名称')).toHaveValue('每天整理选题');
await expect(page.getByLabel('执行时间')).toHaveValue('08:30');
await expect(page.getByLabel('保存后启用')).not.toBeChecked();
await page.getByLabel('保存后启用').check();
await expect(page.getByText('启用前确认')).toBeVisible();
await page.getByRole('button', { name: '保存并启用' }).click();
await expect(page.getByRole('heading', { name: '每天整理选题' })).toBeVisible();
await expect(page.getByText(/每天 08:30/)).toBeVisible();
await page.getByRole('button', { name: '添加任务', exact: true }).click();
await expect(page.getByLabel('保存后启用')).not.toBeChecked();
await page.getByRole('button', { name: '取消', exact: true }).click();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-schedules.png') });
expect(await messageOperations()).toEqual(['submit', 'submit']);
await page.screenshot({ path: testInfo.outputPath('cloud-agent-separate-chat.png') });
} finally {
await app.evaluate(({ BrowserWindow }) => { for (const win of BrowserWindow.getAllWindows()) win.destroy(); }).catch(() => undefined);
await closeElectronApp(app);