Skip to content

test(e2e): add Playwright persistence happy-path test#2475

Merged
henrypark133 merged 2 commits intostagingfrom
test/e2e-message-persistence-happy-path
Apr 14, 2026
Merged

test(e2e): add Playwright persistence happy-path test#2475
henrypark133 merged 2 commits intostagingfrom
test/e2e-message-persistence-happy-path

Conversation

@henrypark133
Copy link
Copy Markdown
Collaborator

Summary

  • Adds test_message_persists_across_page_reload E2E test that validates the full persistence round-trip: send a message, reload the page, verify both user message and assistant response survive from DB
  • Cross-checks via history API for exactly 1 user turn with completed response
  • Extracted from fix(gateway): persist user messages at send time (#2409) #2434 (closed — the early gateway persist approach was dropped because it persisted before the safety pipeline)

Test plan

  • pytest scenarios/test_message_persistence.py -v passes locally (10.97s)
  • CI E2E tests pass

🤖 Generated with Claude Code

Add `test_message_persists_across_page_reload` which validates the full
persistence round-trip: send a message via the chat UI, reload the page
(clearing all client-side state), switch back to the thread, and verify
both user message and assistant response are restored from the database.

Cross-checks via the history API that exactly one user turn exists with
a completed response.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 20:41
@github-actions github-actions bot added size: XS < 10 changed lines (excluding docs) risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels Apr 14, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new end-to-end test to ensure that chat messages and assistant responses are correctly persisted and retrieved from the database after a page reload. The review feedback suggests improving test reliability by replacing a hardcoded sleep with a conditional wait and adhering to project conventions by using the centralized selector dictionary for the authentication screen.

Comment thread tests/e2e/scenarios/test_message_persistence.py Outdated
Comment thread tests/e2e/scenarios/test_message_persistence.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an end-to-end regression test to ensure chat messages persist across a full browser reload, validating both UI rehydration and server-side history persistence for a single completed turn.

Changes:

  • Add test_message_persists_across_page_reload Playwright E2E test covering send → persist → reload → re-render.
  • Validate persistence via both DOM assertions (user + assistant messages visible) and /api/chat/history cross-check (single completed user turn).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/e2e/scenarios/test_message_persistence.py Outdated
- Replace fixed `wait_for_timeout(2000)` with polling via history API
  until the turn reaches `Completed` state (avoids CI flakiness)
- Use `SEL["auth_screen"]` instead of hardcoded `"#auth-screen"`
  selector (follows project convention from helpers.py)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@henrypark133 henrypark133 merged commit 16a0731 into staging Apr 14, 2026
15 checks passed
@henrypark133 henrypark133 deleted the test/e2e-message-persistence-happy-path branch April 14, 2026 23:20
henrypark133 added a commit that referenced this pull request Apr 15, 2026
Merge staging into feat/rich-tool-history-cards, resolving the
test_message_persistence.py conflict (PR's superset version wins over
the basic staging version from #2475).

Also fix a bug where the processingThreads spinner would persist if a
background thread ended with "Interrupted", "Rejected", or
"Tool call denied." — only "Done" and "Awaiting approval" were clearing
the Set, leaving stale spinners until the next SSE reconnect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 15, 2026
This was referenced Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules size: XS < 10 changed lines (excluding docs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants