fix(ranking): 명예의 전당 이전 기록을 프로필별로 분리
이전 서버 명예의 전당 조회를 요청 프로필의 archive로 제한한다. 클라이언트 profile 입력과 표시를 제거하고 API 및 Chromium 회귀 검증을 추가한다.
This commit is contained in:
@@ -10,20 +10,25 @@ const isLegacyRequest = (route: Route): boolean =>
|
||||
decodeURIComponent(`${route.request().url()} ${route.request().postData() ?? ''}`).includes('legacy');
|
||||
|
||||
const installArchiveViews = async (page: Page) => {
|
||||
const hallRequests: string[] = [];
|
||||
await page.addInitScript((profile) => {
|
||||
localStorage.setItem('sammo-game-token', 'ga_archive_views');
|
||||
localStorage.setItem('sammo-game-profile', profile);
|
||||
}, gameProfile);
|
||||
await page.route(gameTrpcRoute, async (route) => {
|
||||
const legacy = isLegacyRequest(route);
|
||||
const results = operationNames(route).map((operation) => {
|
||||
const operations = operationNames(route);
|
||||
if (operations.some((operation) => operation.startsWith('ranking.getHallOfFame'))) {
|
||||
hallRequests.push(decodeURIComponent(`${route.request().url()} ${route.request().postData() ?? ''}`));
|
||||
}
|
||||
const results = operations.map((operation) => {
|
||||
if (operation === 'auth.status') return response({ ok: true });
|
||||
if (operation === 'lobby.info') return response({ myGeneral: { id: 1, name: '기록장수' } });
|
||||
if (operation === 'ranking.getHallOfFameOptions') {
|
||||
return response([
|
||||
{
|
||||
sourceProfile: legacy ? 'hwe' : 'che',
|
||||
season: legacy ? 1 : 2,
|
||||
sourceProfile: 'che',
|
||||
season: 1,
|
||||
scenarios: [{ id: 7, name: legacy ? '이전 시나리오' : '현재 시나리오', count: 1 }],
|
||||
},
|
||||
]);
|
||||
@@ -31,7 +36,7 @@ const installArchiveViews = async (page: Page) => {
|
||||
if (operation === 'ranking.getHallOfFame') {
|
||||
return response({
|
||||
source: legacy ? 'legacy' : 'current',
|
||||
sourceProfile: legacy ? 'hwe' : 'che',
|
||||
sourceProfile: 'che',
|
||||
sections: [
|
||||
{
|
||||
title: '명 성',
|
||||
@@ -184,18 +189,32 @@ const installArchiveViews = async (page: Page) => {
|
||||
});
|
||||
await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(results) });
|
||||
});
|
||||
return { hallRequests };
|
||||
};
|
||||
|
||||
test('명예의 전당은 현재 기록과 이전 서버 기록을 분리해 조회한다', async ({ page }) => {
|
||||
await installArchiveViews(page);
|
||||
test('명예의 전당은 현재 profile의 현재·이전 서버 기록만 조회한다', async ({ page }, testInfo) => {
|
||||
const state = await installArchiveViews(page);
|
||||
await page.setViewportSize({ width: 1000, height: 800 });
|
||||
await page.goto('hall-of-fame');
|
||||
|
||||
await expect(page.getByText('현재장수')).toBeVisible();
|
||||
await page.getByLabel('기록 구분').selectOption('legacy');
|
||||
await expect(page.getByText('이전장수')).toBeVisible();
|
||||
await expect(page.getByLabel('시나리오 검색')).toContainText('HWE / 이전 시나리오');
|
||||
await expect(page.getByLabel('시나리오 검색')).toContainText('이전 시나리오');
|
||||
await expect(page.getByLabel('시나리오 검색')).not.toContainText('HWE /');
|
||||
expect(state.hallRequests.some((request) => request.includes('legacy'))).toBe(true);
|
||||
expect(state.hallRequests.every((request) => !request.includes('sourceProfile'))).toBe(true);
|
||||
await expect(page.locator('.legacy-hall-page')).toHaveCSS('width', '1000px');
|
||||
await page.getByLabel('시나리오 검색').focus();
|
||||
await expect(page.getByLabel('시나리오 검색')).toBeFocused();
|
||||
await page.screenshot({ path: testInfo.outputPath('hall-profile-scope-desktop.png'), fullPage: true });
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(page.locator('.legacy-hall-page')).toHaveCSS('width', '500px');
|
||||
expect(
|
||||
await page.getByLabel('시나리오 검색').evaluate((element) => element.scrollWidth <= element.clientWidth)
|
||||
).toBe(true);
|
||||
await page.screenshot({ path: testInfo.outputPath('hall-profile-scope-mobile.png'), fullPage: true });
|
||||
});
|
||||
|
||||
test('왕조 일람과 상세는 이전 서버 source와 profile을 유지한다', async ({ page }) => {
|
||||
|
||||
@@ -44,7 +44,6 @@ const loading = ref(false);
|
||||
const errorMessage = ref('');
|
||||
const options = ref<HallOption[]>([]);
|
||||
const selectedSource = ref<'current' | 'legacy'>('current');
|
||||
const selectedProfile = ref<string | null>(null);
|
||||
const selectedSeason = ref<number | null>(null);
|
||||
const selectedScenario = ref<number | null>(null);
|
||||
const data = ref<HallPayload | null>(null);
|
||||
@@ -54,11 +53,10 @@ const selection = computed({
|
||||
selectedSeason.value === null
|
||||
? ''
|
||||
: selectedScenario.value === null
|
||||
? `season:${selectedProfile.value ?? ''}:${selectedSeason.value}`
|
||||
: `scenario:${selectedProfile.value ?? ''}:${selectedSeason.value}:${selectedScenario.value}`,
|
||||
? `season:${selectedSeason.value}`
|
||||
: `scenario:${selectedSeason.value}:${selectedScenario.value}`,
|
||||
set: (value: string) => {
|
||||
const [kind, profile, season, scenario] = value.split(':');
|
||||
selectedProfile.value = profile || null;
|
||||
const [kind, season, scenario] = value.split(':');
|
||||
selectedSeason.value = Number(season);
|
||||
selectedScenario.value = kind === 'scenario' ? Number(scenario) : null;
|
||||
},
|
||||
@@ -79,11 +77,10 @@ const loadOptions = async (): Promise<void> => {
|
||||
options.value = await trpc.ranking.getHallOfFameOptions.query({ source: selectedSource.value });
|
||||
const first = options.value[0];
|
||||
if (first) {
|
||||
selectedProfile.value = first.sourceProfile;
|
||||
selectedSeason.value = first.season;
|
||||
selectedScenario.value = null;
|
||||
await loadHall();
|
||||
} else {
|
||||
selectedProfile.value = null;
|
||||
selectedSeason.value = null;
|
||||
selectedScenario.value = null;
|
||||
data.value = null;
|
||||
@@ -103,10 +100,6 @@ const loadHall = async (): Promise<void> => {
|
||||
try {
|
||||
data.value = (await trpc.ranking.getHallOfFame.query({
|
||||
source: selectedSource.value,
|
||||
sourceProfile:
|
||||
selectedSource.value === 'legacy'
|
||||
? (selectedProfile.value as 'che' | 'kwe' | 'pwe' | 'twe' | 'nya' | 'pya' | 'hwe')
|
||||
: undefined,
|
||||
season: selectedSeason.value,
|
||||
scenario: selectedScenario.value ?? undefined,
|
||||
})) as HallPayload;
|
||||
@@ -117,10 +110,6 @@ const loadHall = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
watch([selectedProfile, selectedSeason, selectedScenario], () => {
|
||||
void loadHall();
|
||||
});
|
||||
|
||||
watch(selectedSource, () => {
|
||||
void loadOptions();
|
||||
});
|
||||
@@ -145,19 +134,15 @@ onMounted(loadOptions);
|
||||
|
||||
<label class="scenario-search">
|
||||
시나리오 검색 :
|
||||
<select v-model="selection" aria-label="시나리오 검색">
|
||||
<template v-for="season in options" :key="`${season.sourceProfile}:${season.season}`">
|
||||
<option :value="`season:${season.sourceProfile}:${season.season}`">
|
||||
* {{ selectedSource === 'legacy' ? `${season.sourceProfile.toUpperCase()} / ` : '' }}시즌 :
|
||||
{{ season.season }} 종합 *
|
||||
</option>
|
||||
<select v-model="selection" aria-label="시나리오 검색" @change="loadHall">
|
||||
<template v-for="season in options" :key="season.season">
|
||||
<option :value="`season:${season.season}`">* 시즌 : {{ season.season }} 종합 *</option>
|
||||
<option
|
||||
v-for="scenario in season.scenarios"
|
||||
:key="`${season.sourceProfile}:${season.season}:${scenario.id}`"
|
||||
:value="`scenario:${season.sourceProfile}:${season.season}:${scenario.id}`"
|
||||
:key="`${season.season}:${scenario.id}`"
|
||||
:value="`scenario:${season.season}:${scenario.id}`"
|
||||
>
|
||||
{{ selectedSource === 'legacy' ? `${season.sourceProfile.toUpperCase()} / ` : ''
|
||||
}}{{ scenario.name }}({{ scenario.count }}회)
|
||||
{{ scenario.name }}({{ scenario.count }}회)
|
||||
</option>
|
||||
</template>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user