refactor: remove manual refresh and search controls
ci / gitleaks (push) Successful in 8s
ci / docker (push) Successful in 7m17s

This commit is contained in:
2026-09-19 21:15:23 +08:00
parent 0cf1c49094
commit 4973d56a64
29 changed files with 244 additions and 860 deletions
+11 -2
View File
@@ -32,6 +32,15 @@ test('Today plain-list layout matches the approved responsive geometry', async (
const habitResponse = await mutate(request, baseURL!, '/api/v1/habits', { name: habitName, kind: 'numeric', target: 8, max_value: 8, schedule_type: 'daily' })
expect(habitResponse.ok(), await habitResponse.text()).toBeTruthy()
const habitId = (await habitResponse.json()).id as string
await page.route('**/api/v1/today/environment', route => route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
date: { solar_date: '2026-09-19', weekday: '星期六', lunar: '八月初九' },
weather: { status: 'fresh', temperature_c: 26.4, text: '多云', observed_at: '2026-09-19T20:45:00+08:00' },
gold: { status: 'fresh', contract: 'Au99.99', price_cny_per_gram: 835.62, market_date: '2026-09-18' },
}),
}))
await page.goto('/')
const taskRowLocator = page.locator('#today-tasks .task-row').filter({ hasText: taskTitle })
const habitRowLocator = page.locator('.today-habit-row').filter({ hasText: habitName })
@@ -59,7 +68,7 @@ test('Today plain-list layout matches the approved responsive geometry', async (
await expect(taskRowLocator).toHaveCount(1)
await expect(habitRowLocator).toHaveCount(1)
await expect(page.locator('.today-environment')).toBeVisible()
await expect(page.getByRole('button', { name: '刷新当前页面' })).toBeVisible()
await expect(page.getByRole('button', { name: /刷新|搜索/ })).toHaveCount(0)
await expect(page.getByRole('switch', { name: '显示已完成' })).toHaveCount(1)
await expect(page.locator('.today-environment__gold')).toContainText('Au99.99')
const metrics = await page.evaluate(({ taskId, habitId }) => {
@@ -136,7 +145,7 @@ test('Today plain-list layout matches the approved responsive geometry', async (
insideContent,
weatherText: weather.innerText,
goldText: gold.innerText,
goldLabel: gold.querySelector('.today-environment__gold-date')?.getAttribute('aria-label'),
goldLabel: gold.querySelector('.today-environment__gold-date')?.getAttribute('aria-label') ?? '',
summaries,
styles: {
mainPaddingLeft: getComputedStyle(main).paddingLeft,