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
- Log in as
authorUser.
- Ensure multiple discussion threads exist.
- Open the chat or discussions area.
- Enter a username into the chat search field.
- Confirm that relevant discussions involving that user appear.
- Clear the search field.
- Enter a keyword that appears in one or more discussion messages.
- Confirm that relevant discussions or messages appear.
- Open one of the returned results.
- Confirm the user is taken to the correct discussion thread or message context.
- 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
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
E2E-CHAT-008P2authorUserchat.spec.tsTest Steps
authorUser.Expected Result
The user can search discussions by username or keyword.
The application should:
Required Assertions
Suggested Selectors
Use stable
data-testidselectors 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:
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:
Those workflows should be covered by separate chat or notification test issues.
Acceptance Criteria
authorUserTest Instructions
Run all Playwright tests:
npx playwright testRun only chat tests:
npx playwright test chat.spec.tsRun in headed mode for debugging:
npx playwright test chat.spec.ts --headedLabels
testinge2eplaywrightchatsearchfrontendp2