docs: UI-02 acceptance record and visual verification
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,7 @@ test('open from feed, navigate in sequence, zoom, close restores scroll and url'
|
||||
|
||||
// 点击第 3 格 → 大图:browse 图取回真实字节,URL 换为深链。
|
||||
await page.locator('.cell').nth(2).click();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
await expect
|
||||
.poll(() => browseNaturalWidth(page))
|
||||
.toBeGreaterThan(0);
|
||||
@@ -88,10 +88,10 @@ test('open from feed, navigate in sequence, zoom, close restores scroll and url'
|
||||
await expect(page.locator('img.photo')).toHaveAttribute('src', new RegExp(photoIds[step]!), { timeout: 10_000 });
|
||||
}
|
||||
expect(page.url()).toContain(`/a/${token}/p/${photoIds[5]}`);
|
||||
await expect(page.locator('.counter')).toHaveText('6 / 8');
|
||||
await expect(page.locator('.position-indicator')).toHaveText('6 / 8');
|
||||
|
||||
// 滚轮缩放(无需 ctrl):transform scale > 1;双击复位。
|
||||
const box = await page.locator('.lightbox').boundingBox();
|
||||
const box = await page.locator('.photo-viewer').boundingBox();
|
||||
expect(box).not.toBeNull();
|
||||
await page.mouse.move(box!.x + box!.width / 2, box!.y + box!.height / 2);
|
||||
await page.mouse.wheel(0, -360);
|
||||
@@ -109,8 +109,8 @@ test('open from feed, navigate in sequence, zoom, close restores scroll and url'
|
||||
.toBeCloseTo(1, 1);
|
||||
|
||||
// 关闭:URL 弹回相册路由,滚动精确回位。
|
||||
await page.locator('.control.close').click();
|
||||
await expect(page.locator('.lightbox')).toHaveCount(0);
|
||||
await page.locator('.viewer-close').click();
|
||||
await expect(page.locator('.photo-viewer')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(new RegExp(`/a/${token}/?$`));
|
||||
await expect
|
||||
.poll(() => page.evaluate(() => window.scrollY))
|
||||
@@ -123,12 +123,12 @@ test('deep link opens on the target photo with the list loaded behind', async ({
|
||||
const target = photoIds[4]!; // 第 5 张
|
||||
await openLocale(page, token, `/p/${target}`);
|
||||
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
await expect
|
||||
.poll(() => browseNaturalWidth(page))
|
||||
.toBeGreaterThan(0);
|
||||
await expect(page.locator('img.photo')).toHaveAttribute('src', new RegExp(target));
|
||||
await expect(page.locator('.counter')).toHaveText('5 / 8');
|
||||
await expect(page.locator('.position-indicator')).toHaveText('5 / 8');
|
||||
// 背后列表已构成序列(8 张)。
|
||||
await expect(page.locator('.cell')).toHaveCount(8);
|
||||
|
||||
@@ -138,8 +138,8 @@ test('deep link opens on the target photo with the list loaded behind', async ({
|
||||
expect(page.url()).toContain(`/a/${token}/p/${photoIds[3]}`);
|
||||
|
||||
// 关闭 → 回相册路由(深链直达无本会话 push:replace 语义)。
|
||||
await page.locator('.control.close').click();
|
||||
await expect(page.locator('.lightbox')).toHaveCount(0);
|
||||
await page.locator('.viewer-close').click();
|
||||
await expect(page.locator('.photo-viewer')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(new RegExp(`/a/${token}/?$`));
|
||||
});
|
||||
|
||||
@@ -155,7 +155,7 @@ test('deep link to a removed photo shows the localized notice and a working back
|
||||
const notice = page.locator('.deep-link-notice');
|
||||
await expect(notice).toBeVisible();
|
||||
await expect(notice).toContainText('照片不存在或已下线');
|
||||
await expect(page.locator('.lightbox')).toHaveCount(0);
|
||||
await expect(page.locator('.photo-viewer')).toHaveCount(0);
|
||||
|
||||
const back = notice.getByRole('link', { name: '返回相册' });
|
||||
await back.click();
|
||||
@@ -172,13 +172,13 @@ test('navigating past the first page extends the sequence', async ({ page }) =>
|
||||
|
||||
await expect(page.locator('.cell')).toHaveCount(30);
|
||||
await page.locator('.cell').nth(29).click(); // 第 1 页最后一张
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
|
||||
// 打开即临近末页边界:相邻预取已后台拉取第 2 页(设计行为),右切越过末尾
|
||||
// 落在第 31 张(序列第 2 页),列表同步扩展。
|
||||
await page.keyboard.press('ArrowRight');
|
||||
await expect(page.locator('img.photo')).toHaveAttribute('src', new RegExp(photoIds[30]!), { timeout: 15_000 });
|
||||
await expect(page.locator('.counter')).toHaveText('31 / 32');
|
||||
await expect(page.locator('.position-indicator')).toHaveText('31 / 32');
|
||||
// 背后列表同步扩展到 32 张。
|
||||
await expect(page.locator('.cell')).toHaveCount(32);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user