fix: dismiss teacher welcome on consultation entry
This commit is contained in:
@@ -2028,6 +2028,41 @@ test('settled prompt releases the composer without a client receipt and keeps th
|
||||
} 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);
|
||||
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 teacherButton = page.getByRole('button', { name: '与代码智能体聊天', exact: true });
|
||||
const invitation = page.getByTestId('teacher-invitation');
|
||||
const teacher = page.getByTestId('teacher-chat-panel');
|
||||
await expect(invitation).toHaveAttribute('data-bubble-kind', 'welcome');
|
||||
await teacherButton.click();
|
||||
await expect(teacher).toBeVisible();
|
||||
await expect(teacher.getByText('一起理解代码', { exact: true })).toBeVisible();
|
||||
await expect(invitation).toHaveCount(0);
|
||||
await page.screenshot({ path: test.info().outputPath('teacher-avatar-consumed-welcome.png') });
|
||||
await teacherButton.click();
|
||||
await expect(teacher).toHaveCount(0);
|
||||
await expect(invitation).toHaveCount(0);
|
||||
await teacherButton.click();
|
||||
await expect(teacher).toBeVisible();
|
||||
await expect(invitation).toHaveCount(0);
|
||||
await teacherButton.click();
|
||||
await expect(teacher).toHaveCount(0);
|
||||
await page.reload();
|
||||
await expect(teacherButton).toBeVisible();
|
||||
await expect(invitation).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 stays in the top-right header and proactively checks in without taking over the student draft', async ({ launchElectronApp }) => {
|
||||
const electronApp = await launchElectronApp({ skipSetup: true });
|
||||
let page = await getStableWindow(electronApp);
|
||||
@@ -2121,6 +2156,12 @@ test('teacher stays in the top-right header and proactively checks in without ta
|
||||
await expect(composer).toHaveValue('我还在写自己的想法');
|
||||
await page.clock.fastForward(300_000);
|
||||
expect((await readState(electronApp)).captured.filter((item) => item.path.endsWith('/teacher-check-in'))).toHaveLength(1);
|
||||
await teacherButton.click();
|
||||
await expect(page.getByTestId('teacher-chat-panel')).toBeVisible();
|
||||
await expect(invitation).toHaveAttribute('data-bubble-kind', 'check-in');
|
||||
await teacherButton.click();
|
||||
await expect(page.getByTestId('teacher-chat-panel')).toHaveCount(0);
|
||||
await expect(invitation).toHaveAttribute('data-bubble-kind', 'check-in');
|
||||
await invitation.getByRole('button', { name: '和智能体聊聊' }).click();
|
||||
await expect(invitation).toHaveCount(0);
|
||||
await expect(presence).toHaveCount(0);
|
||||
|
||||
Reference in New Issue
Block a user