Skip to content

test(gui): assert destructive menu items are marked at rest, not on hover - #379

Merged
fstubner merged 1 commit into
mainfrom
test/exit-icon-red-at-rest
Sep 7, 2026
Merged

test(gui): assert destructive menu items are marked at rest, not on hover#379
fstubner merged 1 commit into
mainfrom
test/exit-icon-red-at-rest

Conversation

@fstubner

@fstubner fstubner commented Sep 7, 2026

Copy link
Copy Markdown
Owner

The e2e suite failed on a run of the current app:

Exit icon should be neutral before hover
actual:   rgb(244, 117, 130)
expected: rgb(149, 157, 174)

The app is right; the assertion was stale. #296 moved the red to rest deliberately — a warning that arrives once you have already aimed at the item is too late to redirect you. That PR changed four source files and no e2e file, so assertExitMenuItemNeutralUntilHover kept encoding the behaviour it replaced. Renamed, since the old name asserted the old rule.

What the new assertion pins

  • Exit's icon is danger-coloured at rest
  • A non-destructive item is not
  • Hover keeps the marking rather than introducing it — menu.css covers hover as "a subset" of at-rest, so a rule that reverted there would be a regression the at-rest check alone would miss

The expected colour is read from --red through a probe element rather than a hardcoded hex, so it holds in both themes (#f47582 dark, #c6293d light) and getComputedStyle normalises it to the same rgb() form the icon reports.

The probe goes inside .container. tokens.css declares the palette there, not on :root — a first attempt appended it to document.body, where var(--red) resolved to nothing and inherited white. rawRed is now asserted non-empty so that failure reports itself instead of surfacing as a confusing colour mismatch.

Verification

Ran the suite against the built app: exit 0, no assertion errors, and all 12 screenshots rewritten through to tauri-render-narrow.png, which is the last one the run produces. eslint clean.

Note the suite is silent on success — it prints only on failure, so a passing run's log is just the build output.

…over

The e2e suite failed on a run of the current app: "Exit icon should be
neutral before hover", actual rgb(244, 117, 130). The app is right and the
assertion was stale. #296 moved the red to rest deliberately, on the
reasoning that a warning arriving once you have already aimed at the item is
too late to redirect you. That PR changed four source files and no e2e file,
so the assertion kept encoding the behaviour it replaced.

Renamed from assertExitMenuItemNeutralUntilHover, since the old name asserted
the old rule.

The expectation now reads `--red` through a probe element rather than a
hardcoded hex, so it holds in both themes (#f47582 dark, #c6293d light) and
getComputedStyle normalises it to the same rgb() form the icon reports. The
probe goes inside `.container`: tokens.css declares the palette there and not
on :root, and a first attempt appended it to document.body, where var(--red)
resolved to nothing and inherited white. `rawRed` is asserted non-empty so
that failure mode reports itself instead of surfacing as a colour mismatch.

Hover is still checked, but now asserts the marking STAYS rather than
appears. menu.css covers hover as "a subset" of at-rest, so a rule that
reverted there would be a regression the at-rest check alone would miss.

Verified by running the suite against the built app: exit 0, no assertion
errors, and all 12 screenshots rewritten through to tauri-render-narrow.png,
which is the last one the run produces. eslint clean.
@fstubner
fstubner merged commit b8c0a79 into main Sep 7, 2026
15 checks passed
@fstubner
fstubner deleted the test/exit-icon-red-at-rest branch September 7, 2026 23:45
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