fix: keep the welcome composer at the bottom
This commit is contained in:
@@ -65,10 +65,27 @@ for (const width of [375, 768, 1280, 1470]) {
|
||||
await expect(page.getByRole('button', { name: '去作品广场逛逛' })).toBeVisible();
|
||||
await teachers.getByRole('button', { name: '先自己试试' }).click();
|
||||
await heading.scrollIntoViewIfNeeded();
|
||||
const composer = page.getByTestId('coding-message-composer');
|
||||
await expect(composer).toBeInViewport({ ratio: 1 });
|
||||
const box = (await composer.boundingBox())!;
|
||||
expect(850 - box.y - box.height).toBeLessThanOrEqual(40);
|
||||
expect((await page.getByTestId('community-invitation').boundingBox())!.y).toBeLessThan(box.y);
|
||||
await page.screenshot({ path: test.info().outputPath(`community-welcome-${width}.png`) });
|
||||
});
|
||||
}
|
||||
|
||||
test('a short window scrolls the welcome while keeping the composer at the bottom', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 375, height: 600 });
|
||||
await page.goto(baseUrl + '?teachers');
|
||||
const composer = page.getByTestId('coding-message-composer');
|
||||
await expect(composer).toBeInViewport({ ratio: 1 });
|
||||
const before = (await composer.boundingBox())!;
|
||||
await page.getByTestId('community-invitation').scrollIntoViewIfNeeded();
|
||||
const after = (await composer.boundingBox())!;
|
||||
expect(after.y).toBeCloseTo(before.y, 0);
|
||||
expect(600 - after.y - after.height).toBeLessThanOrEqual(40);
|
||||
});
|
||||
|
||||
test('the community link opens only on click and leaves the draft mounted', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 850 });
|
||||
const communityRequests: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user