fix(e2e): unblock tags-rename-delete (emit tags-changed + fix selectors) - #253
Merged
Conversation
…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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three compounding bugs kept the
tags-rename-delete.e2e.tssuite red from the moment it was added in #238.createNote()only emittedNotesChannels.events.CREATED, nevernotes:tags-changed. The sidebar'suseNoteTagsQueryonly invalidates on the latter, so the tag tree never refetched after API-created notes.updateNote()already does this correctly —createNote()was missed whennotes.tswas split (refactor(vault): split notes.ts into focused files behind facade (Phase 3.1) #232).aside button:has-text(...)targets an<aside>element that doesn't exist (the main sidebar is a<div>; onlycalendar-sidebar.tsxuses<aside>).SidebarSectionusesdefaultExpanded={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— emitnotes:tags-changedfromcreateNote()whenmergedTags.length > 0, mirroringupdateNote().apps/desktop/tests/e2e/tags-rename-delete.e2e.ts— extractexpandTagsSection()helper that toggles viaaria-label="Tags section, collapsed"; replaceaside button:has-text(...)withgetByRole('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