feat(design): integrate conversation-first creation flow
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
brother7 committed 2026-09-04 07:39:58 +08:00
1 parent 14efa99f0c
commit 945b40de11
14 files changed
+374 -234

No files matched your search

+42 -6
View File
@@ -61,7 +61,7 @@ function prepareWorkspace(overrides = {}) {
}
function openMobileCreationCard() {
fireEvent.click(screen.getByRole('button', { name: /^我的创作/ }));
fireEvent.click(screen.getByRole('button', { name: /^当前想法与作品/ }));
}
describe('youth AI Design Canvas page', () => {
@@ -76,28 +76,62 @@ describe('youth AI Design Canvas page', () => {
useImageWorkspaceStore.getState().reset();
});
it('starts with conversation and a concise Creation Card instead of a professional field matrix', () => {
it('starts with a guided conversation and keeps the structured summary secondary', () => {
prepareWorkspace();
render(<ImageCanvas />);
expect(screen.getByTestId('image-workspace-conversation')).toBeInTheDocument();
expect(screen.getByRole('heading', { name: '一起做作品' })).toBeInTheDocument();
expect(screen.getByRole('heading', { name: '和 AI 聊聊你的想法' })).toBeInTheDocument();
expect(screen.getByText('像和同学讲故事一样说就好。AI 会先听懂,再一次问一个最重要的问题。')).toBeInTheDocument();
openMobileCreationCard();
const card = screen.getByTestId('youth-creation-card');
expect(card).toBeInTheDocument();
expect(within(card).getByRole('heading', { name: '我的创作' })).toBeInTheDocument();
expect(within(card).getByRole('heading', { name: 'AI 听懂的想法' })).toBeInTheDocument();
expect(screen.getByText('做一张便携咖啡机的小红书主视觉')).toBeInTheDocument();
expect(screen.queryByText('Living Form')).not.toBeInTheDocument();
expect(screen.queryByText('目标与用途')).not.toBeInTheDocument();
expect(screen.queryByText(/规格版本|编译器|生成策略|字段决策/)).not.toBeInTheDocument();
});
it('invites a free description and does not turn a legacy decision prompt into a form', () => {
const workspace = designWorkspaceFixture({
form: designFormFixture({
decisionPrompts: [{
id: 'choice-1',
kind: 'question',
basedOnSpecificationRevisionId: 'specification-revision-3',
targetPaths: ['visual.art_direction'],
title: '画面想要什么感觉?',
body: '请从下面选一个。',
options: [
{ id: 'cartoon', label: '有趣的卡通', description: null },
{ id: 'cinema', label: '像电影一样', description: null },
],
}],
}),
turns: [],
});
prepareWorkspace(workspace);
render(<ImageCanvas />);
const conversation = screen.getByTestId('image-workspace-conversation');
expect(within(conversation).getByRole('heading', { name: '先把脑中的画面说出来' })).toBeInTheDocument();
expect(within(conversation).getByText(/想画什么、发生在哪里/)).toBeInTheDocument();
expect(within(conversation).queryByText('画面想要什么感觉?')).not.toBeInTheDocument();
expect(within(conversation).queryByRole('button', { name: '有趣的卡通' })).not.toBeInTheDocument();
fireEvent.click(within(conversation).getByRole('button', { name: '我想做一张热闹的社团招新海报' }));
expect(within(conversation).getByRole('textbox', { name: '告诉 AI 你想创作什么' })).toHaveValue(
'我想做一张热闹的社团招新海报',
);
});
it('sends high-impact fine adjustments through the existing typed field operations', () => {
const { actions } = prepareWorkspace();
render(<ImageCanvas />);
openMobileCreationCard();
fireEvent.click(screen.getByRole('button', { name: '精细调整' }));
fireEvent.click(screen.getByRole('button', { name: '手动调整(可选)' }));
fireEvent.click(screen.getByRole('button', { name: '电脑横屏' }));
expect(actions.applyFieldOperations).toHaveBeenCalledWith(
@@ -160,7 +194,9 @@ describe('youth AI Design Canvas page', () => {
fireEvent.click(screen.getByRole('button', { name: '发送消息' }));
await waitFor(() => {
expect(toastErrorMock).toHaveBeenCalledWith('AI 没有整理好这次想法,请再试一次');
expect(toastErrorMock).toHaveBeenCalledWith(
'AI 这次没听懂。你的内容还在输入框里,可以补充一个画面细节后再发送',
);
});
expect(toastErrorMock).not.toHaveBeenCalledWith('消息没有发出去,请再试一次');
});