merge: retire Canvas inspiration entry

# Conflicts:
#	README.md
#	src/components/layout/MainLayout.tsx
#	src/components/layout/Sidebar.tsx
#	tests/e2e/image-workspace-v2.spec.ts
#	tests/unit/app-module-provider-gate.test.tsx
#	tests/unit/title-bar.test.tsx
This commit is contained in:
inman
2026-09-07 10:24:24 +08:00
12 changed files with 128 additions and 114 deletions

View File

@@ -1,7 +1,7 @@
import { closeElectronApp, expect, getStableWindow, test } from './fixtures/electron';
test.describe('AI Design V2 workspace', () => {
test('keeps Prompt Museum cards usable when relative media fails', async ({ launchElectronApp }) => {
test('removes the inspiration entry and redirects its retired route to Canvas', async ({ launchElectronApp }) => {
test.setTimeout(90_000);
const app = await launchElectronApp({ skipSetup: true });
@@ -10,29 +10,6 @@ test.describe('AI Design V2 workspace', () => {
await expect(page.getByTestId('ai-module-selection-page')).toBeVisible();
await app.evaluate(({ ipcMain }) => {
const image = {
url: '/api/image-prompt-museum/e2e-entry/media/thumbnail',
width: 1200,
height: 900,
alt: 'E2E museum thumbnail',
};
const card = {
id: 'e2e-entry',
slug: 'e2e-entry',
title: '相对媒体 E2E',
summary: '验证图片失败不会阻断卡片。',
thumbnail: image,
categories: [],
model: { id: 'e2e-model', name: 'E2E Model' },
language: 'zh-CN',
attribution: {
author: { name: 'E2E 作者' },
source: { name: 'E2E 来源' },
license: { name: '测试许可', attributionText: 'E2E attribution' },
},
publishedAt: '2026-08-18T00:00:00.000Z',
updatedAt: '2026-08-18T00:00:00.000Z',
};
const respond = (json: unknown) => ({
ok: true,
data: { status: 200, ok: true, json },
@@ -50,47 +27,20 @@ test.describe('AI Design V2 workspace', () => {
},
});
}
if (path === '/api/works/image-prompt-museum') {
return respond({
success: true,
data: {
items: [card],
facets: { useCases: [], styles: [], subjects: [] },
nextCursor: null,
total: 1,
},
});
}
if (path === '/api/works/image-prompt-museum/e2e-entry') {
return respond({
success: true,
data: {
...card,
prompt: 'Create a resilient image card.',
variables: [],
images: [image],
requiresReferenceImages: false,
},
});
}
if (path === '/api/works/image-prompt-museum/e2e-entry/media/thumbnail') {
return respond({ mimeType: 'text/html', dataBase64: 'PGgxPnVuc2FmZTwvaDE+' });
}
return { ok: false, error: { message: `Unexpected E2E Host API request: ${path}` } };
});
});
await page.getByTestId('ai-module-option-painting').click();
const worksRail = page.getByTestId('image-workspace-works-rail');
await expect(worksRail.getByRole('button', { name: '获取灵感' })).toBeVisible();
await worksRail.getByRole('button', { name: '获取灵感' }).click();
await expect(worksRail).toBeVisible();
await expect(worksRail.getByRole('button', { name: /.*/u })).toHaveCount(0);
const cardButton = page.getByRole('button', { name: '查看 相对媒体 E2E' });
await expect(cardButton).toBeVisible();
await expect(page.getByLabel('E2E museum thumbnail加载失败')).toBeVisible();
await expect(cardButton).toBeEnabled();
await cardButton.click();
await expect(page.getByRole('button', { name: '关闭详情' })).toBeVisible();
await page.evaluate(() => {
window.location.hash = '#/image-prompts';
});
await expect.poll(() => page.evaluate(() => window.location.hash)).toBe('#/image-canvas');
await expect(page.getByTestId('image-workspace-works-rail')).toBeVisible();
} finally {
await closeElectronApp(app);
}