fix: 가오픈 동안 서버 게임 시계를 정지한다

정식 오픈 시각을 게임 시계 anchor로 전달하고, API가 실제 진행 상태와 시작 경계를 반환하게 한다. 프론트는 추가 조회 없이 경계에서 자동으로 시계를 시작한다.
This commit is contained in:
2026-08-21 16:57:42 +00:00
parent 26a51abb0b
commit f6f764da7f
14 changed files with 221 additions and 13 deletions
@@ -34,7 +34,10 @@ type NavigationFixture = {
generalName?: string;
generalTurnTime?: string;
serverTime?: string;
serverWallTime?: string;
clockMode?: 'realtime' | 'manual';
clockRunning?: boolean;
clockStartsAt?: string | null;
cityDefence?: number;
cityState?: number;
nationRate?: number;
@@ -555,7 +558,10 @@ const installFixture = async (page: Page, state: NavigationFixture) => {
month: state.currentMonth ?? 1,
turnTerm: 10,
serverTime: state.serverTime ?? '2026-08-13T00:00:00.000Z',
serverWallTime: state.serverWallTime ?? '2026-08-13T00:00:00.000Z',
clockMode: state.clockMode ?? 'realtime',
clockRunning: state.clockRunning ?? true,
clockStartsAt: state.clockStartsAt ?? null,
scenarioTitle: state.scenarioTitle ?? '',
});
}
@@ -1711,12 +1717,48 @@ test('main general card uses local turn time and command clock tracks corrected
}
state.clockMode = 'manual';
state.clockRunning = false;
state.serverTime = '2026-08-13T00:08:30.000Z';
await page.reload();
const frozenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
await expect(frozenClock).toHaveText('09:08:30');
await page.clock.runFor(2_000);
await expect(frozenClock).toHaveText('09:08:30');
state.clockMode = 'realtime';
state.clockRunning = false;
state.serverTime = '2026-08-13T00:10:00.000Z';
state.serverWallTime = '2026-08-21T10:00:00.000Z';
state.clockStartsAt = '2026-08-21T10:00:02.000Z';
await page.reload();
const preopenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
await expect(preopenClock).toHaveText('09:10:00');
const operationsBeforePreopenBoundary = state.operations.length;
await page.clock.runFor(1_500);
await expect(preopenClock).toHaveText('09:10:00');
if (artifactRoot) {
const preopenGeometry = await preopenClock.evaluate((element) => ({
rect: element.getBoundingClientRect().toJSON(),
overflow: element.scrollWidth - element.clientWidth,
fontSize: getComputedStyle(element).fontSize,
lineHeight: getComputedStyle(element).lineHeight,
value: element.textContent,
}));
expect(preopenGeometry.overflow).toBeLessThanOrEqual(0);
await Promise.all([
page.screenshot({
path: resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.png'),
fullPage: true,
}),
writeFile(
resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.json'),
`${JSON.stringify(preopenGeometry, null, 2)}\n`
),
]);
}
await page.clock.runFor(1_500);
await expect(preopenClock).toHaveText('09:10:01');
expect(state.operations).toHaveLength(operationsBeforePreopenBoundary);
});
test('message targets keep reply behavior and use nation-color contrast in labels and select options', async ({