Skip to content

refactor: extract editMessage helper to pages/sessions.ts#866

Open
empiricalrun[bot] wants to merge 7 commits intomainfrom
chat-session_FkMfXGCx3KcF
Open

refactor: extract editMessage helper to pages/sessions.ts#866
empiricalrun[bot] wants to merge 7 commits intomainfrom
chat-session_FkMfXGCx3KcF

Conversation

@empiricalrun
Copy link
Copy Markdown
Contributor

@empiricalrun empiricalrun Bot commented Apr 22, 2026

Summary

Found a repeated edit message flow duplicated identically across 3 test files. Extracted it into a single editMessage helper in tests/pages/sessions.ts.

The pattern (repeated in 3 files)

const userMessageBubble = page.locator('[data-message-id]').filter({ hasText: currentMessage }).first();
await userMessageBubble.hover();
await userMessageBubble.getByRole('button', { name: 'Edit message' }).click();
const editTextbox = page.getByRole('textbox', { name: 'Edit your message...' });
await editTextbox.fill(newMessage);
await page.getByRole('button', { name: 'Save Changes' }).click();

New helper in tests/pages/sessions.ts

export async function editMessage(page: Page, currentMessage: string, newMessage: string): Promise<void>

Files updated

  • tests/pages/sessions.ts — added the editMessage helper with JSDoc
  • tests/sessions.spec.ts — uses editMessage in the "edit message updates assistant response" test
  • tests/edit-message-github-diff.spec.ts — uses editMessage in the edit + GitHub diff test
  • tests/edit-message-branch-restore.spec.ts — uses editMessage in the branch restore test

TypeScript compiles with no errors.

PR created from session #122842

Updated at 2026-04-22 04:58:55.214 UTC

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.

0 participants