마피아 컴퓨터 플레이어: 각자 타이머로 말하고 투표하는 라이브 봇, 똑똑한 편/허술한 편, 반응 속도 차이
- BotDriver live 모드: 컴퓨터마다 자기 타이머로 화면·채팅을 다시 보고 행동 하나 - mafia/bot.ts: 근거 추리(경찰 결과·경찰 주장·투표 기록) vs 느낌·분위기, 존댓말 vs 반말 - 채팅: 인사, 아침 소식, 지목·동의·반박, 이름 불리면 대답, 반론, 마피아 상의 - 연습 방 6명(PRACTICE_PLAYERS), BOT_GAMES에 mafia - 테스트: 옵션 조합별 전체 판, 똑똑한 편 승률, 자기 팀 지목 금지, 반응 속도, 대답 E2E Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,7 +70,7 @@ try {
|
||||
const pc = await browser.newContext({ viewport: { width: 1440, height: 900 }, locale: 'ko-KR' });
|
||||
const phone = await browser.newContext({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true, locale: 'ko-KR' });
|
||||
// The first-game "30초 규칙 요약" cards are tested in e2e/tutorial.e2e.ts; mark them seen here.
|
||||
for (const ctx of [pc, phone]) await ctx.addInitScript(() => { for (const g of ['omok', 'one-card', 'yacht']) localStorage.setItem(`bg:qs:${g}`, '1'); });
|
||||
for (const ctx of [pc, phone]) await ctx.addInitScript(() => { for (const g of ['omok', 'one-card', 'yacht', 'mafia']) localStorage.setItem(`bg:qs:${g}`, '1'); });
|
||||
const a = await pc.newPage();
|
||||
const b = await phone.newPage();
|
||||
const errors: string[] = [];
|
||||
@@ -266,6 +266,30 @@ try {
|
||||
await b.waitForURL(`${ORIGIN}/`);
|
||||
});
|
||||
|
||||
await step('마피아(연습, PC): 컴퓨터 5명 → 인사 채팅 → 이름을 부르면 대답', async () => {
|
||||
await a.goto(`${ORIGIN}/g/mafia`);
|
||||
await a.getByRole('button', { name: '🤖 컴퓨터와 연습하기' }).click();
|
||||
await a.waitForURL(/\/r\/\d{6}$/);
|
||||
await a.getByLabel('자리').getByText('컴퓨터 5').waitFor();
|
||||
await a.getByRole('button', { name: '▶ 게임 시작' }).click();
|
||||
// Role card (8 s), then the greeting: computers say hello at their own pace.
|
||||
const fromBots = a.locator('.mf-msgs .mf-msg:not(.sys)', { has: a.locator('strong', { hasText: /^컴퓨터 \d$/ }) });
|
||||
await a.waitForFunction(() => document.querySelectorAll('.mf-msgs .mf-msg:not(.sys)').length >= 2, null, { timeout: 40_000 });
|
||||
const hello = await fromBots.allInnerTexts();
|
||||
if (hello.length < 2) throw new Error(`computers said ${hello.length} lines`);
|
||||
await a.getByRole('tab', { name: /^전체 채팅/ }).click();
|
||||
await a.getByLabel('전체 채팅 메시지').fill('컴퓨터 2 직업 뭐야?');
|
||||
await a.getByLabel('전체 채팅 메시지').press('Enter');
|
||||
// The answer to the question (one of the "what's your job" lines), not just any line of 컴퓨터 2.
|
||||
const answer = a.locator('.mf-msgs .mf-msg', { has: a.locator('strong', { hasText: /^컴퓨터 2$/ }), hasText: /저 시민이에요|저는 시민이에요|나 시민ㅋㅋ|비밀ㅋㅋ|시민이지/ });
|
||||
await answer.first().waitFor({ timeout: 20_000 });
|
||||
console.log(` mafia: ${hello.slice(0, 3).join(' | ')} → ${await answer.first().innerText()}`);
|
||||
await a.screenshot({ path: join(SHOTS, 'bots-6-mafia-pc.png') });
|
||||
await a.getByRole('button', { name: '방 나가고 홈으로' }).click();
|
||||
await a.getByRole('button', { name: '나가기', exact: true }).click();
|
||||
await a.waitForURL(`${ORIGIN}/`);
|
||||
});
|
||||
|
||||
await step('게스트 로그아웃 → 계정 삭제', async () => {
|
||||
const id = userId('호랑이')!;
|
||||
await a.getByRole('button', { name: '내 계정: 호랑이' }).click();
|
||||
|
||||
Reference in New Issue
Block a user