Merge branch 'wip/game-case-file' into codex/owner/grp_discord_joke-app
# Conflicts: # apps/web/src/games/help.test.ts # apps/web/src/games/registry.ts # apps/web/src/lib/catalog-ui.ts # docs/games/README.md # packages/games/package.json # packages/games/src/index.ts # packages/shared/src/catalog.ts
This commit is contained in:
@@ -1302,6 +1302,94 @@ async function tichuStep(p: Page, isHost: boolean, st: Record<string, number>):
|
||||
}
|
||||
|
||||
const PLANS: Record<string, Plan> = {
|
||||
'case-file': {
|
||||
// PC host + phone guest, "고른 사람만 읽기": 의뢰 → 반장 돌기(두 번 눌러 고르기) → 단서 읽기(다른 사람은 제목만)
|
||||
// → 깊이 보기 → 하루 마치기 → 보고서 → 결과(정답·놓친 단서). Phone screenshots at 390 and 320 px.
|
||||
players: 2,
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('group', { name: '단서 글 읽기' }).getByRole('button', { name: '고른 사람만 읽기' }).click();
|
||||
await host.getByText('한 사람만 읽기').first().waitFor();
|
||||
},
|
||||
drive: async (pages) => {
|
||||
const [host, guest] = pages as [Page, Page];
|
||||
const status = (p: Page) => p.locator('.turn-status').innerText();
|
||||
const twice = async (p: Page, name: string | RegExp) => {
|
||||
await p.getByRole('button', { name }).first().click();
|
||||
await p.getByRole('button', { name: '정말 이걸로 해요' }).first().click();
|
||||
};
|
||||
for (const p of pages) await p.getByRole('button', { name: /수사 시작/ }).click();
|
||||
await host.getByRole('tab', { name: '단서' }).waitFor();
|
||||
const captain = async () => {
|
||||
for (let t = 0; t < 100; t++) {
|
||||
for (const p of pages) if ((await status(p)).includes('내가 반장이에요')) return p;
|
||||
await host.waitForTimeout(100);
|
||||
}
|
||||
throw new Error('nobody is captain');
|
||||
};
|
||||
let reads = 0;
|
||||
let deep = false;
|
||||
let readerChecked = false;
|
||||
for (let round = 0; round < 4; round++) {
|
||||
const cap = await captain();
|
||||
const other = cap === host ? guest : host;
|
||||
if (!deep && (await cap.getByRole('button', { name: /깊이 보기\(돋보기/ }).count())) {
|
||||
await cap.getByRole('button', { name: /깊이 보기\(돋보기/ }).click();
|
||||
await cap.getByRole('button', { name: '정말 이걸로 해요' }).click();
|
||||
await cap.locator('.cf-deep').first().waitFor();
|
||||
deep = true;
|
||||
}
|
||||
if (round === 0) await other.getByRole('button', { name: '👍 추천' }).first().click();
|
||||
await twice(cap, '고르기');
|
||||
reads++;
|
||||
await host.getByRole('tab', { name: `기록 ${reads}` }).waitFor();
|
||||
if (!readerChecked) {
|
||||
await other.getByText(/님이 읽고 있어요/).first().waitFor();
|
||||
await cap.locator('.cf-paper .cf-doc').first().waitFor();
|
||||
readerChecked = true;
|
||||
}
|
||||
}
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-leads-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-leads-phone.png'), fullPage: true });
|
||||
await guest.setViewportSize({ width: 320, height: 700 });
|
||||
await guest.waitForTimeout(200);
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-leads-phone320.png'), fullPage: true });
|
||||
const overflow = await guest.evaluate(() => document.documentElement.scrollWidth > window.innerWidth + 1);
|
||||
if (overflow) throw new Error('page overflows horizontally at 320px');
|
||||
await guest.getByRole('tab', { name: /기록/ }).click();
|
||||
await guest.locator('.cf-log button.cf-row').first().click();
|
||||
await guest.getByRole('dialog').locator('.cf-paper').waitFor();
|
||||
await guest.waitForTimeout(600);
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-reading-phone320.png') });
|
||||
await guest.getByRole('button', { name: '닫기' }).last().click();
|
||||
await guest.getByRole('tab', { name: '단서' }).click();
|
||||
let cap = await captain();
|
||||
await twice(cap, /하루 마치기/);
|
||||
await host.getByText(/2일째 09:00/).first().waitFor();
|
||||
cap = await captain();
|
||||
await twice(cap, '📝 보고서 쓰기');
|
||||
for (const p of pages) {
|
||||
await p.getByRole('button', { name: '📝 보고서 내기' }).waitFor();
|
||||
const groups = p.locator('.cf-choices');
|
||||
const n = await groups.count();
|
||||
for (let i = 0; i < n; i++) await groups.nth(i).getByRole('button').first().click();
|
||||
}
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-report-phone320.png'), fullPage: true });
|
||||
for (const p of pages) {
|
||||
await p.getByRole('button', { name: '📝 보고서 내기' }).click();
|
||||
await p.getByRole('button', { name: /정말 낼까요/ }).click();
|
||||
}
|
||||
await host.getByRole('dialog', { name: '게임 결과' }).waitFor();
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-result-dialog-pc.png') });
|
||||
await host.keyboard.press('Escape');
|
||||
await guest.getByRole('dialog', { name: '게임 결과' }).waitFor();
|
||||
await guest.keyboard.press('Escape');
|
||||
await host.getByText('정답과 풀이').waitFor();
|
||||
await host.getByRole('button', { name: /놓친 단서 보기/ }).click();
|
||||
await host.screenshot({ path: join(SHOTS, 'case-file-result-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'case-file-result-phone320.png'), fullPage: true });
|
||||
console.log(` case-file: ${reads} leads read, deep look ${deep ? 'used' : 'not offered'}, reader mode secret checked`);
|
||||
},
|
||||
},
|
||||
blackjack: {
|
||||
// PC host + phone guest. Each hand: bet the minimum, stand (decline insurance), then press 다음 판, until the
|
||||
// session ends (10 hands). Smoke test only — the rules are covered by the engine tests.
|
||||
|
||||
Reference in New Issue
Block a user