fix: show and dismiss teacher introductions as one group

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 23:06:27 +08:00
1 parent a77ddbd681
commit 7458c37fb0
12 files changed
+290 -148

No files matched your search

+39 -3
View File
@@ -2322,6 +2322,42 @@ test('teacher introductions collapse after three operation replies and remain av
} finally { await releaseSnapshot(electronApp); }
});
test('teacher introduction group closes all three and stays closed for a new teacher after refresh and reload', async ({ launchElectronApp }) => {
const electronApp = await launchElectronApp({ skipSetup: true });
let page = await getStableWindow(electronApp);
const connection = await page.evaluate(async () => ({ token: await window.electron.ipcRenderer.invoke('hostapi:token') as string, baseUrl: await window.electron.ipcRenderer.invoke('hostapi:base-url') as string }));
await installCodingFirstChatHost(electronApp, connection, true);
await settleSnapshot(electronApp);
await disableCodingEventSource(page);
const addTeacher = async (id: string) => electronApp.evaluate((_electron, id) => {
const state = (globalThis as typeof globalThis & { __makelorePiFirstChatE2E: TeacherCatalogFixture }).__makelorePiFirstChatE2E;
const original = state.teacherCatalog.items[0];
state.teacherCatalog.items.push({ ...original, teacher_id: id, is_default: false,
definition: { ...original.definition, config_id: id, name: id } });
}, id);
try {
await addTeacher('第三位老师');
await page.reload(); page = await getStableWindow(electronApp);
await page.getByTestId('ai-module-option-programming').click();
await page.evaluate(() => { window.location.hash = '/chat'; });
const group = page.getByTestId('teacher-welcomes');
await expect(group.locator('.teacher-welcome-card')).toHaveCount(3);
await group.getByRole('button', { name: '收起全部老师介绍(朋友)' }).click();
await expect(group).toHaveCount(0);
await expect(page.getByTestId('teacher-chat-panel')).toHaveCount(0);
await addTeacher('第四位老师');
await page.getByRole('button', { name: '刷新智能体', exact: true }).click();
await expect(page.getByRole('button', { name: '与第四位老师聊天', exact: true })).toBeVisible();
await expect(group).toHaveCount(0);
await page.reload();
await expect(page.getByRole('button', { name: '与第四位老师聊天', exact: true })).toBeVisible();
await expect(group).toHaveCount(0);
await page.getByRole('button', { name: '与代码智能体聊天', exact: true }).hover();
await expect(page.getByTestId('teacher-introduction')).toContainText('一起发现代码里的小奥秘');
expect((await readState(electronApp)).captured.filter(item => /\/(agent-topics|messages|teacher-check-in|prompt)$/.test(item.path) && item.method === 'POST')).toHaveLength(0);
} finally { await releaseSnapshot(electronApp); }
});
test('teacher avatar consumes the welcome bubble through close, reopen and reload without a model request', async ({ launchElectronApp }) => {
const electronApp = await launchElectronApp({ skipSetup: true });
let page = await getStableWindow(electronApp);
@@ -2353,7 +2389,7 @@ test('teacher avatar consumes the welcome bubble through close, reopen and reloa
await page.reload();
await expect(teacherButton).toBeVisible();
await expect(invitation).toHaveCount(0);
await expect(page.getByRole('button', { name: '收起朋友的介绍' })).toBeVisible();
await expect(page.getByTestId('teacher-welcomes')).toHaveCount(0);
expect((await readState(electronApp)).captured.filter(item => /\/(agent-topics|messages|teacher-check-in|prompt)$/.test(item.path) && item.method === 'POST')).toHaveLength(0);
} finally { await releaseSnapshot(electronApp); }
});
@@ -2447,8 +2483,8 @@ test('teacher stays in the top-right header without legacy check-ins or taking o
expect(browserViewportBounds!.y).toBeGreaterThanOrEqual(workInvitationBounds!.y + workInvitationBounds!.height);
const workPane = page.getByRole('tabpanel', { name: '作品', exact: true });
const workPanel = page.getByTestId('agent-browser-panel');
// Account for existing DOM toolbars instead of reserving a full bubble row.
expect((await workPanel.boundingBox())!.y - (await workPane.boundingBox())!.y).toBeLessThan(65);
// Clear the entire group with only a small gap above the native viewport.
expect(browserViewportBounds!.y - (workInvitationBounds!.y + workInvitationBounds!.height)).toBeLessThanOrEqual(9);
await page.getByRole('tab', { name: '操作对话', exact: true }).click();
await expect(composer).toHaveValue('我还在写自己的想法');
await page.clock.fastForward(300_000);