merge: 최신 main을 토너먼트 조별 순위 카드에 통합한다

This commit is contained in:
2026-08-22 05:19:47 +00:00
16 changed files with 437 additions and 10 deletions
@@ -0,0 +1,64 @@
import { expect, test, type Page } from '@playwright/test';
import { gamePath } from './gameTestPaths.js';
const currentCommitSha = process.env.PLAYWRIGHT_BUILD_COMMIT_SHA ?? '0123456789abcdef0123456789abcdef01234567';
const nextCommitSha = '89abcdef0123456789abcdef0123456789abcdef';
const noticeMessage = '새 버전이 준비되었습니다. 새로고침하면 변경사항이 반영됩니다.';
const installVersionFixture = async (page: Page) => {
let availableCommitSha = currentCommitSha;
let requests = 0;
await page.route('**/deployment-version.json*', async (route) => {
requests += 1;
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ commitSha: availableCommitSha }),
});
});
return {
deployNextVersion: () => {
availableCommitSha = nextCommitSha;
},
requestCount: () => requests,
};
};
for (const viewport of [
{ name: 'desktop', width: 1280, height: 800 },
{ name: 'mobile', width: 390, height: 844 },
]) {
test(`shows one quiet update toast without forcing reload on ${viewport.name}`, async ({ page }) => {
await page.setViewportSize({ width: viewport.width, height: viewport.height });
const fixture = await installVersionFixture(page);
await page.goto(gamePath('/version-notice-fixture'));
await expect(page.getByRole('heading', { name: 'Not Found' })).toBeVisible();
await expect.poll(fixture.requestCount).toBeGreaterThan(0);
await page.evaluate(() => {
Object.assign(window, { __versionNoticePageMarker: 'kept' });
});
fixture.deployNextVersion();
await expect
.poll(async () => {
await page.evaluate(() => window.dispatchEvent(new Event('online')));
return fixture.requestCount();
})
.toBeGreaterThan(1);
const toast = page.getByTestId('game-toast').filter({ hasText: noticeMessage });
await expect(toast).toBeVisible();
await expect(toast).toHaveAttribute('data-feedback-kind', 'info');
await expect(toast).toHaveCSS('transform', 'none');
const box = await toast.boundingBox();
expect(box).not.toBeNull();
expect(box!.x).toBeGreaterThanOrEqual(0);
expect(box!.y).toBeGreaterThanOrEqual(0);
expect(box!.x + box!.width).toBeLessThanOrEqual(viewport.width);
expect(box!.y + box!.height).toBeLessThanOrEqual(viewport.height);
expect(await page.evaluate(() => Reflect.get(window, '__versionNoticePageMarker'))).toBe('kept');
await page.getByRole('button', { name: '알림 닫기' }).click();
await page.evaluate(() => window.dispatchEvent(new Event('online')));
await expect(toast).toHaveCount(0);
});
}
+43
View File
@@ -84,6 +84,7 @@ type FixtureState = {
joinConfig?: Record<string, unknown>;
createGeneralInputs?: Array<Record<string, unknown>>;
mainTraits?: { personal: string; specialDomestic: string; specialWar: string };
mainTraitAges?: { specialDomestic: number; specialWar: number };
richMyInfo?: boolean;
hiddenSeedLogText?: string;
recentRecords?: {
@@ -137,6 +138,7 @@ const myGeneral = (state: FixtureState) => ({
}
: null,
traits: state.mainTraits ?? { personal: '-', specialDomestic: '-', specialWar: '-' },
traitAges: state.mainTraitAges ?? { specialDomestic: 31, specialWar: 31 },
traitInfo: state.richMyInfo
? {
personal: '부상당할 확률이 감소합니다.',
@@ -732,6 +734,47 @@ test('재야 메인은 국가 틀과 성격·특기 표기명을 Chromium에 표
await persistParityArtifact(page, 'main-neutral-trait-display', geometry);
});
test('메인 장수 정보는 없는 내정·전투 특기의 Ref 획득 나이를 Chromium에 표시한다', async ({ page }) => {
const state: FixtureState = {
permission: 'member',
myset: 0,
mainTraits: { personal: '안전', specialDomestic: '-', specialWar: '-' },
mainTraitAges: { specialDomestic: 35, specialWar: 29 },
settingMutations: [],
accessPages: [],
};
await install(page, state);
for (const viewport of [
{ width: 1000, height: 900 },
{ width: 390, height: 844 },
]) {
await page.setViewportSize(viewport);
await page.goto('');
const specialValue = page.locator('.general-card .special-value');
await expect(specialValue).toHaveText(/35\s*\/\s*31/u);
await expect(specialValue).toHaveAttribute('aria-label', '35세 / 31세');
const geometry = await specialValue.evaluate((element) => {
const rect = element.getBoundingClientRect();
const documentWidth = document.documentElement.scrollWidth;
return {
text: element.textContent?.replace(/\s+/gu, ' ').trim(),
left: rect.left,
right: rect.right,
width: rect.width,
documentWidth,
viewportWidth: window.innerWidth,
};
});
expect(geometry.width).toBeGreaterThan(0);
expect(geometry.left).toBeGreaterThanOrEqual(0);
expect(geometry.right).toBeLessThanOrEqual(geometry.documentWidth);
expect(geometry.documentWidth).toBe(Math.max(viewport.width, 500));
await persistParityArtifact(page, `main-speciality-age-${viewport.width}`, geometry);
}
});
test('메인 카드의 국가·수도·관직·계급·병종은 Ref 출력명으로 표시된다', async ({ page }) => {
const state: FixtureState = {
permission: 'head',
@@ -42,6 +42,7 @@ export default defineConfig({
'session-auth.spec.ts',
'npcPossession.spec.ts',
'joinLayout.spec.ts',
'deploymentVersionNotice.spec.ts',
],
fullyParallel: false,
workers: 1,