feat: add local pomodoro focus timer
ci / gitleaks (push) Successful in 7s
ci / docker (push) Successful in 3m34s

Frontend-only 25m focus / 5m break timer with pause-resume-reset, deadline-based absolute timing, versioned localStorage persistence, cross-tab conflict protection, midnight-completion attribution, accessible stage controls, and reduced-motion support. Adds 专注 entry to desktop sidebar; mobile bottom nav unchanged; no notifications, task association, history, or cross-device sync. Also fixes mobile E2E task isolation and the stale calendar 390px overflow assertion.
This commit is contained in:
2026-09-22 09:10:05 +08:00
parent 12e4753aeb
commit a535f69cae
14 changed files with 513 additions and 25 deletions
+15 -8
View File
@@ -14,27 +14,34 @@ async function createTask(request: APIRequestContext, baseURL: string, title: st
expect(response.ok(), await response.text()).toBeTruthy()
}
async function openInbox(page: Page) {
async function createList(request: APIRequestContext, baseURL: string, name: string) {
const response = await request.post('/api/v1/lists', {
data: { name },
headers: { 'x-csrf-token': await csrf(request), origin: baseURL },
})
expect(response.ok(), await response.text()).toBeTruthy()
return response.json() as Promise<{ id: string }>
}
async function openList(page: Page, name: string) {
if ((await page.viewportSize())!.width <= 930) {
await page.locator('.topbar').getByRole('button', { name: /展开菜单|收起菜单/ }).click()
}
await page.locator('.sidebar').getByRole('button', { name: '收集箱', exact: true }).click()
await page.locator('.sidebar').getByRole('button', { name, exact: true }).click()
}
test('inbox and task composer match approved visuals', async ({ page, request, baseURL }, testInfo) => {
test.skip(testInfo.project.name !== 'mobile-390', 'approved visual baselines are maintained for mobile-390 only')
await page.clock.install({ time: new Date('2026-09-19T05:00:00.000Z') })
const bootstrap = await request.get('/api/v1/bootstrap')
expect(bootstrap.ok()).toBeTruthy()
const inbox = (await bootstrap.json()).lists.find((item: { is_inbox: boolean }) => item.is_inbox)
expect(inbox).toBeTruthy()
const listName = '视觉回归清单'
const list = await createList(request, baseURL!, listName)
const seededTitles = ['整理本周工作记录', '检查 Dodo 备份', '周末买水果和牛奶'] as const
for (const title of seededTitles) await createTask(request, baseURL!, title, inbox.id)
for (const title of seededTitles) await createTask(request, baseURL!, title, list.id)
await page.goto('/')
await openInbox(page)
await openList(page, listName)
const seededRows = page.locator('.task-row').filter({ hasText: /整理本周工作记录|检查 Dodo 备份|周末买水果和牛奶/ })
await expect(seededRows).toHaveCount(3)
await expect(page).toHaveScreenshot('inbox.png', { fullPage: true })