fix(game): keep in-game status pages available
This commit is contained in:
@@ -37,6 +37,7 @@ type FixtureState = {
|
||||
generalMeQueries?: number;
|
||||
generalLogQueries?: number;
|
||||
ensurePrestartQueries?: number;
|
||||
ensurePrestartFailure?: 'TIMEOUT' | 'INTERNAL_SERVER_ERROR';
|
||||
nationNoticeInput?: string;
|
||||
settingMutations: Array<Record<string, unknown>>;
|
||||
accessPages: string[];
|
||||
@@ -188,6 +189,22 @@ const install = async (page: Page, state: FixtureState) => {
|
||||
}
|
||||
if (operation === 'general.ensureDieOnPrestartStatus') {
|
||||
state.ensurePrestartQueries = (state.ensurePrestartQueries ?? 0) + 1;
|
||||
if (state.ensurePrestartFailure) {
|
||||
const isTimeout = state.ensurePrestartFailure === 'TIMEOUT';
|
||||
return {
|
||||
error: {
|
||||
message: isTimeout
|
||||
? '요청 처리 결과를 확인하지 못했습니다.'
|
||||
: '엔진 transaction을 시작하지 못했습니다.',
|
||||
code: -32000,
|
||||
data: {
|
||||
code: state.ensurePrestartFailure,
|
||||
httpStatus: isTimeout ? 408 : 500,
|
||||
path: operation,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
return response({
|
||||
show: state.dieOnPrestartShow ?? false,
|
||||
available: false,
|
||||
@@ -568,6 +585,35 @@ test('내 정보&설정 keeps the legacy 1000px/500px geometry and saves in plac
|
||||
await persistParityArtifact(page, 'core-my-page-mobile', mobile);
|
||||
});
|
||||
|
||||
for (const [label, failure] of [
|
||||
['daemon timeout', 'TIMEOUT'],
|
||||
['engine transaction 오류', 'INTERNAL_SERVER_ERROR'],
|
||||
] as const) {
|
||||
test(`내 정보 기본 출력은 ${label}에도 표시되고 사전 삭제 동작만 비활성화된다`, async ({ page }) => {
|
||||
const state: FixtureState = {
|
||||
permission: 'head',
|
||||
myset: 3,
|
||||
ensurePrestartFailure: failure,
|
||||
settingMutations: [],
|
||||
accessPages: [],
|
||||
};
|
||||
await install(page, state);
|
||||
await page.setViewportSize({ width: 1000, height: 900 });
|
||||
await page.goto('my-page');
|
||||
|
||||
await expect(page.locator('.general-table')).toContainText('검증장수');
|
||||
await expect(page.locator('#set_my_setting')).toBeVisible();
|
||||
await expect(page.locator('.log-panel').first()).toContainText('기록');
|
||||
await expect(page.locator('.error-row')).toHaveCount(0);
|
||||
|
||||
const statusError = page.locator('.prestart-status-error');
|
||||
await expect(statusError).toBeVisible();
|
||||
await expect(statusError.getByRole('button', { name: '장수 삭제' })).toBeDisabled();
|
||||
await expect(statusError.getByRole('button', { name: '상태 재확인' })).toBeEnabled();
|
||||
await expect.poll(() => state.ensurePrestartQueries).toBe(1);
|
||||
});
|
||||
}
|
||||
|
||||
test('내 정보에서 사람 장수의 등록 전콘을 골라 변경한다', async ({ page }) => {
|
||||
const iconId = '3f804277-584f-4f44-b39c-9ecf40d1ed31';
|
||||
const state: FixtureState = {
|
||||
|
||||
@@ -36,6 +36,8 @@ const data = ref<MyGeneralResponse | null>(null);
|
||||
const world = ref<WorldSnapshot>(null);
|
||||
const selectionPoolStatus = ref<SelectionPoolStatus | null>(null);
|
||||
const dieOnPrestartStatus = ref<DieOnPrestartStatus | null>(null);
|
||||
const dieOnPrestartStatusLoading = ref(false);
|
||||
const dieOnPrestartStatusError = ref<string | null>(null);
|
||||
const loading = ref(false);
|
||||
const error = ref<string | null>(null);
|
||||
const screenMode = ref<ScreenMode>('auto');
|
||||
@@ -190,21 +192,34 @@ const loadLog = async (type: LogType, beforeId?: number) => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadDieOnPrestartStatus = async () => {
|
||||
if (dieOnPrestartStatusLoading.value) return;
|
||||
dieOnPrestartStatusLoading.value = true;
|
||||
dieOnPrestartStatusError.value = null;
|
||||
try {
|
||||
dieOnPrestartStatus.value = await trpc.general.ensureDieOnPrestartStatus.mutate();
|
||||
} catch (cause) {
|
||||
dieOnPrestartStatus.value = null;
|
||||
dieOnPrestartStatusError.value = errorText(cause);
|
||||
} finally {
|
||||
dieOnPrestartStatusLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadPage = async (resetImmediateActionIds = true) => {
|
||||
if (loading.value) return;
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
void loadDieOnPrestartStatus();
|
||||
try {
|
||||
const [general, state, joinConfig, prestartStatus] = await Promise.all([
|
||||
const [general, state, joinConfig] = await Promise.all([
|
||||
trpc.general.me.query(),
|
||||
trpc.world.getState.query() as Promise<WorldSnapshot>,
|
||||
trpc.join.getConfig.query(),
|
||||
trpc.general.ensureDieOnPrestartStatus.mutate(),
|
||||
]);
|
||||
data.value = general;
|
||||
world.value = state;
|
||||
selectionPoolStatus.value = joinConfig.selectionPool;
|
||||
dieOnPrestartStatus.value = prestartStatus;
|
||||
if (general) {
|
||||
Object.assign(form, general.settings);
|
||||
selectedIconId.value =
|
||||
@@ -470,6 +485,19 @@ onMounted(() => {
|
||||
가오픈 기간 내 장수 삭제 ({{ formatDieOnPrestartAvailableAt }} 부터)<br />
|
||||
<button class="action-button" @click="dieOnPrestart">장수 삭제</button>
|
||||
</div>
|
||||
<div v-else-if="dieOnPrestartStatusError" class="action-line prestart-status-error">
|
||||
가오픈 기간 내 장수 삭제 상태를 확인하지 못했습니다.<br />
|
||||
<span class="hint">{{ dieOnPrestartStatusError }}</span><br />
|
||||
<button class="action-button" type="button" disabled>장수 삭제</button>
|
||||
<button
|
||||
class="action-button"
|
||||
type="button"
|
||||
:disabled="dieOnPrestartStatusLoading"
|
||||
@click="loadDieOnPrestartStatus"
|
||||
>
|
||||
{{ dieOnPrestartStatusLoading ? '확인 중' : '상태 재확인' }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="actionAvailability.buildNationCandidate" class="action-line">
|
||||
서버 개시 이전 거병(2턴부터 건국 가능)<br />
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user