Skip to content

fix(ui): give checkpoint delete cancel buttons unique data-testids (#2871) - #2877

Open
boxcee-interview wants to merge 1 commit into
kagent-dev:mainfrom
boxcee-interview:fix/issue-2871
Open

boxcee-interview wants to merge 1 commit into
kagent-dev:mainfrom
boxcee-interview:fix/issue-2871

Conversation

@boxcee-interview

Copy link
Copy Markdown
Contributor

Closes #2871

What was wrong

Two Popconfirm dialogs on the same chat page both title their confirmation "Delete this snapshot?" — the divider's own delete (CheckpointDivider.tsx) and the snapshot record dialog's delete (SnapshotDetailsModal.tsx). The ok buttons of each already carry a data-testid; neither cancel button did, so the spec had to look up the cancel by role+name across the whole page. While the record dialog is still mid-close-animation after Escape, the page-wide Cancel lookup resolves to the control on its way out, which never becomes clickable — the click waits out the 30s timeout and the suite reports flaky.

What the fix does

Gives each cancel button the data-testid its ok button already sets, and points the spec at it:

  • CheckpointDivider.tsx: cancelButtonProps data-testid chat-checkpoint-delete-cancel-
  • SnapshotDetailsModal.tsx: cancelButtonProps data-testid snapshot-details-delete-cancel
  • checkpoints.spec.ts lines 114 and 213: getByTestId(...) instead of getByRole("button", { name: "Cancel" })

How to Test

cd ui && yarn test:pw — the previously flaky test "chat: the mark names itself, carries its controls, and opens its record" now targets the divider's own cancel button, and "chat: a snapshot is deleted from its record" targets the dialog's own cancel. Verified in an isolated container (node:24, yarn 4.9.0, Playwright chromium): yarn lint clean (0 errors), yarn typecheck clean, and the checkpoints spec passing on chromium — including both affected tests.

…agent-dev#2871)

Two Popconfirm dialogs on the same page both title their confirmation
"Delete this snapshot?" and both rendered a Cancel button with no
data-testid. The checkpoints spec clicked getByRole("button", { name:
"Cancel" }) across the whole page, which while the dialog's close
animation is still running matches the control on its way out, so the
click waits out the 30s timeout and the run reports flaky.

The ok buttons already carry data-testids
(chat-checkpoint-delete-confirm-<id>, snapshot-details-delete-confirm);
the cancel buttons now carry the matching pair
(chat-checkpoint-delete-cancel-<id>, snapshot-details-delete-cancel)
and the spec targets them directly.

Closes kagent-dev#2871

Signed-off-by: Moritz Schmitz von Hülst <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working label Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Flaky chat checkpoints spec: two confirmations share a Cancel label

1 participant