docs: UI-02 acceptance record and visual verification
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -74,9 +74,9 @@ test('lightbox likes accumulate to 3 and persist across reload', async ({ page }
|
||||
await openAlbum(page, token);
|
||||
|
||||
await page.locator('.cell').first().click();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await page.locator('.control.like-button').click();
|
||||
await page.locator('.action-bar .like-slot .action-btn').click();
|
||||
}
|
||||
// 防抖 500ms 冲批 → 服务端权威校准 3(响应/WS burst 先后到达均为 3)。
|
||||
await expect(page.locator('.like-count')).toHaveText('3');
|
||||
@@ -92,10 +92,10 @@ test('lightbox likes accumulate to 3 and persist across reload', async ({ page }
|
||||
// 刷新后从服务端列表回归:深链自动重开大图(URL 仍停在该照片),计数 3;
|
||||
// 关闭后格子计数亦 3(sessionId 会话内持久,幂等面不变)。
|
||||
await page.reload();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
await expect(page.locator('.like-count')).toHaveText('3');
|
||||
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.locator('.cell-like .count').first()).toHaveText('3');
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ test('others burst bubbles on my page; my own like does not', async ({ browser,
|
||||
await expect(page.locator('.like-bubble .bubble-delta')).toHaveText('+1');
|
||||
await expect(page.locator('.cell-like .count').first()).toHaveText('2');
|
||||
await page.locator('.like-bubble').click();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
} finally {
|
||||
await ctx2.close();
|
||||
}
|
||||
@@ -173,7 +173,7 @@ test('hidden photo disappears from the feed and closes the lightbox via WS push'
|
||||
|
||||
// 大图停在第 2 张:下线推送应回退邻居并收口(closeLightbox 路径)。
|
||||
await page.locator('.cell').nth(1).click();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
|
||||
await deleteSeededPhoto(photoIds[1]!);
|
||||
await flushSync(albumId); // photo.deleted 走真实管线 → ov 撤下 + WS 房间广播
|
||||
@@ -181,7 +181,7 @@ test('hidden photo disappears from the feed and closes the lightbox via WS push'
|
||||
// 推送到达:列表无刷新即时 2 张 + 下线提示;大图回退到后邻(第 3 张)仍可看。
|
||||
await expect(page.locator('.cell')).toHaveCount(2, { timeout: 20_000 });
|
||||
await expect(page.locator('.removed-notice')).toBeVisible();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
await expect(page.locator('img.photo')).toHaveAttribute('src', new RegExp(photoIds[2]!));
|
||||
});
|
||||
|
||||
@@ -198,7 +198,7 @@ test('sort toggle switches latest/hot snapshots and is disabled in the lightbox'
|
||||
await apiLike(token, older, 'e2e-hot-session', 10);
|
||||
await page.getByRole('button', { name: '热门' }).click();
|
||||
await expect(page.locator('.cell-img').first()).toHaveAttribute('src', new RegExp(older));
|
||||
await expect(page.locator('.sort .chip').nth(1)).toHaveClass(/active/);
|
||||
await expect(page.locator('.sort-tabs .sort-tab').nth(1)).toHaveClass(/active/);
|
||||
|
||||
// 切回最新:原顺序恢复(冷快照语义,各自独立)。
|
||||
await page.getByRole('button', { name: '最新' }).click();
|
||||
@@ -206,9 +206,9 @@ test('sort toggle switches latest/hot snapshots and is disabled in the lightbox'
|
||||
|
||||
// 大图打开期间排序切换禁用(快照冻结,避免半开序列换序)。
|
||||
await page.locator('.cell').first().click();
|
||||
await expect(page.locator('.lightbox')).toBeVisible();
|
||||
await expect(page.locator('.sort .chip').first()).toBeDisabled();
|
||||
await expect(page.locator('.sort .chip').nth(1)).toBeDisabled();
|
||||
await expect(page.locator('.photo-viewer')).toBeVisible();
|
||||
await expect(page.locator('.sort-tabs .sort-tab').first()).toBeDisabled();
|
||||
await expect(page.locator('.sort-tabs .sort-tab').nth(1)).toBeDisabled();
|
||||
});
|
||||
|
||||
test('visit counting: fresh context counts once, reload is idempotent, second context counts', async ({
|
||||
@@ -222,19 +222,19 @@ test('visit counting: fresh context counts once, reload is idempotent, second co
|
||||
try {
|
||||
await openAlbum(page1, token);
|
||||
// 首访计数(上报成功后以权威 viewCount 回填)。
|
||||
await expect(page1.locator('.view-count')).toHaveText('1', { timeout: 15_000 });
|
||||
await expect(page1.locator('.view-count')).toHaveText('1 次浏览', { timeout: 15_000 });
|
||||
|
||||
// 刷新:visitorId 持久 + 窗口去重 → 不再计数。
|
||||
await page1.reload();
|
||||
await expect(page1.locator('.cell').first()).toBeVisible();
|
||||
await expect(page1.locator('.view-count')).toHaveText('1');
|
||||
await expect(page1.locator('.view-count')).toHaveText('1 次浏览');
|
||||
|
||||
// 第二个全新上下文:新 visitorId → 再计数。
|
||||
const ctx2 = await browser.newContext();
|
||||
try {
|
||||
const page2 = await ctx2.newPage();
|
||||
await openAlbum(page2, token);
|
||||
await expect(page2.locator('.view-count')).toHaveText('2', { timeout: 15_000 });
|
||||
await expect(page2.locator('.view-count')).toHaveText('2 次浏览', { timeout: 15_000 });
|
||||
} finally {
|
||||
await ctx2.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user