fix(archive): 지난 플레이를 현재 프로필 기록으로 제한

현재 profile schema의 Core2026 기록과 같은 source_profile의 PHP archive만 결합한다. 클라이언트 profile 입력과 7개 교차 profile 탭을 제거하고 API 및 Chromium 회귀 검증을 갱신한다.
This commit is contained in:
2026-08-19 05:52:12 +00:00
parent 71bbe9d240
commit 4c76afd576
4 changed files with 52 additions and 141 deletions
+9 -24
View File
@@ -5,29 +5,27 @@ import { expect, test, type Page, type Route } from '@playwright/test';
import { gamePath, gameProfile, gameTrpcRoute } from './gameTestPaths.js';
const response = (data: unknown) => ({ result: { data } });
const gameProfileId = gameProfile.split(':', 1)[0] ?? 'che';
const operationNames = (route: Route) =>
decodeURIComponent(new URL(route.request().url()).pathname.split('/trpc/')[1] ?? '').split(',');
const installArchive = async (page: Page, options: { battleAvailable?: boolean; abandoned?: boolean } = {}) => {
const requestedProfiles: string[] = [];
const archiveRequestBodies: string[] = [];
await page.addInitScript((profile) => {
localStorage.setItem('sammo-game-token', 'ga_archive');
localStorage.setItem('sammo-game-profile', profile);
}, gameProfile);
await page.route(gameTrpcRoute, async (route) => {
const requestBody = route.request().postData() ?? '';
const requestedProfile = ['che', 'kwe', 'pwe', 'twe', 'nya', 'pya', 'hwe'].find((profile) =>
requestBody.includes(`"sourceProfile":"${profile}"`)
);
const results = operationNames(route).map((operation) => {
if (operation === 'auth.status') return response({ ok: true });
if (operation === 'lobby.info') return response({ myGeneral: null });
if (operation === 'archive.myPastPlays') {
requestedProfiles.push(requestedProfile ?? 'missing');
archiveRequestBodies.push(requestBody);
return response({
seasons: [
{
sourceProfile: requestedProfile ?? 'che',
sourceProfile: gameProfileId,
source: options.abandoned ? 'current' : 'legacy',
serverId: 'che_2024_01',
openedAt: '2024-01-31T00:00:00.000Z',
@@ -155,26 +153,17 @@ const installArchive = async (page: Page, options: { battleAvailable?: boolean;
});
await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(results) });
});
return { requestedProfiles };
return { archiveRequestBodies };
};
test('과거 장수 기록을 체·퀘·풰·퉤·냐·퍄·훼 서버별로 나누어 조회한다', async ({ page }) => {
test('현재 게임 profile 기록만 조회하고 교차 profile 선택기를 노출하지 않는다', async ({ page }) => {
const state = await installArchive(page);
await page.goto('past-plays');
const tabs = page.getByRole('navigation', { name: '과거 장수 서버 선택' });
await expect(tabs.getByRole('button')).toHaveCount(7);
await expect(tabs.getByRole('button')).toHaveText(['체', '퀘', '풰', '퉤', '냐', '퍄', '훼']);
await expect(tabs.getByRole('button', { name: '체 서버' })).toHaveAttribute('aria-pressed', 'true');
await expect(tabs.getByRole('button', { name: '체 서버' })).toHaveCSS('color', 'rgb(135, 206, 235)');
await expect(page.getByRole('navigation', { name: '과거 장수 서버 선택' })).toHaveCount(0);
await expect(page.locator('.season-identity').getByText('체', { exact: true })).toBeVisible();
await tabs.getByRole('button', { name: '훼 서버' }).hover();
await expect(tabs.getByRole('button', { name: '훼 서버' })).toHaveCSS('color', 'rgb(135, 206, 235)');
await tabs.getByRole('button', { name: '훼 서버' }).click();
await expect(tabs.getByRole('button', { name: '훼 서버' })).toHaveAttribute('aria-pressed', 'true');
await expect(page.locator('.season-identity').getByText('훼', { exact: true })).toBeVisible();
expect(state.requestedProfiles).toEqual(['che', 'hwe']);
expect(state.archiveRequestBodies).toHaveLength(1);
expect(state.archiveRequestBodies[0]).not.toContain('sourceProfile');
});
test('지난 플레이 관직은 숫자 대신 저장된 Ref 표시명으로 나타난다', async ({ page }) => {
@@ -350,8 +339,6 @@ test('past plays keeps the legacy-width table scrollable on a mobile viewport',
const detailMetrics = await page.locator('.detail-shell').evaluate((element) => ({
width: element.getBoundingClientRect().width,
scrollWidth: element.scrollWidth,
profileTabsWidth: document.querySelector('.profile-tabs')!.getBoundingClientRect().width,
profileTabsScrollWidth: document.querySelector('.profile-tabs')!.scrollWidth,
hallRecordWidth: element.querySelector('[data-hall-battle-record]')!.getBoundingClientRect().width,
hallRecordScrollWidth: element.querySelector('[data-hall-battle-record]')!.scrollWidth,
hallColumns: getComputedStyle(element.querySelector('[data-hall-battle-record] dl')!).gridTemplateColumns,
@@ -360,8 +347,6 @@ test('past plays keeps the legacy-width table scrollable on a mobile viewport',
}));
expect(detailMetrics.width).toBe(498);
expect(detailMetrics.scrollWidth).toBe(498);
expect(detailMetrics.profileTabsWidth).toBe(500);
expect(detailMetrics.profileTabsScrollWidth).toBeLessThanOrEqual(detailMetrics.profileTabsWidth);
expect(detailMetrics.hallRecordWidth).toBeGreaterThan(0);
expect(detailMetrics.hallRecordScrollWidth).toBeLessThanOrEqual(detailMetrics.hallRecordWidth);
expect(detailMetrics.hallColumns.split(' ')).toHaveLength(3);
+5 -67
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { isLegacyArchiveProfile, LEGACY_ARCHIVE_PROFILES, type LegacyArchiveProfile } from '@sammo-ts/common';
import { isLegacyArchiveProfile, type LegacyArchiveProfile } from '@sammo-ts/common';
import GeneralBasicCard from '../components/main/GeneralBasicCard.vue';
import GeneralBattleSummary, { type GeneralBattleSummaryData } from '../components/main/GeneralBattleSummary.vue';
@@ -98,7 +98,6 @@ type PastPlayDetail = {
};
type PastPlayDetailInput = {
sourceProfile: string;
source: string;
serverId: string;
generalNo: number;
@@ -117,11 +116,6 @@ const profileLabels: Record<LegacyArchiveProfile, string> = {
pya: '퍄',
hwe: '훼',
};
const profileOptions = LEGACY_ARCHIVE_PROFILES.map((profile) => ({ profile, label: profileLabels[profile] }));
const configuredProfile = import.meta.env.VITE_GAME_PROFILE?.trim();
const selectedProfile = ref<LegacyArchiveProfile>(
configuredProfile && isLegacyArchiveProfile(configuredProfile) ? configuredProfile : 'che'
);
const archive = ref<Archive | null>(null);
const loading = ref(false);
@@ -130,35 +124,20 @@ const selectedKey = ref<string | null>(null);
const detail = ref<PastPlayDetail | null>(null);
const detailLoading = ref(false);
const detailError = ref<string | null>(null);
let archiveRequestId = 0;
const loadArchive = async () => {
const requestId = ++archiveRequestId;
const sourceProfile = selectedProfile.value;
if (loading.value) return;
loading.value = true;
error.value = null;
try {
const result = await trpc.archive.myPastPlays.query({ sourceProfile });
if (requestId === archiveRequestId) archive.value = result;
archive.value = await trpc.archive.myPastPlays.query();
} catch (cause) {
if (requestId === archiveRequestId) {
error.value = cause instanceof Error ? cause.message : '지난 플레이를 불러오지 못했습니다.';
}
error.value = cause instanceof Error ? cause.message : '지난 플레이를 불러오지 못했습니다.';
} finally {
if (requestId === archiveRequestId) loading.value = false;
loading.value = false;
}
};
const selectProfile = (profile: LegacyArchiveProfile): void => {
if (selectedProfile.value === profile) return;
selectedProfile.value = profile;
archive.value = null;
selectedKey.value = null;
detail.value = null;
detailError.value = null;
void loadArchive();
};
const yearMonth = (value: number): string => `${Math.floor(value / 100)}${value % 100}`;
const valueOrDash = (value: number | string | null): string => (value === null || value === '' ? '-' : String(value));
const hallNumber = (value: number | null): string =>
@@ -204,7 +183,6 @@ const selectGeneral = async (season: ArchiveSeason, generalNo: number): Promise<
detailLoading.value = true;
try {
const result = await queryPastPlayDetail({
sourceProfile: seasonSourceProfile(season),
source: seasonSource(season),
serverId: season.serverId,
generalNo,
@@ -257,20 +235,6 @@ onMounted(() => {
</header>
<p class="page-note">종료된 기수와 관리자가 보존한 취소 게임의 장수 기록입니다.</p>
<nav class="profile-tabs legacy-bg1" aria-label="과거 장수 서버 선택">
<button
v-for="option in profileOptions"
:key="option.profile"
class="profile-tab"
:class="{ selected: selectedProfile === option.profile }"
type="button"
:aria-label="`${option.label} 서버`"
:aria-pressed="selectedProfile === option.profile"
@click="selectProfile(option.profile)"
>
{{ option.label }}
</button>
</nav>
<p v-if="error" class="error-row">{{ error }}</p>
<p v-else-if="loading && !archive" class="empty-row">불러오는 중...</p>
<p v-else-if="archive?.seasons.length === 0" class="empty-row">보관된 지난 플레이가 없습니다.</p>
@@ -510,7 +474,6 @@ onMounted(() => {
}
.page-note,
.profile-tabs,
.empty-row,
.error-row {
margin: 0;
@@ -519,31 +482,6 @@ onMounted(() => {
border-bottom: 1px solid #666;
}
.profile-tabs {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
gap: 4px;
padding: 6px 8px;
}
.profile-tab {
min-height: 30px;
border: 1px solid #777;
color: #ddd;
background: #222;
font: inherit;
font-weight: 700;
cursor: pointer;
}
.profile-tab:hover,
.profile-tab:focus-visible,
.profile-tab.selected {
border-color: skyblue;
color: skyblue;
background: #143a2a;
}
.page-note,
.season-heading span {
color: #bbb;