merge: 최신 main을 국가 메시지 편집기 보완에 통합한다

This commit is contained in:
2026-08-21 17:25:09 +00:00
40 changed files with 890 additions and 54 deletions
@@ -629,6 +629,10 @@ test('nation directory reuses only the public general-directory row on hover and
await expect(preview.locator('[data-general-card-id="10"]')).toContainText('대담');
await expect(preview.locator('[data-directory-tooltip="card-special-domestic-10"]')).toContainText('상재');
await expect(preview.locator('[data-directory-tooltip="card-special-war-10"]')).toContainText('귀모');
await expect(preview.locator('[data-directory-tooltip="card-special-domestic-10"]')).toHaveCSS(
'text-decoration-line',
'none'
);
await expect(preview).not.toContainText('user-');
await expect(preview).not.toContainText('secret');
+8 -2
View File
@@ -112,6 +112,7 @@ const myGeneral = (state: FixtureState) => ({
injury: 0,
experience: 100,
dedication: 200,
bill: 800,
age: 30,
turnTime: '2026-01-01 00:10:00',
recentWar: '2026-01-01 00:00:00',
@@ -296,6 +297,7 @@ const battleCenter = (state: FixtureState) => ({
stats: { leadership: 70, strength: 60, intelligence: 50 },
experience: 100,
dedication: 200,
bill: 800,
injury: 0,
gold: 1_000,
rice: 2_000,
@@ -334,6 +336,7 @@ const battleCenter = (state: FixtureState) => ({
stats: { leadership: 50, strength: 50, intelligence: 50 },
experience: 0,
dedication: 0,
bill: 400,
injury: 0,
gold: 500,
rice: 500,
@@ -1245,6 +1248,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
await expect(page.locator('.general-table')).toContainText('병종보병');
await expect(page.locator('.general-table')).toContainText('삭턴6 턴');
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
await expect(page.locator('.battle-general-extra')).toContainText('전투8회');
await expect(page.locator('.battle-general-extra')).toContainText('계략12');
await expect(page.locator('.battle-general-extra')).toContainText('사관4년');
@@ -1255,7 +1259,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
await expect(page.locator('.battle-general-extra__recent-value')).toHaveText('01-01 00:00');
await expect(page.locator('.legacy-general-details')).toHaveCount(0);
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
['명성', '계급', ''],
['명성', '계급', '봉급'],
['전투', '계략', '사관'],
['승률', '승리', '패배'],
['살상률', '사살', '피살'],
@@ -1429,6 +1433,7 @@ test('내 정보 항목과 국가 성향은 HTML 리치 툴팁을 마우스와
const showWithMouse = async (testId: string, expectedTexts: readonly string[]) => {
const trigger = page.locator(`[data-rich-tooltip="${testId}"]`);
await expect(trigger).toHaveAttribute('tabindex', '0');
await expect(trigger).toHaveCSS('text-decoration-line', 'none');
await trigger.hover();
await expect(visibleTooltip).toHaveCount(1);
await expect(visibleTooltip).toHaveAttribute('role', 'tooltip');
@@ -2039,6 +2044,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
await expect(page.locator('.battle-general-name')).toContainText('간의대부');
await expect(page.locator('.battle-general-name')).toContainText('건강');
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
await expect(page.locator('.battle-general-card')).toContainText('병종보병');
await expect(page.locator('.battle-general-card')).not.toContainText('che_');
await expect(page.locator('.battle-general-card')).toHaveAttribute('data-general-basic-card', '');
@@ -2049,7 +2055,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
await expect(page.locator('.battle-general-extra')).toContainText('승률62.50%');
await expect(page.locator('.battle-general-extra')).toContainText('살상률181.84%');
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
['명성', '계급', ''],
['명성', '계급', '봉급'],
['전투', '계략', '사관'],
['승률', '승리', '패배'],
['살상률', '사살', '피살'],
+228 -1
View File
@@ -34,8 +34,12 @@ type NavigationFixture = {
operations: string[];
generalName?: string;
generalTurnTime?: string;
nextTurnMonthOffset?: 0 | 1;
serverTime?: string;
serverWallTime?: string;
clockMode?: 'realtime' | 'manual';
clockRunning?: boolean;
clockStartsAt?: string | null;
cityDefence?: number;
cityState?: number;
nationRate?: number;
@@ -437,6 +441,7 @@ const generalContext = (state: NavigationFixture) => ({
crewTypeName: '보병',
traits: { personal: '대담', specialDomestic: '상재', specialWar: '무쌍' },
turnTime: state.generalTurnTime ?? '0185-01-01T00:00:00.000Z',
nextTurnMonthOffset: state.nextTurnMonthOffset ?? 0,
},
city: {
id: 1,
@@ -587,7 +592,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 ?? '',
});
}
@@ -1182,7 +1190,7 @@ test('desktop menus preserve ref columns, prefix-safe routes, and controlled dro
await expect(page.locator('.legacy-game-info')).toContainText('현재: 185년 1월');
await expect(page.locator('.legacy-game-info')).toContainText('턴: 10분');
await expect(page.locator('.legacy-game-info')).not.toContainText('최근 턴:');
await expect(page.locator('.execution-status')).toHaveText('동작 시각: 08-13 09:05');
await expect(page.locator('.execution-status')).toHaveText('현재 시각: 08-13 09:00');
await expect(page.locator('.tournament-status')).toHaveText('토너먼트: 참가 모집중');
await expect(page.locator('.vote-status')).toHaveText('설문: 메뉴 설문');
const headerStatusGeometry = await page.locator('.main-page').evaluate((element) => {
@@ -1617,6 +1625,105 @@ test('the repeated bottom global menu opens upward on the mobile document', asyn
await persistArtifact(page, `${basePath.slice(1)}-mobile-bottom-dropup`);
});
test('first reserved month crosses December only after the general turn has passed', async ({ page }, testInfo) => {
const state: NavigationFixture = {
officerLevel: 0,
permission: 0,
nationLevel: 0,
stage: 0,
npcMode: 1,
generalMeCalls: 0,
operations: [],
currentYear: 179,
currentMonth: 12,
nextTurnMonthOffset: 0,
validMapImages: true,
reservedTurns: [
{ index: 0, action: '휴식', args: {} },
{ index: 1, action: '휴식', args: {} },
],
};
await installRealtimeHarness(page);
await installFixture(page, state);
await page.setViewportSize({ width: 1200, height: 900 });
await waitForMain(page);
await waitForMainRealtime(page);
const map = page.locator('[data-main-target="map"] .map-viewer').first();
const commandPanel = page.locator('[data-main-target="commands"]').first();
const firstDate = commandPanel.locator('.date-column [data-turn-index="0"]');
const secondDate = commandPanel.locator('.date-column [data-turn-index="1"]');
await expect(map).toContainText('179年 12月');
await expect(firstDate).toHaveText('179年 12月');
await expect(secondDate).toHaveText('180年 1月');
const before = await firstDate.evaluate((element) => {
const rect = element.getBoundingClientRect();
const style = getComputedStyle(element);
return {
rect: rect.toJSON(),
fontSize: style.fontSize,
lineHeight: style.lineHeight,
color: style.color,
documentScrollWidth: document.documentElement.scrollWidth,
viewportWidth: window.innerWidth,
};
});
await commandPanel.screenshot({ path: testInfo.outputPath('turn-month-before.png') });
state.nextTurnMonthOffset = 1;
state.contextRevision = 'BBBBBBBBBBBBBBBBBBBBBB';
state.contextOperations = [{ op: 'replace', path: '/general/nextTurnMonthOffset', value: 1 }];
await emitReadModelInvalidation(page, readModelInvalidation({ context: true }));
await expect(map).toContainText('179年 12月');
await expect(firstDate).toHaveText('180年 1月');
await expect(secondDate).toHaveText('180年 2月');
await firstDate.hover();
const after = await firstDate.evaluate((element) => {
const rect = element.getBoundingClientRect();
const style = getComputedStyle(element);
return {
rect: rect.toJSON(),
fontSize: style.fontSize,
lineHeight: style.lineHeight,
color: style.color,
documentScrollWidth: document.documentElement.scrollWidth,
viewportWidth: window.innerWidth,
};
});
expect(after.rect.width).toBe(before.rect.width);
expect(after.rect.height).toBe(before.rect.height);
expect(after.rect.left).toBe(before.rect.left);
expect(after.rect.right).toBe(before.rect.right);
expect(after.fontSize).toBe(before.fontSize);
expect(after.lineHeight).toBe(before.lineHeight);
expect(after.color).toBe(before.color);
expect(before.documentScrollWidth).toBe(before.viewportWidth);
expect(after.documentScrollWidth).toBe(after.viewportWidth);
await commandPanel.screenshot({ path: testInfo.outputPath('turn-month-after.png') });
await page.setViewportSize({ width: 390, height: 844 });
await firstDate.scrollIntoViewIfNeeded();
await expect(firstDate).toHaveText('180年 1月');
const mobile = await firstDate.evaluate((element) => {
const rect = element.getBoundingClientRect();
const style = getComputedStyle(element);
return {
rect: rect.toJSON(),
fontSize: style.fontSize,
lineHeight: style.lineHeight,
documentScrollWidth: document.documentElement.scrollWidth,
};
});
expect(mobile.rect.left).toBeGreaterThanOrEqual(0);
expect(mobile.rect.right).toBeLessThanOrEqual(500);
expect(mobile.fontSize).toBe(before.fontSize);
expect(mobile.lineHeight).toBe(before.lineHeight);
expect(mobile.documentScrollWidth).toBe(500);
await commandPanel.screenshot({ path: testInfo.outputPath('turn-month-mobile.png') });
});
test('main general card uses local turn time and command clock tracks corrected server time', async ({ page }) => {
const state: NavigationFixture = {
officerLevel: 0,
@@ -1743,12 +1850,131 @@ 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('main header clock follows minute boundaries only while game-server contact is recent', async ({
page,
}, testInfo) => {
const state: NavigationFixture = {
officerLevel: 0,
permission: 0,
nationLevel: 0,
stage: 0,
npcMode: 1,
generalMeCalls: 0,
operations: [],
serverTime: '2026-08-13T00:00:35.000Z',
serverWallTime: '2026-08-13T00:00:00.000Z',
clockMode: 'realtime',
clockRunning: true,
};
await installRealtimeHarness(page);
await installFixture(page, state);
await page.clock.install({ time: new Date('2026-08-13T00:00:00.000Z') });
await page.setViewportSize({ width: 1200, height: 900 });
await waitForMain(page);
await waitForMainRealtime(page);
const clock = page.locator('.execution-status');
const initialRequestCount = state.trpcRequests?.length ?? 0;
await expect(clock).toHaveText('현재 시각: 08-13 09:00');
await expect(clock).not.toHaveClass(/execution-status--stale/u);
await page.clock.runFor(25_000);
await expect(clock).toHaveText('현재 시각: 08-13 09:01');
await page.clock.runFor(21_000);
await expect(clock).toHaveClass(/execution-status--stale/u);
await expect(clock).toHaveAttribute('title', '최근 45초 동안 서버 통신이 없어 시각 갱신을 멈췄습니다.');
await expect.poll(() => clock.evaluate((element) => getComputedStyle(element).color)).toBe('rgb(255, 0, 255)');
const staleDesktopGeometry = await clock.evaluate((element) => ({
rect: element.getBoundingClientRect().toJSON(),
overflow: element.scrollWidth - element.clientWidth,
color: getComputedStyle(element).color,
fontSize: getComputedStyle(element).fontSize,
lineHeight: getComputedStyle(element).lineHeight,
}));
expect(staleDesktopGeometry.rect.width).toBeCloseTo(333.33, 0);
expect(staleDesktopGeometry.rect.height).toBeGreaterThanOrEqual(36);
expect(staleDesktopGeometry.overflow).toBeLessThanOrEqual(0);
await clock.screenshot({ path: testInfo.outputPath('main-header-clock-stale-desktop-1200.png') });
await page.clock.runFor(60_000);
await expect(clock).toHaveText('현재 시각: 08-13 09:01');
await page.evaluate(() => {
(window as unknown as { __emitMainRealtime: (type: string, value: unknown) => void }).__emitMainRealtime(
'ping',
{}
);
});
await expect(clock).toHaveText('현재 시각: 08-13 09:02');
await expect(clock).not.toHaveClass(/execution-status--stale/u);
await page.clock.runFor(39_000);
await expect(clock).toHaveText('현재 시각: 08-13 09:03');
await expect.poll(() => clock.evaluate((element) => getComputedStyle(element).color)).toBe('rgb(0, 255, 255)');
await page.setViewportSize({ width: 500, height: 900 });
const freshMobileGeometry = await clock.evaluate((element) => ({
rect: element.getBoundingClientRect().toJSON(),
overflow: element.scrollWidth - element.clientWidth,
color: getComputedStyle(element).color,
fontSize: getComputedStyle(element).fontSize,
lineHeight: getComputedStyle(element).lineHeight,
documentScrollWidth: document.documentElement.scrollWidth,
}));
expect(freshMobileGeometry.rect.width).toBeCloseTo(166.67, 0);
expect(freshMobileGeometry.overflow).toBeLessThanOrEqual(0);
expect(freshMobileGeometry.documentScrollWidth).toBe(500);
await Promise.all([
clock.screenshot({ path: testInfo.outputPath('main-header-clock-fresh-mobile-500.png') }),
writeFile(
testInfo.outputPath('main-header-clock-geometry.json'),
`${JSON.stringify({ staleDesktopGeometry, freshMobileGeometry }, null, 2)}\n`
),
]);
expect(state.trpcRequests?.length ?? 0).toBe(initialRequestCount);
});
test('message targets keep reply behavior and use nation-color contrast in labels and select options', async ({
@@ -2064,6 +2290,7 @@ test('main cards and command input stay inside their Ref-sized grid slots', asyn
expect(Math.max(...nationRowHeights) - Math.min(...nationRowHeights)).toBeLessThanOrEqual(0.01);
const strategicCell = nationCard.locator('.strategic');
const strategicTooltip = strategicCell.getByRole('tooltip');
await expect(strategicCell).toHaveCSS('text-decoration-line', 'none');
await expect(strategicTooltip).toBeHidden();
await strategicCell.hover();
await expect(strategicTooltip).toBeVisible();
@@ -266,6 +266,7 @@ test('renders Ref-shaped token cards, preserves keep cooldown and retries posses
});
const tooltip = page.locator('.npc-tooltip').first();
const tooltipPopup = tooltip.getByRole('tooltip');
await expect(tooltip).toHaveCSS('text-decoration-line', 'none');
await expect(tooltipPopup).toBeHidden();
await tooltip.hover();
await expect(tooltipPopup).toBeVisible();
+29 -2
View File
@@ -80,7 +80,7 @@ const baseTroops = (): TroopFixture[] => [
name: '백마대',
nationId: 1,
turnTime: '2026-07-25T08:20:30.000Z',
reservedCommands: ['che_집합', 'che_이동'],
reservedCommands: ['집합', '-'],
leader: {
id: 1,
name: '공손찬',
@@ -96,7 +96,7 @@ const baseTroops = (): TroopFixture[] => [
name: '청룡대',
nationId: 1,
turnTime: '2026-07-25T08:30:30.000Z',
reservedCommands: ['che_징병'],
reservedCommands: ['-'],
leader: {
id: 2,
name: '관우',
@@ -224,6 +224,27 @@ const installApiFixture = async (page: Page, state: FixtureState) => {
});
};
test('shows only the Ref-safe first-five troop command labels on desktop and mobile', async ({ page }) => {
await installApiFixture(page, {
me: { id: 1, troopId: 1 },
permission: 4,
troops: baseTroops(),
});
for (const viewport of [
{ width: 1000, height: 800 },
{ width: 500, height: 800 },
]) {
await page.setViewportSize(viewport);
await gotoTroop(page);
const firstTroopCommands = page.locator('.troopReservedCommand').first();
await expect(firstTroopCommands).toContainText('1: 집합');
await expect(firstTroopCommands).toContainText('2: -');
await expect(page.locator('#troopList')).not.toContainText('che_');
}
});
test('renders the legacy desktop grid with matching computed geometry and states', async ({ page }) => {
await installApiFixture(page, {
me: { id: 1, troopId: 1 },
@@ -233,6 +254,9 @@ test('renders the legacy desktop grid with matching computed geometry and states
await page.setViewportSize({ width: 1000, height: 800 });
await gotoTroop(page);
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
await expect(page.locator('#troopList')).not.toContainText('che_');
const geometry = await page
.locator('.troopItem')
@@ -319,6 +343,9 @@ test('matches the legacy 500px responsive placement', async ({ page }) => {
await page.setViewportSize({ width: 500, height: 800 });
await gotoTroop(page);
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
await expect(page.locator('#troopList')).not.toContainText('che_');
const geometry = await page
.locator('.troopItem')