feat(agents): guide first helper creation and trial

This commit is contained in:
2026-09-14 21:23:45 +08:00
parent 1d00ba39bd
commit 6e6a8c92dd
16 changed files with 594 additions and 100 deletions

View File

@@ -80,19 +80,24 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
await expect(page.getByTestId('sidebar-cloud-agents-navigation')).toBeVisible();
await expect(page.getByTestId('sidebar-robot-navigation')).toHaveCount(0);
await page.getByRole('button', { name: '创建第一个智能体' }).click();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-choose-purpose.png') });
await page.getByRole('button', { name: /故事搭档/ }).click();
await page.getByRole('button', { name: '先给我提示', exact: true }).click();
await page.getByLabel('名称', { exact: true }).fill('我的写作搭档');
await page.getByLabel('用途', { exact: true }).fill('整理灵感,把想法写成清晰的文章');
await page.getByRole('button', { name: '创建草稿', exact: true }).click();
await page.screenshot({ path: testInfo.outputPath('cloud-agent-create-requirements.png') });
await page.getByRole('button', { name: '下一步:试一试', exact: true }).click();
await expect(page.getByTestId('cloud-agent-editor')).toBeVisible();
await page.getByLabel('角色与指令').fill('使用简洁自然的中文。先理解我的目的,再协助梳理结构。');
await page.getByRole('button', { name: '能力', exact: true }).click();
await page.getByLabel('模型', { exact: true }).selectOption('test-model');
await page.getByLabel('特别要求').fill('使用简洁自然的中文。先理解我的目的,再协助梳理结构。');
await expect(page.getByLabel('模型', { exact: true })).toHaveValue('test-model');
await expect(page.getByRole('button', { name: '先给我提示', exact: true })).toHaveAttribute('aria-pressed', 'true');
await page.getByTestId('sidebar-module-switcher-trigger').click();
await expect(page.getByRole('dialog', { name: '未保存的修改' })).toBeVisible();
await page.getByRole('button', { name: '继续编辑', exact: true }).click();
await page.getByRole('button', { name: '保存草稿', exact: true }).click();
await page.getByRole('button', { name: '保存并开始试用', exact: true }).click();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeVisible();
await expect(page.getByTestId('titlebar-page-title')).toHaveText('智能体工作区');
await page.getByRole('button', { name: '高级设置', exact: true }).click();
await page.getByRole('button', { name: '知识', exact: true }).click();
await page.getByText('管理我的知识文档', { exact: true }).click();
await page.getByRole('button', { name: '新建知识库', exact: true }).click();
@@ -109,8 +114,11 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
await expect(page.getByText('管理员配置说明', { exact: true })).toHaveCount(0);
await page.getByLabel('知识库名称', { exact: true }).fill('');
await page.getByRole('button', { name: '新建知识库', exact: true }).click();
await page.getByRole('button', { name: '指令', exact: true }).click();
await page.getByRole('button', { name: '我的要求', exact: true }).click();
const preview = page.getByRole('region', { name: '草稿预览', exact: true });
await preview.getByRole('button', { name: '你可以怎样帮助我?请举一个例子。', exact: true }).click();
await expect(preview.getByLabel('消息')).toHaveValue('你可以怎样帮助我?请举一个例子。');
await expect(preview.getByRole('heading', { name: '创作建议' })).toHaveCount(0);
await preview.getByLabel('消息').fill('先给我一些创作建议');
await preview.getByLabel('消息').press('Enter');
await expect(preview.getByRole('heading', { name: '创作建议' })).toBeAttached();
@@ -123,12 +131,12 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
await preview.getByLabel('消息').fill('保存后继续的问题');
await preview.getByLabel('消息').press('F6');
await expect(page.getByRole('region', { name: '草稿配置', exact: true }).getByRole('button', { name: '展开配置' })).toBeFocused();
await page.getByLabel('角色与指令').fill('使用简洁自然的中文。先理解我的目的,再协助梳理结构。补充具体例子。');
await page.getByLabel('角色与指令').press('Control+s');
await page.getByLabel('特别要求').fill('使用简洁自然的中文。先理解我的目的,再协助梳理结构。补充具体例子。');
await page.getByLabel('特别要求').press('Control+s');
await expect(page.getByText('云端已保存', { exact: true })).toBeVisible();
await expect(preview.getByLabel('消息')).toHaveValue('保存后继续的问题');
await expect(preview.getByRole('heading', { name: '创作建议' })).toBeAttached();
await expect(preview.getByText('草稿预览 · 修订 2')).toBeVisible();
await expect(preview.getByText('当前试用 · 修订 2')).toBeVisible();
const divider = page.getByRole('separator', { name: '调整配置与试用宽度' });
await divider.focus();
const previousRatio = Number(await divider.getAttribute('aria-valuenow'));
@@ -162,22 +170,33 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
}
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].webContents.setZoomFactor(1));
await preview.getByRole('button', { name: '用最新草稿试用' }).click();
await expect(preview.getByText('草稿预览 · 修订 3')).toBeVisible();
await expect(preview.getByText('当前试用 · 修订 3')).toBeVisible();
await expect(preview.getByLabel('消息')).toHaveValue('保存后继续的问题');
await preview.getByText('对比上一次试用 · 修订 2', { exact: true }).click();
await expect(preview.getByRole('heading', { name: '创作建议' })).toBeVisible();
await preview.getByText('对比上一次试用 · 修订 2', { exact: true }).click();
await page.getByRole('button', { name: '简单易懂', exact: true }).click();
await preview.getByRole('button', { name: '保存并重新试用', exact: true }).click();
await expect(preview.getByText('当前试用 · 修订 4')).toBeVisible();
await expect(preview.getByLabel('消息')).toHaveValue('保存后继续的问题');
await preview.getByLabel('消息').fill('');
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(page.getByTestId('cloud-agent-editor')).toBeVisible();
await expect(page.getByLabel('角色与指令')).toHaveValue('使用简洁自然的中文。先理解我的目的,再协助梳理结构。补充具体例子。');
await expect(page.getByLabel('特别要求')).toHaveValue('使用简洁自然的中文。先理解我的目的,再协助梳理结构。补充具体例子。');
await page.getByRole('button', { name: '高级设置', exact: true }).click();
await page.getByRole('button', { name: '限制', exact: true }).click();
await page.getByLabel('每次任务上限(词元点数)').fill('2.50');
await page.getByLabel('每日上限(词元点数)').fill('10.00');
await page.getByRole('button', { name: '保存费用上限' }).click();
await expect(page.getByRole('button', { name: '保存费用上限' })).toBeDisabled();
await page.getByRole('button', { name: '发布与访问', exact: true }).click();
await page.getByRole('button', { name: '发布当前草稿' }).click();
await expect(page.getByText('当前发布版本 1')).toBeVisible();
await page.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: '确认开始使用' }).click();
await expect(page.getByRole('region', { name: '智能体对话', exact: true })).toBeVisible();
await expect(page.getByRole('region', { name: '智能体对话', exact: true }).getByRole('heading', { name: '创作建议' })).toHaveCount(0);
await page.getByRole('button', { name: '对话', exact: true }).click();
await page.getByRole('region', { name: '智能体对话', exact: true }).getByLabel('消息', { exact: true }).fill('每天早上八点半给我三个创作方向');
await page.getByRole('region', { name: '智能体对话', exact: true }).getByRole('button', { name: '发送', exact: true }).click();