Skip to content

5.1.7 E2E-CHAT-008 Chat Search #396

Description

@flyblackbox

5.1.7 E2E-CHAT-008 Chat Search

Summary

Add Playwright end-to-end coverage for searching discussion chat by username and keyword.

This test should confirm that a logged-in user can search across existing discussions and receive relevant discussion threads or messages based on the query.

This is a P2 test because chat search improves usability and navigation across discussion history, but it is secondary to core posting, highlighting, voting, and commenting flows.

User Story

As a user, I want to search discussions by username or keyword.

Test Metadata

Field Value
Test ID E2E-CHAT-008
Feature Area Chat
Scenario Chat Search
Priority P2
Actor Registered User
Auth State Logged in
Required Account authorUser
Required Data Multiple discussion threads
Viewports Desktop, Mobile
Suggested Spec File chat.spec.ts
Source Generated

Test Steps

  1. Log in as authorUser.
  2. Ensure multiple discussion threads exist.
  3. Open the chat or discussions area.
  4. Enter a username into the chat search field.
  5. Confirm that relevant discussions involving that user appear.
  6. Clear the search field.
  7. Enter a keyword that appears in one or more discussion messages.
  8. Confirm that relevant discussions or messages appear.
  9. Open one of the returned results.
  10. Confirm the user is taken to the correct discussion thread or message context.
  11. Repeat the test in desktop and mobile Playwright projects.

Expected Result

The user can search discussions by username or keyword.

The application should:

  • Accept search input in the discussion search field
  • Return relevant discussions for username queries
  • Return relevant discussions or messages for keyword queries
  • Show a clear empty state when no results match
  • Allow the user to open a result
  • Preserve usable behavior on desktop and mobile

Required Assertions

  • Chat or discussions area loads successfully
  • Search input is visible and usable
  • Username search returns relevant discussion results
  • Keyword search returns relevant discussion or message results
  • Search results update after the query changes
  • Empty search state is handled clearly
  • User can open a returned discussion result
  • No unrelated discussions dominate the result list when a specific username or keyword is searched
  • No runtime error or generic error toast appears

Suggested Selectors

Use stable data-testid selectors where possible:

  • [data-testid="chat-page"]
  • [data-testid="discussion-list"]
  • [data-testid="chat-search-input"]
  • [data-testid="chat-search-result"]
  • [data-testid="discussion-thread"]
  • [data-testid="discussion-message"]
  • [data-testid="chat-empty-search-state"]

If these selectors do not exist yet, add them as part of the test implementation.

Technical Notes

If the UI handles username search and message keyword search through different controls or result types, this issue may be split into two tests:

  • Username-based discussion search
  • Keyword-based message search

The test should avoid depending on exact result ordering unless ranking or sorting rules are explicitly defined. Prefer asserting that the expected discussion or message appears somewhere in the result set.

Out of Scope

This issue does not need to test:

  • Sending a chat message
  • Real-time message delivery
  • Typing indicators
  • Presence indicators
  • Opening chat from highlighted text
  • Notification behavior
  • Full-text search ranking

Those workflows should be covered by separate chat or notification test issues.

Acceptance Criteria

  • Playwright test exists for chat search
  • Test logs in as authorUser
  • Test searches discussions by username
  • Test searches discussions or messages by keyword
  • Test verifies relevant results appear
  • Test verifies empty state behavior if no results match
  • Test verifies a result can be opened
  • Test runs on desktop and mobile Playwright projects
  • Test passes locally and in CI

Test Instructions

Run all Playwright tests:

npx playwright test

Run only chat tests:

npx playwright test chat.spec.ts

Run in headed mode for debugging:

npx playwright test chat.spec.ts --headed

Labels

testing e2e playwright chat search frontend p2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions