Collapse teacher introductions after three operation replies
This commit is contained in:
@@ -2174,6 +2174,46 @@ test('settled prompt releases the composer without a client receipt and keeps th
|
||||
} finally { await releaseSnapshot(electronApp); }
|
||||
});
|
||||
|
||||
test('teacher introductions collapse after three operation replies and remain available on hover', 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);
|
||||
try {
|
||||
await page.reload(); page = await getStableWindow(electronApp);
|
||||
await page.getByTestId('ai-module-option-programming').click();
|
||||
await page.evaluate(() => { window.location.hash = '/chat'; });
|
||||
const introductions = page.getByTestId('teacher-welcomes');
|
||||
await expect(introductions.locator('.teacher-welcome-card')).toHaveCount(2);
|
||||
const startedAt = await page.evaluate(() => Date.now());
|
||||
for (let round = 1; round <= 3; round++) {
|
||||
for (const status of ['running', 'idle'] as const) {
|
||||
const seq = round * 2 + (status === 'idle' ? 1 : 0);
|
||||
const snapshot = {
|
||||
schemaVersion: 1,
|
||||
conversation: { id: 'conversation-pi-first-chat', projectId: 'project-pi-first-chat', agentId: 'builder', title: '新对话', model: { model: { accountId: 'account-e2e', modelId: 'model-a', thinkingLevel: 'off' }, modelResolution: 'resolved' } },
|
||||
nodes: [], run: { status, mode: 'prompt', runId: `intro-round-${round}`, startedAt,
|
||||
...(status === 'idle' ? { terminalReason: 'completed', settledAt: startedAt + round } : {}) },
|
||||
worker: { status: 'ready', generation: 1 }, cursor: { workerGeneration: 1, seq },
|
||||
queue: { items: [] }, context: { usedTokens: 0, contextWindow: 4096, compaction: 'idle' }, pendingInteractions: [],
|
||||
};
|
||||
await emitCodingEvent(page, 'snapshot', { type: 'snapshot', conversationId: snapshot.conversation.id, workerGeneration: 1, seq, snapshot });
|
||||
if (round < 3 || status === 'running') await expect(introductions).toBeVisible();
|
||||
}
|
||||
}
|
||||
await expect(introductions).toHaveCount(0);
|
||||
await page.getByRole('button', { name: '与代码智能体聊天', exact: true }).hover();
|
||||
await expect(page.getByTestId('teacher-introduction')).toContainText('一起发现代码里的小奥秘');
|
||||
await page.screenshot({ path: test.info().outputPath('teacher-introduction-after-three-rounds.png') });
|
||||
await page.reload();
|
||||
await expect(page.getByRole('button', { name: '与代码智能体聊天', exact: true })).toBeVisible();
|
||||
await expect(introductions).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); }
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user