제한 시간 보정: 같은 단계의 채팅은 준 시간을 유지, 대표자 마감은 실제 답할 사람 기준, 바뀐 마감은 항상 화면에 전달; 이의있음! 재선택 창은 같은 후보여도 이의있음! 화면 뒤에

- room: reveal을 단계(마감·답할 사람·시간 재는 사람)가 바뀔 때만 새로 시작, clockExtra(대표자는 답할 사람들 중 가장 늦은 화면 기준),
  마지막으로 보낸 마감(sentDeadline)과 비교해 deadline 메시지
- 증강 윷놀이 AugSelect: 고를 때마다 새 키(같은 후보 재추첨도 새 창), 열림 조건에 !blocked, 고르는 중(pending)엔 자동으로 안 열림
- 테스트: 오목 마감 연장 전달, 라이어식 공통 단계(대표자 A·답할 사람 B·채팅), e2e 같은 후보 재선택·화면 타이머 = 서버 마감
- e2e 매지컬 애슬릿: 주사위·이동을 다 보여 준 뒤 다음 선택이 나와 한 판이 길어져 시간 한도 420초 → 900초

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 11:33:11 +09:00
parent fa53175f51
commit bc8cb7ae8c
6 changed files with 144 additions and 16 deletions

View File

@@ -3712,7 +3712,8 @@ const PLANS: Record<string, Plan> = {
let power = false;
let wild = false;
const over = () => host.getByRole('dialog', { name: '게임 결과' }).count();
const until = Date.now() + 420_000;
// (every roll and move plays out before the next choice shows, so a whole game takes a while)
const until = Date.now() + 900_000;
while (Date.now() < until && !(await over())) {
if (!shots.has('draft') && (await host.locator('section[aria-label="선수 뽑기"]').count()) && st.picks >= 3) {
shots.add('draft');

View File

@@ -157,7 +157,7 @@ try {
await p.context().close();
});
await step('증강 윷놀이: 이의있음! 화면이 사라진 뒤에 다시 고르는 창이 열림', async () => {
await step('증강 윷놀이: 이의있음! 화면이 사라진 뒤에 다시 고르는 창이 열림(같은 후보가 다시 나와도)', async () => {
const { p, room, me, bot } = await practice('yut', '호랑이', (o) => ({ ...o, augmented: true }));
for (let i = 0; i < 100 && !room.game.state.aug?.select; i++) await Bun.sleep(50);
const st = () => room.game.state;
@@ -169,6 +169,12 @@ try {
sel.offers[theirs] = [];
sel.left[theirs] = 0;
sel.picks = [{ side: Number(theirs), id: 'objection' }];
// The redo deals me the very same offers again (the window must still wait for the call to go away).
const send = room.broadcastState.bind(room);
room.broadcastState = (...args: unknown[]) => {
if (st().aug.select?.redo) st().aug.select.offers[mine] = ['shield', 'tiger', 'fog'];
return send(...args);
};
room.broadcastState([]);
if (!(await p.locator('.aug-cards').count())) await p.getByRole('button', { name: '증강 후보 보기' }).click();
await p.locator('.aug-card').first().click();
@@ -180,6 +186,7 @@ try {
await Bun.sleep(50);
}
await p.getByRole('dialog', { name: /증강 선택/ }).waitFor({ timeout: 10_000 });
if (st().aug.select.offers[mine].join() !== 'shield,tiger,fog') throw new Error('the redo did not deal the same offers');
console.log(` yut-aug: 이의있음! on screen ${Date.now() - t0}ms, then the redo selection`);
await p.context().close();
});
@@ -206,12 +213,18 @@ try {
const waited = Date.now() - t0;
if (waited < 10_000) throw new Error(`the choice showed after ${waited}ms; the flip at ×1/8 should take longer than the 10 s choice time`);
if (room.game.state.phase.kind !== 'afterCorrect' || room.game.state.current !== me) throw new Error('the server timed my choice out while the screen was still animating');
// The clock on my screen is the server's (moved) deadline, not the one sent with the state.
await Bun.sleep(500);
const label = (await p.locator('[role="timer"]').first().getAttribute('aria-label')) ?? '';
const shown = Number(label.match(/(\d+)초/)?.[1] ?? NaN);
const left = (room.effectiveDeadline() - Date.now()) / 1000;
if (!(Math.abs(shown - left) <= 1.5)) throw new Error(`screen timer says ${shown}s, server has ${left.toFixed(1)}s left`);
await Bun.sleep(3000);
await stop.click();
for (let i = 0; i < 50 && room.game.state.phase.kind === 'afterCorrect'; i++) await Bun.sleep(100);
if (room.game.state.idle[me]) throw new Error('my stop counted as a timeout');
if (room.game.state.current === me) throw new Error('stopping did not pass the turn');
console.log(` davinci-code: choice shown ${waited}ms after the guess, stopped 3 s later without a timeout`);
console.log(` davinci-code: choice shown ${waited}ms after the guess (timer ${shown}s, server ${left.toFixed(1)}s), stopped 3 s later without a timeout`);
await p.context().close();
setSpeed(1);
});