휴대폰에서 채팅을 보낸 뒤에도 키보드 유지: "보내기" 버튼을 누르면 포커스가 버튼으로 넘어가 입력 칸이 빠지고 키보드가 내려가던 것을, 버튼의 pointerdown/mousedown 기본 동작을 막아(lib/chat-input keepFocus) 포커스를 입력 칸에 두고, 보낸 뒤에도 입력 칸에 포커스를 다시 줌. 방 채팅(ChatPanel)·그림 맞히기·마피아·라이어 게임 채팅 모두. Esc로 빠져나가기와 포커스가 빠질 때 "입력 중" 끄기는 그대로. chat.e2e.ts(휴대폰 시트에서 보내기 탭)와 games.e2e.ts(catchmind·mafia·liar 보내기 버튼)에 확인 추가, docs/07에 한 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 10:25:06 +09:00
parent b61be627c9
commit 57351fd9d6
8 changed files with 58 additions and 12 deletions

View File

@@ -204,7 +204,7 @@ try {
await sheet.getByRole('button', { name: '닫기' }).click();
});
await step('휴대폰 채팅 시트: 새 메시지가 와도 입력 칸 포커스(키보드)가 그대로', async () => {
await step('휴대폰 채팅 시트: 새 메시지가 와도, 보내기를 눌러도 입력 칸 포커스(키보드)가 그대로', async () => {
await b.getByRole('button', { name: /^채팅/ }).click();
const sheet = b.getByRole('dialog', { name: '채팅' });
const input = sheet.locator('input[aria-label="메시지"]');
@@ -220,6 +220,12 @@ try {
await input.press('Enter');
await sheet.locator('.chat-line', { hasText: '치는 중 계속' }).waitFor();
if (!(await input.evaluate((el) => el === document.activeElement))) throw new Error('the chat box lost focus after sending');
// Tapping 보내기 (not the keyboard's send key) must not take the focus either, or the phone keyboard drops.
await input.pressSequentially('버튼으로 보냄');
await sheet.getByRole('button', { name: '보내기' }).tap();
await sheet.locator('.chat-line', { hasText: '버튼으로 보냄' }).waitFor();
await b.waitForTimeout(150);
if (!(await input.evaluate((el) => el === document.activeElement))) throw new Error('the chat box lost focus after tapping 보내기');
await sheet.getByRole('button', { name: '닫기' }).click();
});

View File

@@ -4,7 +4,7 @@
* the keyboard (role="grid" boards support arrows + Enter) and reach the opponent.
* Run: bun e2e/games.e2e.ts [gameId...] (needs apps/web/dist built)
*/
import { chromium, type Page } from 'playwright-core';
import { chromium, type Locator, type Page } from 'playwright-core';
import { mkdirSync, mkdtempSync } from 'node:fs';
import { join } from 'node:path';
import { loadConfig } from '../apps/server/src/config';
@@ -929,8 +929,8 @@ async function catchmindTurn(pages: Page[], turn: number, shots: boolean): Promi
await input.fill(text);
await input.press('Enter');
};
// Wrong guess: visible to the drawer too.
await send('모르겠어요');
// Wrong guess (with the 맞히기 button; the box keeps the focus): visible to the drawer too.
await sendByButton(guesser, input, guesser.locator('.cm-form button'), '모르겠어요');
await drawer.locator('.cm-chat-list').getByText('모르겠어요').first().waitFor();
// Close guess (last syllable's final consonant changed): "아까워요" for the guesser only.
const close = await guesser.evaluate((w) => {
@@ -980,6 +980,17 @@ async function mafiaPick(p: Page, nick: string) {
await p.locator('button.mf-tile[aria-pressed="true"]', { has: p.locator('.nm', { hasText: new RegExp(`^${nick}( \\(나\\))?$`) }) }).waitFor({ timeout: 15_000 });
}
/** Game chat box: sends a line with its button (a tap on phones) and checks the box keeps the focus (phone keyboard stays up). */
async function sendByButton(p: Page, box: Locator, button: Locator, text: string) {
await box.click();
await box.fill(text);
if (await p.evaluate(() => 'ontouchstart' in window)) await button.tap();
else await button.click();
await p.waitForFunction((el) => (el as HTMLInputElement).value === '', await box.elementHandle(), { timeout: 5000 });
await p.waitForTimeout(150);
if (!(await box.evaluate((el) => el === document.activeElement))) throw new Error(`the chat box lost focus after pressing the send button ("${text}")`);
}
/** 마피아: writes in the selected channel tab and waits until the line shows up. */
async function mafiaSay(p: Page, channel: '전체' | '마피아' | '죽은 사람', text: string) {
await p.getByRole('tab', { name: new RegExp(`^${channel} 채팅`) }).click();
@@ -2744,6 +2755,11 @@ const PLANS: Record<string, Plan> = {
await pages[citizen]!.getByLabel('토론 채팅 메시지').fill(`${LIAR_NICKS[L]}님이 수상해요`);
await pages[citizen]!.getByLabel('토론 채팅 메시지').press('Enter');
for (const p of pages) await p.locator('.lg-msgs .lg-msg', { hasText: '님이 수상해요' }).waitFor({ timeout: 15_000 });
{
const ph = pages[citizen === 1 ? 2 : 1]!; // a phone
await sendByButton(ph, ph.getByLabel('토론 채팅 메시지'), ph.locator('.lg-form').getByRole('button', { name: '보내기' }), '버튼으로 보낸 말');
for (const p of pages) await p.locator('.lg-msgs .lg-msg', { hasText: '버튼으로 보낸 말' }).waitFor({ timeout: 15_000 });
}
await liarShots(pages, '3-discussion', true);
await liarClean('discussion');
for (const p of pages) await p.getByRole('button', { name: /^토론 끝내기/ }).click();
@@ -2804,6 +2820,8 @@ const PLANS: Record<string, Plan> = {
await mafiaBanner(host, '인사 시간');
await mafiaSay(phone, '전체', '안녕하세요 반가워요');
await sendByButton(phone, phone.getByLabel('전체 채팅 메시지'), phone.locator('.mf-form').getByRole('button', { name: '보내기' }), '버튼으로 보낸 인사');
for (const p of pages) await p.locator('.mf-msgs .mf-msg', { hasText: '버튼으로 보낸 인사' }).waitFor({ timeout: 15_000 });
for (const p of pages) await p.locator('.mf-msgs .mf-msg', { hasText: '안녕하세요 반가워요' }).waitFor({ timeout: 15_000 });
// No chat pace limit: 15 lines typed back to back all show up right away, in order, on every screen.
{