整合 Enter 发送与多会话交互,保留服务端持久 Conversation Session,并补齐迁移、回归、Electron E2E 与 canonical 文档。
53 lines
2.6 KiB
TypeScript
53 lines
2.6 KiB
TypeScript
import { closeElectronApp, expect, getStableWindow, test } from './fixtures/electron';
|
|
|
|
test.describe('AI Design conversations', () => {
|
|
test('keeps generation tasks visible while conversations stay independent', async ({ launchElectronApp }) => {
|
|
const app = await launchElectronApp({
|
|
imageWorkspaceMode: 'local',
|
|
skipSetup: true,
|
|
});
|
|
|
|
try {
|
|
const page = await getStableWindow(app);
|
|
await page.getByTestId('sidebar-module-switcher-trigger').click();
|
|
await page.getByTestId('sidebar-module-painting').click();
|
|
|
|
await page.getByTestId('sidebar-create-image-project').click();
|
|
await page.getByLabel('项目名称').fill('多会话验收项目');
|
|
await page.getByRole('button', { name: '创建项目' }).click();
|
|
|
|
const conversationSelect = page.getByTestId('image-canvas-conversation-select');
|
|
await expect(conversationSelect).toBeVisible();
|
|
await expect(conversationSelect.locator('option')).toHaveCount(1);
|
|
const firstConversationId = await conversationSelect.inputValue();
|
|
|
|
const firstPrompt = '为项目设计一张蓝色星空海报';
|
|
await page.getByLabel('设计需求').fill(firstPrompt);
|
|
await page.getByRole('button', { name: '发送给设计 Agent' }).click();
|
|
await expect(page.getByTestId('image-workspace-conversation')).toContainText(firstPrompt);
|
|
await page.getByRole('button', { name: '确认并开始生成' }).click();
|
|
|
|
const task = page.locator('[data-testid^="design-task-"]').first();
|
|
await expect(task).toContainText(firstPrompt);
|
|
|
|
await page.getByRole('button', { name: '新建设计会话' }).first().click();
|
|
await expect(conversationSelect.locator('option')).toHaveCount(2);
|
|
await expect(conversationSelect).not.toHaveValue(firstConversationId);
|
|
await expect(page.getByTestId('image-workspace-conversation')).not.toContainText(firstPrompt);
|
|
await expect(task).toContainText(firstPrompt);
|
|
|
|
const secondPrompt = '这一条会话只讨论红色角色立绘';
|
|
await page.getByLabel('设计需求').fill(secondPrompt);
|
|
await page.getByRole('button', { name: '发送给设计 Agent' }).click();
|
|
await expect(page.getByTestId('image-workspace-conversation')).toContainText(secondPrompt);
|
|
|
|
await conversationSelect.selectOption(firstConversationId);
|
|
await expect(page.getByTestId('image-workspace-conversation')).toContainText(firstPrompt);
|
|
await expect(page.getByTestId('image-workspace-conversation')).not.toContainText(secondPrompt);
|
|
await expect(task).toContainText(firstPrompt);
|
|
} finally {
|
|
await closeElectronApp(app);
|
|
}
|
|
});
|
|
});
|