feat(i18n): T15 full-stack language audit with coverage assertions

- viewer/admin 错误码→文案映射按契约 ErrorCodes 枚举全集登记(机器守护
  spec 遍历枚举断言无缺漏 + 映射键在 zh/en 词条均存在 + locale 键集
  递归相等);mobile 镜像补齐 DOWNLOAD_DISABLED(P4a 增补漏登)
- 漏译修复:viewer.photoRemoved en 侧缺失(审计测试捕获);
  DOWNLOAD_DISABLED 观众侧专属文案 + useDownload 专属提示接线;
  admin apiMsg 增 RATE_LIMITED/ALBUM_NOT_PUBLIC/DOWNLOAD_DISABLED/
  SYNC_AUTH_FAILED 四码词条
- 运行时抽查:admin 主旅程 en 版 e2e(登录→相册管理全英文 + 偏好
  持久);embed iframe lang=en 渲染与深链跟随 e2e(zh 侧既有用例覆盖)
- contracts 新增 ./errors 浏览器安全子路径(errors.ts 纯 TS);
  admin 增 @photo/contracts devDep(仅测试消费)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-20 23:44:27 +08:00
parent 0238f505c4
commit 7385785504
17 changed files with 310 additions and 13 deletions
+20
View File
@@ -90,6 +90,26 @@ test.describe.serial('embed carousel widget (P4b Task 4)', () => {
await popup.close();
});
// T15(A12)embed lang 参数两语言渲染断言之 en 侧(zh 侧由 lang=auto →
// defaultLocale 各用例覆盖):loader data-lang=en → iframe 内英文标题,
// 深链 lang=en 跟随。
test('lang=en renders English copy in the iframe and passes en to the photo deep link', async ({ page }) => {
const feed = await seedFeed('langen');
await page.goto(`/__test__/embed-host.html?slot=${feed.slotToken}&lang=en`);
const frame = page.frameLocator('iframe');
await expect(frame.locator('.embed-title')).toHaveText('langen EN Album');
await expect(frame.locator('.embed-photo').first()).toBeVisible();
// 点击 → 新标签深链携带 lang=en(resolvedLocale)。
const popupPromise = page.context().waitForEvent('page');
await frame.locator('.embed-photo.active').click();
const popup = await popupPromise;
await expect(popup).toHaveURL(new RegExp(`/a/${feed.albumToken}/p/`));
await expect(popup).toHaveURL(/lang=en/);
await popup.close();
});
test('collapse button hides the widget, persists after reload, and the handle expands it', async ({ page }) => {
const feed = await seedFeed('collapse');