Skip to content

test(operator): merge overlapping Settings and keyboard cases, check what they missed - #146

Merged
Ezo-mas merged 1 commit into
mainfrom
test/operator-settings-keys-cleanup
Nov 26, 2026
Merged

Ezo-mas merged 1 commit into
mainfrom
test/operator-settings-keys-cleanup

Conversation

@Ezo-mas

@Ezo-mas Ezo-mas commented Nov 25, 2026

Copy link
Copy Markdown
Member

Second frontend test cleanup from the test audit (audit at 6b65570; every case and behavior checked again on current main 6ad1ae5). Test-only: the diff is limited to App.settings.test.tsx, App.liveNext.test.tsx and App.interactions.test.tsx. No production code, generated bundles or audit outputs are included.

Changes

Settings (App.settings.test.tsx)

  1. Merged shows the mode the snapshot reported, before anything is touched and follows the mode the server confirms, in both places into shows the mode the snapshot reported, then follows the mode the server confirms, in both places. The test mounts once with a High snapshot, checks the console label, opens Settings, checks High is pressed, delivers the All confirmation with the dialog open, checks All is pressed, closes the dialog and checks the label. App.test.tsx › applies the mode the server confirms, which starts from Off, is unchanged.
  2. keeps the Off / On control and the dialog on the same mode, with the same semantics: after Med+ and closing Settings, it now opens Pending options and checks that the auto-approve menuitemcheckbox has aria-checked="true".

Keyboard navigation (App.interactions.test.tsx, App.liveNext.test.tsx)
3. Merged moves the highlight down/up the queue and approves the highlighted item by ID and liveNext's after an arrow moves the highlight past the first row, that row has focus into ArrowDown moves the highlight and focus row by row, scrolls that row into view, and Enter approves it by ID, using the 3-row queue. It checks:

  • no row is selected at first
  • the first ArrowDown focuses John
  • the next ArrowDown sets .is-selected and aria-pressed on Romans and focuses it
  • scrollIntoView({ block: 'nearest' }) ran on the [data-cursor-row="p-2"] container, checked through mock.contexts
  • Enter sends exactly [{ approve, p-2 }]
  1. Merged drops the highlight when the queue update no longer holds it and approves nothing when a resumed queue no longer holds the highlighted ID into a pending_update that replaces the whole queue drops the highlight, and Enter sends nothing. It selects the second row, replaces the queue with one unrelated row, then checks that no .is-selected row exists, the new row has aria-pressed="false", and Enter sends nothing.

Kept: highlights the first item when arrowing up or down from no highlight, the arrows move the highlight, starting at the first row, held at the ends, drops the highlight when its detection leaves the queue (partial removal), the state_snapshot reducer tests, Enter does nothing while the History tab hides the highlighted row and does not approve the highlighted reference on Enter until Settings is closed.

Findings and fault checks

Each fault was applied alone in a separate disposable checkout, run against the three files plus operatorReducer.test.ts, then restored. On clean code all 109 tests in those four files pass.

Practical regression (fault) Surviving test that catches it Result
Opening Settings resets an existing High mode shows the mode the snapshot reported, then follows… (High aria-pressed) caught
Pending checkbox reports Med+ as unchecked; text and click still right keeps the Off / On control and the dialog… (aria-checked) caught
ArrowDown moves the selection but leaves DOM focus behind ArrowDown moves the highlight and focus… (toHaveFocus after the first ArrowDown); also a server update does not move focus or the highlight caught
Right row gets focus, but the first row is scrolled ArrowDown moves the highlight and focus… (mock.contexts receiver) caught
Enter approves the first ID instead of the highlighted one ArrowDown moves the highlight and focus… (exact actions); also 4 other Enter tests caught
pending_update keeps a removed ID a pending_update that replaces the whole queue… (Enter sends nothing); drops the highlight when its detection leaves the queue caught
A full queue replacement auto-selects the first new row a pending_update that replaces the whole queue… (no .is-selected) caught
Pending treated as visible while History is open Enter does nothing while the History tab hides the highlighted row, and only that test caught
Global shortcuts enabled while Settings is open does not approve the highlighted reference on Enter until Settings is closed; also the B test ignores … an open Settings dialog caught

Each of the last two guards is caught by its own test. The Settings-reset fault also fails the two open-Settings keyboard tests, because the reset sends a set_auto_mode message.

Timing (focused files, durations of the affected cases, 3 interleaved before/after runs)

Group Before (cases) Before median After (cases) After median
Keyboard 4 545 ms 2 604 ms
Settings 3 1283 ms 2 1266 ms
All affected 7 1828 ms 4 1870 ms

These numbers are noisy run to run (for example, 1576–2589 ms for the seven original cases). The merged cases make the same getByRole queries as the originals, so there's no real speed-up. The value of this PR is fewer cases with stronger checks. Test counts: interactions + liveNext 51 → 49, settings 18 → 17.

Checks

npm run lint, npm run typecheck and npm run format:check are clean. npm test -- --run: 66 files, 750 tests passed, 0 skipped.

…what they missed

- One Settings case goes from a High snapshot to a confirmed All, in the dialog
  and the console label.
- The Off / On case also checks the Pending menu item's aria-checked.
- One ArrowDown case covers highlight, focus, the scrolled row container and
  approve-by-ID on a 3-row queue (replaces the liveNext focus case).
- One case covers a pending_update replacing the whole queue: no visible
  highlight, and Enter sends nothing.
@Ezo-mas
Ezo-mas merged commit e7fddb9 into main Nov 26, 2026
1 check passed
@Ezo-mas
Ezo-mas deleted the test/operator-settings-keys-cleanup branch November 26, 2026 00:18
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