From 1ced23033ef9a71839b7a7a28cb84f4eaff67db4 Mon Sep 17 00:00:00 2001 From: Frederic Cabassut Date: Wed, 5 Aug 2026 10:43:34 +0200 Subject: [PATCH] fix(e2e): match note-card locator on exact title, not substring content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit noteCard() filtered on hasText, matching against a card's *entire* rendered text — with note-linking, a card's content preview can now render a linked note's title as plain text (a stripped note-link), so a substring match against the whole card ambiguously resolves to more than one card whenever one note's title happens to appear inside another's preview. Scoped the match to the card's

title element with an anchored exact-match regex instead. This was failing CI on two tests: the note-linking suite's own backlink scenario, and — since test note titles aren't otherwise isolated across files in the same run — an unrelated notes-crud test whose note title happened to collide with a leftover "Linker Note" card's rendered preview. Verified: full e2e suite (114/114) passes locally against this fix. Co-Authored-By: Claude Sonnet 5 --- tests/e2e/helpers/fixtures.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/e2e/helpers/fixtures.ts b/tests/e2e/helpers/fixtures.ts index 084702f..a0de427 100644 --- a/tests/e2e/helpers/fixtures.ts +++ b/tests/e2e/helpers/fixtures.ts @@ -13,9 +13,18 @@ const COLLAB_EMAIL = 'collab@test.com'; const COLLAB_PASSWORD = collabPassword; const COLLAB_NAME = 'Collaborator User'; -/** Find a specific note card by its title text */ +/** + * Find a specific note card by its exact title text. Matches only the + * card's

title, not its full text content — with note-linking, a + * card's content preview can render another note's title as plain text + * (e.g. a stripped note-link), so a substring match against the whole + * card can ambiguously resolve to more than one card. + */ export function noteCard(page: Page, title: string): Locator { - return page.locator('[data-testid="note-card"]', { hasText: title }); + const escaped = title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + return page.locator('[data-testid="note-card"]').filter({ + has: page.locator('h3', { hasText: new RegExp(`^${escaped}$`) }) + }); } /**