방: 나가기 버튼을 막대로 빼고 ← 홈도 나가기로, 이름 눌러 기록 카드, 게스트 경고, 관리자 계정별 기록

- 방 막대에 [🚪 나가기]를 두고 메뉴에서는 뺀다. [← 홈]도 같은 동작. 한 번 누르면 바로 나가고,
  게임 중에 자리에 앉아 있을 때만 기권 확인을 묻는다. 휴대폰은 방 링크 복사를 메뉴로 옮겨 한 줄에 맞춘다.
- 자리·관전자·결과 화면의 이름을 누르면 기록 카드(이 게임 판·승·패·무·승률, 이 방 전적, 전체 합계).
  GET /api/users/:id/stats (로그인 필요).
- 게스트 경고: 이름 정하기, 로그인 페이지, /me, 게스트가 있는 대기실.
- 관리자 사용자 상세: 전체 기록, 게임별 기록 표, 최근 게임(GET /api/admin/users/:id/games). 목록에 전적 열(PC).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-08 11:34:08 +09:00
parent f93ff4f656
commit 43156a9f63
17 changed files with 462 additions and 39 deletions

View File

@@ -112,9 +112,9 @@ try {
const codeOf = (p: Page) => new URL(p.url()).pathname.split('/').pop()!;
const userId = (nick: string) => app.db.query<{ id: string }, [string]>('SELECT id FROM users WHERE nickname = ?').get(nick)?.id;
await step('오목(게임 중): ← 홈·새로고침 → 자리는 남고 접속은 끊김, 사이트가 열려 있으면 30분 뒤 정리', async () => {
await step('오목(게임 중): 사이트 로고로 홈·새로고침 → 자리는 남고 접속은 끊김, 사이트가 열려 있으면 30분 뒤 정리', async () => {
const code = codeOf(a);
await a.getByRole('button', { name: '홈으로' }).click();
await a.locator('.site-logo').click();
await a.waitForURL(`${ORIGIN}/`);
const room = app.rooms.get(code)!;
for (let i = 0; i < 50 && room.conns.size; i++) await Bun.sleep(20);
@@ -213,15 +213,15 @@ try {
console.log(` one-card: my turns ${mine}, computer turns seen ${botTurns}`);
});
// ---------------------------------------------------------------- leaving with the menu, guest logout
await step('원카드: 메뉴 → 방 나가기 → 방이 바로 닫힘', async () => {
// ---------------------------------------------------------------- leaving with ← 홈 / 🚪 나가기, guest logout
await step('원카드(게임 중): ← 홈 → 기권 확인 → 방이 바로 닫힘', async () => {
const code = codeOf(b);
if (!app.rooms.get(code)) throw new Error('room missing before leaving');
const result = b.getByRole('dialog', { name: '게임 결과' });
if (await result.count()) await result.getByRole('button', { name: '방 나가기' }).click();
else {
await b.getByRole('button', { name: '메뉴' }).click();
await b.getByRole('button', { name: '🚪 방 나가기' }).click();
await b.getByRole('button', { name: '방 나가고 홈으로' }).click();
await b.getByText('게임 중에 나가면 기권으로 처리돼요.').waitFor();
await b.getByRole('button', { name: '나가기', exact: true }).click();
}
await b.waitForURL(`${ORIGIN}/`);
@@ -229,6 +229,18 @@ try {
if (app.rooms.get(code)) throw new Error('room still open after everyone left');
});
await step('대기실: 🚪 나가기 한 번에 나감(확인 없음) → 방이 바로 닫힘', async () => {
await b.goto(`${ORIGIN}/g/one-card`);
await b.getByRole('button', { name: '🤖 컴퓨터와 연습하기' }).click();
await b.waitForURL(/\/r\/\d{6}$/);
await b.getByLabel('자리').getByText('컴퓨터 1').waitFor();
const code = codeOf(b);
await b.getByRole('button', { name: '🚪 나가기' }).click();
await b.waitForURL(`${ORIGIN}/`);
for (let i = 0; i < 50 && app.rooms.get(code); i++) await Bun.sleep(20);
if (app.rooms.get(code)) throw new Error('room still open after leaving the lobby');
});
await step('게스트 로그아웃 → 계정 삭제', async () => {
const id = userId('호랑이')!;
await a.getByRole('button', { name: '내 계정: 호랑이' }).click();

View File

@@ -229,8 +229,7 @@ try {
if (liveA.length < 5 || liveB.length < 5) throw new Error(`hands too small: ${liveA.length}, ${liveB.length}`);
if (liveA.some((c) => liveB.includes(c))) throw new Error('hands overlap');
// B leaves mid-game → A wins.
await b.getByRole('button', { name: '메뉴' }).tap();
await b.getByRole('button', { name: '🚪 방 나가기' }).tap();
await b.getByRole('button', { name: '🚪 나가기' }).tap();
await b.getByRole('button', { name: '나가기', exact: true }).tap();
await b.waitForURL(`${ORIGIN}/`);
await a.getByText('🎉 이겼어요!').waitFor();