feat: add creative welcome and external works square links

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 15:37:37 +08:00
1 parent 4199cadd1e
commit f8a7880da3
18 files changed
+428 -41

No files matched your search

+17 -2
View File
@@ -1121,10 +1121,25 @@ test('first PI Conversation is editable under 500 ms and submits before runtime
buffer: largePng,
});
await composer.fill('Build the first PI scene');
await electronApp.evaluate(({ shell }) => {
const scope = globalThis as typeof globalThis & { __communityOpened?: string[] };
scope.__communityOpened = [];
shell.openExternal = async url => { scope.__communityOpened!.push(url); };
});
await page.getByRole('button', { name: '作品广场', exact: true }).click();
await page.getByRole('button', { name: '去作品广场逛逛' }).click();
await expect.poll(() => electronApp.evaluate(() => (
(globalThis as typeof globalThis & { __communityOpened?: string[] }).__communityOpened
))).toEqual(['https://square.nianxx.cn/#explore', 'https://square.nianxx.cn/#explore']);
await expect(composer).toHaveValue('Build the first PI scene');
await expect(page.getByText('large.png', { exact: true })).toBeVisible();
await expect(page.getByRole('dialog')).toHaveCount(0);
expect((await readState(electronApp)).captured.filter(item => item.path.endsWith('/prompt') && item.method === 'POST')).toHaveLength(0);
await expect(page.getByRole('button', { name: '发送' })).toBeEnabled();
await page.getByTestId('coding-message-composer').evaluate(
(form: HTMLFormElement) => form.requestSubmit(),
);
await expect(page.getByTestId('community-invitation')).toHaveCount(0);
await expect.poll(async () => {
const state = await readState(electronApp);
@@ -1869,7 +1884,7 @@ test('project consultations preserve student drafts and switch between work and
await expect(page.getByRole('button', { name: '与朋友聊天' })).toHaveAttribute('aria-pressed', 'true');
await expect(page.locator('#coding-consultation-dock')).toHaveCSS('width', '508px');
await expect(teacher.locator('form .consultation-hint')).toBeVisible();
await expect(teacher.locator('form .consultation-hint')).toHaveText('不知道问什么,你先帮我看看👀');
await expect(teacher.locator('form .consultation-hint')).toHaveText('帮我整体看🧠');
await expect(teacher.getByText('把你的困惑说出来就好')).toHaveCount(0);
await expect(teacher.getByText('当前项目',{exact:true})).toHaveCount(0);
await expect(teacher.getByRole('button',{name:'解释当前代码',exact:true})).toBeVisible();
@@ -1924,7 +1939,7 @@ test('project consultations preserve student drafts and switch between work and
expect(request.body).not.toHaveProperty('discussion');
}
await expect(teacher).toHaveAccessibleName('朋友咨询');
expect(consultationRequests[0].body).toMatchObject({intent:'suggestions',text:'不知道问什么,你先帮我看看👀'});
expect(consultationRequests[0].body).toMatchObject({intent:'suggestions',text:'帮我整体看🧠'});
expect(consultationRequests[1].body).toMatchObject({text:'怎样观察别人玩游戏?'});
expect(consultationRequests[1].body?.intent).toBeUndefined();
await page.screenshot({path:test.info().outputPath('project-teacher-side-chat.png')});