Merge grouped teacher introductions into latest main

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 23:24:59 +08:00
commit f853396124
13 files changed
+295 -150

No files matched your search

+37 -1
View File
@@ -2324,6 +2324,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);
@@ -2355,7 +2391,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); }
});