feat: improve project agent onboarding

This commit is contained in:
2026-09-06 13:54:20 +08:00
parent a4fc3a5251
commit df02680f9d
15 changed files with 826 additions and 74 deletions

View File

@@ -35,7 +35,11 @@ test.describe('Project configuration skills', () => {
await expect(page.getByTestId('project-configuration-actions')).toBeVisible();
const actionBarBottomGap = await page.getByTestId('project-configuration-actions').evaluate((element) => window.innerHeight - element.getBoundingClientRect().bottom);
expect(actionBarBottomGap).toBeLessThan(40);
await expect(page.getByRole('button', { name: '创建智能体' })).toBeVisible();
const setupCallout = page.getByTestId('project-agent-setup-callout');
await expect(setupCallout).toContainText('项目已创建,还差 1 步');
await expect(setupCallout).toContainText('必需');
await expect(page.getByTestId('project-agent-setup-primary')).toHaveText('先配置模型');
await expect(page.getByTestId('project-configuration-back-button')).toHaveAccessibleName('稍后设置');
for (const [resourceId, title] of [
['resource-card-models', '可用模型'],
@@ -48,6 +52,7 @@ test.describe('Project configuration skills', () => {
if (resourceId === 'resource-card-models') {
await expect(drawer.getByRole('combobox')).toHaveCount(0);
await expect(drawer.locator('[data-testid="project-model-list"], [data-testid="project-model-empty-state"]')).toHaveCount(1);
await expect(drawer.getByRole('button', { name: '前往模型设置' })).toBeVisible();
}
const closeButton = drawer.getByRole('button', { name: '关闭' });
const closeGeometry = await closeButton.evaluate((button) => {
@@ -73,6 +78,15 @@ test.describe('Project configuration skills', () => {
const now = new Date().toISOString();
await mkdir(path.join(parentPath, '.makelore'), { recursive: true });
await writeFile(path.join(parentPath, '.makelore', 'project.json'), JSON.stringify({
...createCodingProjectConfigV2(now, 'interactive_ai_app'),
initialized: true,
agents: [],
}, null, 2));
await page.evaluate(() => { window.location.hash = '#/chat'; });
await expect(page.getByTestId('project-configuration-page')).toBeVisible();
await expect(page.getByTestId('project-agent-setup-callout')).toBeVisible();
await writeFile(path.join(parentPath, '.makelore', 'project.json'), JSON.stringify({
...createCodingProjectConfigV2(now, 'interactive_ai_app'),
initialized: true,
@@ -96,6 +110,11 @@ test.describe('Project configuration skills', () => {
}, null, 2));
await page.reload();
await expect(page.getByTestId('project-configuration-page')).toBeVisible();
await expect(page.getByTestId('project-configuration-back-button')).toHaveAccessibleName('返回对话');
await page.getByTestId('project-configuration-back-button').click();
await expect(page.getByTestId('chat-operation-page')).toBeVisible();
await page.evaluate(() => { window.location.hash = '#/project-config'; });
await expect(page.getByTestId('project-configuration-page')).toBeVisible();
await page.getByTestId('resource-card-skills').click();
await expect(page.getByTestId('superpowers-card')).toHaveCount(0);
@@ -163,6 +182,7 @@ test.describe('Project configuration skills', () => {
await expect(avatarDialog).toHaveCount(0);
await expect(maintenanceDialog.getByAltText('当前上传头像')).toBeVisible();
await expect(page.getByText('完成配置')).toHaveCount(0);
await maintenanceDialog.getByRole('button', { name: '取消' }).click();
} finally {
await closeElectronApp(app);
await rm(parentPath, { recursive: true, force: true });