Skip to content

test(e2e): restore sidebar specs after the SideNav migration - #1871

Merged
Astro-Han merged 2 commits into
mainfrom
fix/e2e-sidebar-astryx-sidenav
Aug 2, 2026
Merged

test(e2e): restore sidebar specs after the SideNav migration#1871
Astro-Han merged 2 commits into
mainfrom
fix/e2e-sidebar-astryx-sidenav

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

Summary

Main's e2e job has been red since #1860 (52aca7b) rendered the sidebar sessions as Astryx SideNavItem rows. Four specs failed, two root causes:

Strict-mode violations in three sidebar-navigation specs.SideNavItem renders endContent — the row-actions MoreMenu trigger — inside the row's primary <button>, so the row button's accessible name became the composite of its contents and ends with the trigger's label (会话 00 对话操作, maka 项目目录不可用 66 maka 项目操作). Substring name queries then matched both the row button and the trigger. The nesting is SideNavItem's own DOM (it also drops extra props in expanded mode, so the parent's name cannot be overridden), and pulling the trigger out of the item button would need apps/desktop/src/renderer/** CSS frozen by in-review PR #1857 — so the locators are tightened instead: the project spec scopes the name query to the project's own end content (.maka-project-item-end), and the session specs match the trigger name exactly (exact: true).

The geometry spec's 60-row pin selected rows by title^="会话 ", but #1860 changed the rows' title to session metadata (formatSessionMeta), so the pin resolved to 0 elements. Its only documented purpose was proving the list overflows, which the spec already asserts directly at (1a) via scrollHeight - clientHeight > 50; it is deleted, not re-located (commit 50da81d9f details what it protected and what protects it now).

Root cause

<button> nested inside <button> is invalid HTML and a genuine a11y defect (the row button's name swallows the trigger's label). It cannot be fixed on this branch: the nesting is SideNavItem's own rendering, and moving the trigger out of the item button needs sidebar CSS that PR #1857 currently holds. Worth a follow-up upstream (Astryx endContent placement) or after #1857 lands.

One behavior note from fixing the project-rename spec: starting a rename swaps the whole project row for the rename input, so the disclosure control is unmounted while editing, and because the collapse state is uncontrolled inside the row, renaming a collapsed project would reset it to expanded after commit. The fixtures only start expanded, so no spec exercises that path; the test now captures the disclosure state while the control is mounted.

Verification

  • npm --workspace @maka/desktop run e2e — 70 passed / 0 failed (was 4 failed on main).
  • npm run format:check — clean.
  • npm run lint — clean.
  • npm run typecheck — clean.
  • node scripts/check-dead-css.mjs --check — no dead classes.
  • npm --workspace @maka/desktop run test — 1305 passed.
  • npm --workspace @maka/ui run test — 238 passed.

PR #1860 renders sidebar sessions as Astryx SideNavItem rows. SideNavItem
renders endContent (the row actions MoreMenu trigger) inside the row's
primary <button>, so the row button's accessible name became the composite
of its contents and ends with the trigger's label. Name-based role queries
then matched both the row button and the trigger and failed with
strict-mode violations in three sidebar-navigation specs.
The nesting is Astryx SideNavItem's own DOM — SideNavItem also drops extra
props in expanded mode, so the parent's name cannot be overridden — and
pulling the trigger out of the item button would need sidebar.css, frozen
by in-review PR #1857. The locators are tightened instead:
- project rename: scope the name query to the project's own end content
(.maka-project-item-end), the only place its trigger can live.
- session specs: match the trigger's name exactly (exact: true).
Also moved the project disclosure-state capture ahead of entering edit
mode: starting a rename swaps the whole project row for the rename input,
so button[aria-expanded] is not mounted while editing (the pre-#1860
TreeList kept the row mounted). The assertion still verifies that
committing a rename does not toggle the disclosure.
The 'sidebar list scrolls independently' spec pinned 60 rendered rows via
[data-session-id][title^="会话 "]. Deleted the pin; two reasons:
- Its only documented purpose was to prove the list overflows — the
precondition the geometry assertions depend on. The spec already asserts
that directly at (1a) via scrollHeight - clientHeight > 50, which is
strictly stronger than a row count.
- PR #1860 changed the rows' title to session metadata (formatSessionMeta),
so a title-prefixed count can no longer select the rows at all; the pin
had degraded to asserting 0 elements.
What the pin protected (the renderer renders enough seeded rows to
overflow) is now protected by the (1a) scroller-metrics poll; what it
incidentally checked (60 sessions on disk) lives in the fixture unit tests
(apps/desktop/src/main/__tests__/e2e-fixture.test.ts).
@Astro-Han
Astro-Han merged commit bb44e37 into mainAug 2, 2026
5 checks passed
@Astro-Han
Astro-Han deleted the fix/e2e-sidebar-astryx-sidenav branch August 2, 2026 03:32
Sign up for freeto 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

@Astro-Han