fix: keep first work preview full height during teacher welcomes
This commit is contained in:
1 parent
fe1a3775c5
commit
d12d214d7f
8 files changed
+187
-34
No files matched your search
@@ -2490,6 +2490,16 @@ test('teacher stays in the top-right header without legacy check-ins or taking o
|
||||
const composer = page.getByTestId('coding-message-composer').getByRole('textbox', { includeHidden: true });
|
||||
await composer.fill('我还在写自己的想法');
|
||||
await page.getByRole('tab', { name: '作品', exact: true }).click();
|
||||
await expect(companion.getByTestId('teacher-welcomes')).toHaveCount(0);
|
||||
const workPane = page.getByRole('tabpanel', { name: '作品', exact: true });
|
||||
const workPanel = page.getByTestId('agent-browser-panel');
|
||||
const expectFullPreview = async () => {
|
||||
await expect.poll(async () => (await workPanel.boundingBox())!.y - (await workPane.boundingBox())!.y).toBe(20);
|
||||
const [pane, preview] = await Promise.all([workPane.boundingBox(), workPanel.boundingBox()]);
|
||||
expect(preview!.height).toBeGreaterThanOrEqual(pane!.height - 41);
|
||||
};
|
||||
await expectFullPreview();
|
||||
await page.screenshot({ path: test.info().outputPath('first-work-full-preview.png') });
|
||||
await expect(teacherButton).toBeVisible();
|
||||
await teacherButton.hover();
|
||||
await page.clock.runFor(250);
|
||||
@@ -2505,7 +2515,8 @@ test('teacher stays in the top-right header without legacy check-ins or taking o
|
||||
expect(introductionViewportBounds!.y).toBeGreaterThanOrEqual(introductionBounds!.y + introductionBounds!.height);
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(introduction).toHaveCount(0);
|
||||
await expect(invitation).toBeVisible();
|
||||
await expect(invitation).toHaveCount(0);
|
||||
await expectFullPreview();
|
||||
expect((await readState(electronApp)).captured.filter(item => /\/(messages|teacher-check-in)$/.test(item.path) && item.method === 'POST')).toHaveLength(0);
|
||||
await page.getByRole('tab', { name: '操作对话', exact: true }).click();
|
||||
await composer.focus();
|
||||
@@ -2532,21 +2543,10 @@ test('teacher stays in the top-right header without legacy check-ins or taking o
|
||||
await expect(page.getByRole('tab', { name: '操作对话', exact: true })).toHaveAttribute('aria-selected', 'true');
|
||||
await page.screenshot({ path: test.info().outputPath('teacher-published-welcome.png') });
|
||||
await page.getByRole('tab', { name: '作品', exact: true }).click();
|
||||
await expect(invitation).toBeInViewport({ ratio: 1 });
|
||||
const [workInvitationBounds, browserViewportBounds] = await Promise.all([
|
||||
presence.boundingBox(), page.getByTestId('agent-browser-viewport').boundingBox(),
|
||||
]);
|
||||
expect(workInvitationBounds).not.toBeNull();
|
||||
expect(browserViewportBounds).not.toBeNull();
|
||||
// The native view uses this rectangle and cannot be covered by a DOM z-index.
|
||||
expect(browserViewportBounds!.y).toBeGreaterThanOrEqual(workInvitationBounds!.y + workInvitationBounds!.height);
|
||||
const workPane = page.getByRole('tabpanel', { name: '作品', exact: true });
|
||||
const workPanel = page.getByTestId('agent-browser-panel');
|
||||
// Multiple introductions need their actual height, with only the native-view gap added.
|
||||
const nativeGap = browserViewportBounds!.y - workInvitationBounds!.y - workInvitationBounds!.height;
|
||||
expect(nativeGap).toBeGreaterThanOrEqual(8);
|
||||
expect(nativeGap).toBeLessThanOrEqual(9);
|
||||
await expect(presence).toHaveCount(0);
|
||||
await expectFullPreview();
|
||||
await page.getByRole('tab', { name: '操作对话', exact: true }).click();
|
||||
await expect(presence.locator('.teacher-welcome-card')).toHaveCount(2);
|
||||
await expect(composer).toHaveValue('我还在写自己的想法');
|
||||
await page.clock.fastForward(300_000);
|
||||
expect((await readState(electronApp)).captured.filter((item) => item.path.endsWith('/teacher-check-in'))).toHaveLength(0);
|
||||
|
||||
Reference in new issue
Block a user