fix: move Code return navigation into the chat sidebar

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 22:55:07 +08:00
1 parent a77ddbd681
commit 10b179fb71
4 files changed
+104 -6

No files matched your search

+51 -1
View File
@@ -50,7 +50,7 @@ async function seedInactiveCodingProjects(resources: { rootDir: string; userData
}
test.describe('Makelore module navigation without setup flow', () => {
test('offers a create CTA and horizontal cards for remembered inactive Code projects', async ({
test('opens remembered Code projects and keeps the module return entry in chat instead of project settings', async ({
electronTestResources,
launchElectronApp,
}) => {
@@ -76,6 +76,56 @@ test.describe('Makelore module navigation without setup flow', () => {
await expect(page.getByTestId('coding-chat-panel')).toBeVisible();
await expect(page.getByTestId('coding-existing-projects')).toHaveCount(0);
await expect(page.getByTestId('sidebar-course-project-project-storybook')).toHaveAttribute('aria-current', 'page');
const sidebar = page.getByTestId('sidebar');
const moduleReturn = sidebar.getByTestId('sidebar-module-switcher-trigger');
await expect(moduleReturn).toBeVisible();
await expect(moduleReturn).toContainText('编程 Code');
await expect(moduleReturn).toHaveAttribute('aria-label', '返回首页');
await expect(sidebar.getByTestId('sidebar-module-return-icon')).toBeVisible();
await expect(moduleReturn).toHaveCSS('padding-top', '8px');
const brandBox = await sidebar.locator('.classroom-brand').boundingBox();
const returnBox = await moduleReturn.boundingBox();
expect(brandBox).not.toBeNull();
expect(returnBox).not.toBeNull();
expect(returnBox!.y).toBeGreaterThanOrEqual(brandBox!.y + brandBox!.height);
await page.screenshot({ path: test.info().outputPath('chat-code-return-entry.png') });
await sidebar.getByRole('button', { name: '项目设置', exact: true }).click();
await expect(page).toHaveURL(/\/project-config$/);
await expect(page.getByTestId('project-configuration-page')).toBeVisible();
await expect(sidebar.getByTestId('sidebar-module-switcher')).toHaveCount(0);
const projectBack = page.getByTestId('project-configuration-back-button');
await expect(projectBack).toBeVisible();
await page.screenshot({ path: test.info().outputPath('project-config-without-module-return.png') });
await projectBack.click();
await expect(page).toHaveURL(/\/chat$/);
await expect(moduleReturn).toBeVisible();
await sidebar.getByRole('button', { name: '项目设置', exact: true }).click();
await page.getByTestId('resource-card-plugins').click();
await expect(page).toHaveURL(/\/project-config\/plugins\?/);
const plugins = page.getByTestId('project-plugins-sheet');
await expect(plugins).toBeVisible();
await expect(sidebar.getByTestId('sidebar-module-switcher')).toHaveCount(0);
await page.screenshot({ path: test.info().outputPath('project-config-plugins-without-module-return.png') });
await plugins.getByRole('button', { name: '关闭', exact: true }).click();
await expect(page).toHaveURL(/\/project-config$/);
await expect(projectBack).toBeVisible();
await sidebar.getByTestId('sidebar-course-project-project-storybook').click();
await expect(page).toHaveURL(/\/chat$/);
const sidebarToggle = page.getByTestId('titlebar-sidebar-toggle');
await sidebarToggle.click();
await page.getByTestId('coding-chat-panel').click({ position: { x: 500, y: 200 } });
await expect(sidebar).toHaveAttribute('aria-hidden', 'true');
await sidebarToggle.hover();
await expect(sidebar).toHaveAttribute('aria-hidden', 'false');
await expect(moduleReturn).toBeVisible();
await page.screenshot({ path: test.info().outputPath('chat-collapsed-hover-code-return.png') });
await moduleReturn.click();
await expect(page).toHaveURL(/\/module-select$/);
await expect(page.getByTestId('ai-module-selection-page')).toBeVisible();
} finally {
await closeElectronApp(app);
}