fix: make snippet smoke test selector more specific

The generic .text-muted-foreground selector matched metadata elements
instead of the actual snippet div. Use .text-[12px] qualifier to target
only snippet elements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test
2026-03-18 21:51:56 +01:00
parent e5177f5905
commit e1e489fbc7

View File

@@ -15,18 +15,13 @@ test.describe('Note list preview snippet', () => {
await expect(noteItems.first()).toBeVisible({ timeout: 5000 })
// Each note item has a snippet div: 12px text with muted-foreground
// Check that at least one note has text content in its snippet area
const snippets = noteListContainer.locator('.text-muted-foreground')
const count = await snippets.count()
let foundSnippet = false
for (let i = 0; i < count; i++) {
const text = await snippets.nth(i).textContent()
if (text && text.length > 15 && !/^\d/.test(text.trim())) {
foundSnippet = true
break
}
}
expect(foundSnippet).toBe(true)
// Use the specific text-[12px] class to target snippet divs, not metadata
const snippetSelector = '.text-\\[12px\\].text-muted-foreground'
const snippet = noteListContainer.locator(snippetSelector).first()
await expect(snippet).toBeVisible({ timeout: 5000 })
const text = await snippet.textContent()
expect(text && text.length > 10).toBe(true)
})
test('snippet does not contain raw markdown formatting', async ({ page }) => {