Files
tolaria/tests/smoke/frontmatter-parsing-fix.spec.ts
Test 17f94647b7 fix: uniform StringOrList normalization for all frontmatter string fields
Replace per-field Option<String> with Option<StringOrList> for all string
fields in the Frontmatter struct (owner, cadence, status, icon, color,
sidebar_label, template, sort, view, trashed_at, created_at, created_time).

Previously, fields like Owner stored as YAML arrays (e.g. `Owner: [Luca]`)
caused serde to fail the entire Frontmatter deserialization, defaulting all
fields to None — including is_a, which broke the type badge display.

Now all string fields use StringOrList with into_scalar() normalization:
- Single-element array → unwrap to scalar
- Multi-element array → take first element
- Scalar → unchanged
- Empty array → None
- Absent → None

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 10:37:16 +01:00

49 lines
2.0 KiB
TypeScript

import { test, expect } from '@playwright/test'
import { sendShortcut } from './helpers'
const QUICK_OPEN_INPUT = 'input[placeholder="Search notes..."]'
async function openQuickOpen(page: import('@playwright/test').Page) {
await page.locator('body').click()
await sendShortcut(page, 'p', ['Control'])
await expect(page.locator(QUICK_OPEN_INPUT)).toBeVisible()
}
test.describe('Frontmatter parsing: type badge displays correctly', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/')
await page.waitForLoadState('networkidle')
})
test('procedure note shows type badge in Quick Open', async ({ page }) => {
await openQuickOpen(page)
await page.locator(QUICK_OPEN_INPUT).fill('Weekly')
await page.waitForTimeout(400)
// The Badge component renders the type name as text content
const badge = page.locator('.fixed.inset-0').locator('text=Procedure')
await expect(badge.first()).toBeVisible({ timeout: 3000 })
})
test('responsibility note shows type badge in Quick Open', async ({ page }) => {
await openQuickOpen(page)
await page.locator(QUICK_OPEN_INPUT).fill('Newsletter')
await page.waitForTimeout(400)
const badge = page.locator('.fixed.inset-0').locator('text=Responsibility')
await expect(badge.first()).toBeVisible({ timeout: 3000 })
})
test('project note shows type badge in Quick Open', async ({ page }) => {
await openQuickOpen(page)
await page.locator(QUICK_OPEN_INPUT).fill('Laputa')
await page.waitForTimeout(400)
const badge = page.locator('.fixed.inset-0').locator('text=Project')
await expect(badge.first()).toBeVisible({ timeout: 3000 })
})
test('sidebar shows type sections', async ({ page }) => {
// Sidebar sections are rendered as nav items — look for them in the page
await expect(page.locator('text=Projects').first()).toBeVisible({ timeout: 3000 })
await expect(page.locator('text=Responsibilities').first()).toBeVisible({ timeout: 3000 })
})
})