채팅 소리(스타크래프트 같은 "띠릭"): 새 채팅 줄마다(내가 보낸 줄도) 맑은 두 음이 올라가는 짧은 소리. 크기는 게임 소리 기준(0.15)의 90%로 소리 크기 설정을 그대로 따르고, 소리 끄기면 안 남. 몰려 온 줄은 한 번만. 방에 (다시) 들어올 때 서버가 다시 보내는 지난 채팅은 replay 표시로 조용히. 마피아·라이어 게임 안 채팅도 같은 소리. feedback.test.ts, room.test.ts, chat.e2e.ts에 확인 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 09:42:31 +09:00
parent e0139f412e
commit b7d5b3ad75
10 changed files with 212 additions and 7 deletions

View File

@@ -1,7 +1,8 @@
/**
* E2E: the room chat stays at the newest line (also after more than 100 lines, when the list is full), lets the reader
* scroll up without jumping, shows who said what as a name line + bubble, and has no "가리기" button any more.
* PC lobby + PC in-game side panel + phone chat sheet (unread badge past 100 lines too) + narrowed PC window (720–1099px) chat button.
* PC lobby + PC in-game side panel + phone chat sheet (unread badge past 100 lines too) + narrowed PC window (720–1099px) chat button
* + chat sound on live lines only.
* Run: E2E_PORT=4641 bun e2e/chat.e2e.ts (needs apps/web/dist built)
*/
import { chromium, type Page } from 'playwright-core';
@@ -241,6 +242,38 @@ try {
if (await a.locator('.room-bar').getByRole('button', { name: /^채팅/ }).count()) throw new Error('chat button still on the wide bar');
});
await step('채팅 소리: 새 줄마다 "띠릭"(보낸 사람도), 다시 들어올 때 받는 지난 줄은 조용히', async () => {
// Count the chat sound's first note (1568 Hz) as it is scheduled.
const rec = () => {
const w = window as unknown as { __chatBeeps: number };
w.__chatBeeps = 0;
const orig = AudioParam.prototype.setValueAtTime;
AudioParam.prototype.setValueAtTime = function (v: number, t: number) {
if (v === 1568) w.__chatBeeps++;
return orig.call(this, v, t);
};
};
const beeps = (p: Page) => p.evaluate(() => (window as unknown as { __chatBeeps: number }).__chatBeeps);
await b.addInitScript(rec);
await a.evaluate(rec);
await b.evaluate(rec);
await a.waitForTimeout(200);
await say(a, '소리 확인');
await b.waitForFunction(() => (window as unknown as { __chatBeeps: number }).__chatBeeps === 1, null, { timeout: 5000 });
await a.waitForFunction(() => (window as unknown as { __chatBeeps: number }).__chatBeeps === 1, null, { timeout: 5000 });
// Reload: the room resends its chat history, which must not beep.
await b.reload();
await b.getByRole('button', { name: /^채팅/ }).click();
const sheet = b.getByRole('dialog', { name: '채팅' });
await sheet.locator('.chat-line', { hasText: '소리 확인' }).waitFor();
await b.waitForTimeout(500);
if ((await beeps(b)) !== 0) throw new Error(`history beeped ${await beeps(b)} times`);
await say(a, '다시 들어온 뒤');
await sheet.locator('.chat-line', { hasText: '다시 들어온 뒤' }).waitFor();
await b.waitForFunction(() => (window as unknown as { __chatBeeps: number }).__chatBeeps === 1, null, { timeout: 5000 });
await sheet.getByRole('button', { name: '닫기' }).click();
});
await step('소리 크기: 방 막대 오른쪽 위, 기본 50, 0~100', async () => {
const btn = a.locator('.room-bar').getByRole('button', { name: /^소리 크기/ });
if ((await btn.getAttribute('aria-label')) !== '소리 크기 50') throw new Error(`default: ${await btn.getAttribute('aria-label')}`);