Skip to content

fix(e2e): unblock tags-rename-delete (emit tags-changed + fix selectors) - #253

Merged
h4yfans merged 1 commit into
mainfrom
fix/e2e-tags-create-emit
Apr 17, 2026
Merged

fix(e2e): unblock tags-rename-delete (emit tags-changed + fix selectors)#253
h4yfans merged 1 commit into
mainfrom
fix/e2e-tags-create-emit

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Three compounding bugs kept the tags-rename-delete.e2e.ts suite red from the moment it was added in #238.

  • Product: createNote() only emitted NotesChannels.events.CREATED, never notes:tags-changed. The sidebar's useNoteTagsQuery only invalidates on the latter, so the tag tree never refetched after API-created notes. updateNote() already does this correctly — createNote() was missed when notes.ts was split (refactor(vault): split notes.ts into focused files behind facade (Phase 3.1) #232).
  • Test selector: aside button:has-text(...) targets an <aside> element that doesn't exist (the main sidebar is a <div>; only calendar-sidebar.tsx uses <aside>).
  • Test setup: the Tags SidebarSection uses defaultExpanded={false}, so even after the tag was indexed and rendered, it wasn't visible to Playwright. The test never expanded the section.

Changes

  • apps/desktop/src/main/vault/notes-crud.ts — emit notes:tags-changed from createNote() when mergedTags.length > 0, mirroring updateNote().
  • apps/desktop/tests/e2e/tags-rename-delete.e2e.ts — extract expandTagsSection() helper that toggles via aria-label="Tags section, collapsed"; replace aside button:has-text(...) with getByRole('button', { name: tag, exact: true }).

Test plan

  • pnpm exec playwright test tests/e2e/tags-rename-delete.e2e.ts — both tests green in 18.8 s locally
  • CI shard 3/3 confirms the fix in the larger context
  • No regressions in adjacent tag-related tests

…g selectors

Three compounding bugs kept this suite red since it was added in #238:

1. createNote() never emitted notes:tags-changed, so the sidebar tag tree
   (subscribed via useNoteTagsQuery) didn't refetch when a tagged note was
   created via API. Mirrors the existing emission in updateNote().

2. The test selector aside button:has-text(...) targeted an <aside> element
   that doesn't exist; the main sidebar is a <div>. Replaced with
   getByRole('button', { name: tag, exact: true }).

3. The Tags sidebar section is defaultExpanded={false}, so even with the
   tag rendered it wasn't visible. Added expandTagsSection() helper that
   toggles via aria-label="Tags section, collapsed".
@h4yfans
h4yfans merged commit 1ba67fd into main Apr 17, 2026
2 checks passed
@h4yfans
h4yfans deleted the fix/e2e-tags-create-emit branch May 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant