Improve dashboard

This commit is contained in:
2026-03-24 12:05:43 +02:00
parent f988715b6c
commit 669d66216e
2 changed files with 8 additions and 7 deletions

View File

@@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
/playwright-report/index.html

View File

@@ -253,21 +253,21 @@ test('load chart: last CW tick returns to current week after clicking TODAY', as
// ── buildLoadData: CTL / ATL / TSB values ─────────────────────────────────────
test('fitness state: CTL card shows value from last activity in current week', async ({ page }) => {
// MOCK_ACTIVITIES_TODAY has ctl=58
// MOCK_ACTIVITIES_TODAY has ctl=58; unit "TSS/day" is in a child <span> so use toContainText
const value = page.getByText('Fitness (CTL)').locator('..').locator('p.text-3xl')
await expect(value).toHaveText('58')
await expect(value).toContainText('58')
})
test('fitness state: ATL card shows value from last activity in current week', async ({ page }) => {
// MOCK_ACTIVITIES_TODAY has atl=70
const value = page.getByText('Fatigue (ATL)').locator('..').locator('p.text-3xl')
await expect(value).toHaveText('70')
await expect(value).toContainText('70')
})
test('fitness state: TSB card equals CTL minus ATL', async ({ page }) => {
// ctl=58, atl=70 → tsb=-12
const value = page.getByText('Form (TSB)').locator('..').locator('p.text-3xl')
await expect(value).toHaveText('-12')
await expect(value).toContainText('-12')
})
test('fitness state: all three values show dash when no activities exist before selected week', async ({
@@ -278,9 +278,9 @@ test('fitness state: all three values show dash when no activities exist before
const prevBtn = cwLabel.locator('..').getByRole('button').first()
for (let i = 0; i < 15; i++) await prevBtn.click()
await expect(page.getByText('Fitness (CTL)').locator('..').locator('p.text-3xl')).toHaveText('—')
await expect(page.getByText('Fatigue (ATL)').locator('..').locator('p.text-3xl')).toHaveText('—')
await expect(page.getByText('Form (TSB)').locator('..').locator('p.text-3xl')).toHaveText('—')
await expect(page.getByText('Fitness (CTL)').locator('..').locator('p.text-3xl')).toContainText('—')
await expect(page.getByText('Fatigue (ATL)').locator('..').locator('p.text-3xl')).toContainText('—')
await expect(page.getByText('Form (TSB)').locator('..').locator('p.text-3xl')).toContainText('—')
})
// ── Empty state ───────────────────────────────────────────────────────────────