Repository navigation
test: update three undo and panel-search tests for z taking back messages - #5538
Conversation
…ages #5320 made the user's newest comment or reply a gesture `z` takes back, and dropped the rule that `z` first shows a gesture the agent picked up. Three browser tests still expected the old behavior: - test_z_takes_back_the_thread_the_user_just_resolved asserted `z` was offered nothing on a page whose fixture comments are the user's own, which is now their newest undoable gesture. The test drops those two offer checks; it still checks that `z` writes an undo naming the resolve, no unresolve, and leaves the agent's resolve in place. - test_another_key_or_a_scroll_away_puts_the_shown_gesture_back_to_showing relied on a pickup to make an in-view press show the choice after another key. With the choice in view the press now takes it, so the key steps and the pickup go, and the test is renamed for the scroll case it still checks. test_a_key_between_ends_what_the_shown_gesture_promised covers another key ending the arm. - test_the_menu_s_search_finds_rows_threads_and_commands searched for a user's thread, and the menu's Undo row, naming that comment's words, came first, so Enter took the comment back. The thread is now the agent's. Closes #5484
leaf-agent
left a comment
There was a problem hiding this comment.
Dropping the Shift press leaves the modifier exemption untested. onUserInput in browser/runtime/undo.js keeps the arm through a keydown in KEYS_HELD ("Shift", "Control", "Alt", "Meta", "CapsLock", "Fn"), and the old step in this test was the only one that exercised it; no other test in tests/browser/ presses a bare modifier between two zs. If that exemption were removed, a user reaching for Shift after the first z would end the arm and the second z would take the newest gesture rather than the one just shown, and the suite would stay green.
The setup in test_a_key_between_ends_what_the_shown_gesture_promised, an old resolve shown with a newer one behind it, makes the difference visible: press Shift where that test presses ArrowRight, and the next z takes the shown resolve. I'll push that as a sibling test.
The scroll test's Shift step was the only check of undo.js's KEYS_HELD exemption; with the choice in view it could no longer tell the arm held, so it was dropped. This sibling of the key-between test shows the difference: after Shift, z takes the shown old Resolve, not the newer one. It fails with Shift removed from KEYS_HELD.
Three browser tests have failed on main since #5320 ("Let z take back a sent message or reaction"). #5320 made two changes they didn't account for. The user's newest comment or reply became a gesture
ztakes back, and the menu's Undo row names it by its words. Also, a gesture the agent has picked up no longer makeszshow it first. All three tests expected the behavior #5320 replaced, so this updates the tests and leaves the code alone.test_z_takes_back_the_thread_the_user_just_resolvedasserted thatzwas offered nothing before and after the undo. The page's fixture comments are the user's own, so the newest of them is now an undoable gesture. The two offer checks go. The test still checks thatzwrites anundonaming the user's resolve and nounresolve, and that the agent's resolve stays closed (the open count is 2).test_another_key_or_a_scroll_away_puts_the_shown_gesture_back_to_showingwrote a pickup so that, afterj, a press on the choice in view would show it again. Under Let z take back a sent message or reaction, whatever the agent has done with it #5320 that press takes it, so the pickup and the key steps go, and the test becomestest_a_scroll_away_puts_the_shown_gesture_back_to_showing. Another key ending the arm is still covered bytest_a_key_between_ends_what_the_shown_gesture_promised, where the difference is visible: the newer gesture is taken, not the shown one.test_the_menu_s_search_finds_rows_threads_and_commandssearched for "window long". The first row found was nowUndo: commented “Is the window long enough?”, so Enter took the comment back instead of opening the thread, and the Back button read "Back to Threads". The thread is now the agent's, so the search finds the thread row first and Enter opens it. This also clears the teardown'sunchanged write: hidden on div.lf-fp-quick, which came from that path.test_a_modifier_between_keeps_what_the_shown_gesture_promisedis new. The scroll test'sShiftpress was the only check that a modifier alone keeps the arm (KEYS_HELDinbrowser/runtime/undo.js), and with the choice in view it could no longer show that. The new test uses the setup oftest_a_key_between_ends_what_the_shown_gesture_promisedand pressesShiftwhere that test pressesArrowRight, so the nextztakes the shown old resolve and not the newer one. It fails withShiftremoved fromKEYS_HELD.All three fail on
479914c4b(main when this branch was cut) and pass with this change:uv run pytest --run-mainon the three node ids, plustest_a_key_between_ends_what_the_shown_gesture_promised. The new test passes.Closes #5484 — automated triage