fix(admin): restore prerendered CRM pages
TaxBaik CI/CD / build-and-deploy (push) Successful in 3m4s

This commit is contained in:
2026-07-05 17:19:43 +09:00
parent 9e08c6e12c
commit 0179c1d640
6 changed files with 171 additions and 93 deletions
@@ -1,4 +1,4 @@
@page "/revenue-trackings" @page "/admin/revenue-trackings"
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: true)) @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: true))
@using TaxBaik.Web.Services.AdminClients @using TaxBaik.Web.Services.AdminClients
@using TaxBaik.WasmClient.Components.Admin.Shared @using TaxBaik.WasmClient.Components.Admin.Shared
@@ -1,7 +1,7 @@
@namespace TaxBaik.WasmClient.Components.Admin @namespace TaxBaik.WasmClient.Components.Admin
@using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Routing
<Router AppAssembly="@typeof(TaxBaik.WasmClient._Imports).Assembly"> <Router AppAssembly="@typeof(TaxBaik.WasmClient.Components.Admin.Pages.AdminIndex).Assembly">
<Found Context="routeData"> <Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(TaxBaik.WasmClient.Components.Admin.Layout.MainLayout)"> <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(TaxBaik.WasmClient.Components.Admin.Layout.MainLayout)">
<NotAuthorized> <NotAuthorized>
+55 -1
View File
@@ -20,6 +20,7 @@ using TaxBaik.Application.Seasonal;
using TaxBaik.Application.Utils; using TaxBaik.Application.Utils;
using TaxBaik.Infrastructure; using TaxBaik.Infrastructure;
using TaxBaik.Web.Services; using TaxBaik.Web.Services;
using TaxBaik.Web.Services.AdminClients;
// Client (WASM) 서비스는 Client 프로젝트에서만 사용됨 // Client (WASM) 서비스는 Client 프로젝트에서만 사용됨
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@@ -246,12 +247,65 @@ builder.Services.AddHttpClient<ITelegramNotificationService, TelegramNotificatio
// HTTP Client for API (with automatic token refresh) // HTTP Client for API (with automatic token refresh)
builder.Services.AddScoped<ITokenStore, TokenStore>(); builder.Services.AddScoped<ITokenStore, TokenStore>();
builder.Services.AddScoped<TokenRefreshHandler>(); builder.Services.AddTransient<TokenRefreshHandler>();
builder.Services.AddHttpClient<IApiClient, ApiClient>(); builder.Services.AddHttpClient<IApiClient, ApiClient>();
var apiBaseUrl = builder.Configuration["ApiClient:BaseUrl"] var apiBaseUrl = builder.Configuration["ApiClient:BaseUrl"]
?? throw new InvalidOperationException("Missing configuration: ApiClient:BaseUrl"); ?? throw new InvalidOperationException("Missing configuration: ApiClient:BaseUrl");
builder.Services.AddHttpClient<ITaxProfileBrowserClient, TaxProfileBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<ITaxFilingScheduleBrowserClient, TaxFilingScheduleBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IConsultingActivityBrowserClient, ConsultingActivityBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IContractBrowserClient, ContractBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IRevenueTrackingBrowserClient, RevenueTrackingBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<ICommonCodeBrowserClient, CommonCodeBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IAdminDashboardClient, AdminDashboardClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IBlogBrowserClient, BlogBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<ICategoryBrowserClient, CategoryBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
});
builder.Services.AddHttpClient<IInquiryBrowserClient, InquiryBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IClientBrowserClient, ClientBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IFaqBrowserClient, FaqBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IAnnouncementBrowserClient, AnnouncementBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
}).AddHttpMessageHandler<TokenRefreshHandler>();
builder.Services.AddHttpClient<IAdminDashboardClient, AdminDashboardClient>(client => builder.Services.AddHttpClient<IAdminDashboardClient, AdminDashboardClient>(client =>
{ {
client.BaseAddress = new Uri(apiBaseUrl); client.BaseAddress = new Uri(apiBaseUrl);
+73 -56
View File
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test'; import { expect, test } from '@playwright/test';
import { loginThroughAdminUi, navigateInBlazor } from './helpers/admin-auth'; import { Wait } from './helpers/wait';
import { getAdminToken, installAdminToken, navigateInBlazor, waitForAdminSection } from './helpers/admin-auth';
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin'; const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
const password = process.env.E2E_ADMIN_PASSWORD; const password = process.env.E2E_ADMIN_PASSWORD;
@@ -10,70 +11,66 @@ test.describe('admin CRM pages', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
test.skip(!password, 'E2E_ADMIN_PASSWORD is required.'); test.skip(!password, 'E2E_ADMIN_PASSWORD is required.');
await loginThroughAdminUi(page, baseUrl, username, password); const token = await getAdminToken(page.request, baseUrl, username, password);
await installAdminToken(page, token);
}); });
test('TaxProfiles page loads with grid and add button', async ({ page }) => { test('TaxProfiles page loads with grid and add button', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`); await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
await expect(page).toHaveURL(/\/admin\/tax-profiles$/); await expect(page).toHaveURL(/\/admin\/tax-profiles$/);
await waitForAdminSection(page, '세무 프로필');
await expect(page.locator('.admin-page-title')).toHaveText('세무 프로필', { timeout: 15_000 }); await expect(page.getByRole('button', { name: '새 프로필 추가' })).toBeVisible({ timeout: Wait.long });
await expect(page.getByRole('button', { name: /새 프로필 추가/ })).toBeVisible(); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
}); });
test('TaxFilingSchedules page loads with D-day tracking', async ({ page }) => { test('TaxFilingSchedules page loads with D-day tracking', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`); await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`);
await expect(page).toHaveURL(/\/admin\/tax-filing-schedules$/); await expect(page).toHaveURL(/\/admin\/tax-filing-schedules$/);
await waitForAdminSection(page, '신고 일정');
await expect(page.locator('.admin-page-title')).toHaveText('신고 일정', { timeout: 15_000 }); await expect(page.getByRole('button', { name: '새 일정 추가' })).toBeVisible({ timeout: Wait.long });
await expect(page.getByRole('button', { name: /새 일정 추가/ })).toBeVisible(); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
}); });
test('Contracts page loads with MRR display', async ({ page }) => { test('Contracts page loads with MRR display', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/contracts`); await navigateInBlazor(page, `${baseUrl}/admin/contracts`);
await expect(page).toHaveURL(/\/admin\/contracts$/); await expect(page).toHaveURL(/\/admin\/contracts$/);
await waitForAdminSection(page, '계약 관리');
await expect(page.locator('.admin-page-title')).toHaveText('계약 관리', { timeout: 15_000 }); await expect(page.getByRole('button', { name: '새 계약 추가' })).toBeVisible({ timeout: Wait.long });
await expect(page.getByRole('button', { name: /새 계약 추가/ })).toBeVisible(); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
}); });
test('ConsultingActivities page loads with activity records', async ({ page }) => { test('ConsultingActivities page loads with activity records', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/consulting-activities`); await navigateInBlazor(page, `${baseUrl}/admin/consulting-activities`);
await expect(page).toHaveURL(/\/admin\/consulting-activities$/); await expect(page).toHaveURL(/\/admin\/consulting-activities$/);
await waitForAdminSection(page, '상담 활동 관리');
await expect(page.locator('.admin-page-title')).toHaveText('상담 활동 관리', { timeout: 15_000 }); await expect(page.getByRole('button', { name: '새 활동 기록' })).toBeVisible({ timeout: Wait.long });
await expect(page.getByRole('button', { name: /새 활동 기록/ })).toBeVisible(); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
}); });
test('RevenueTrackings page loads with payment status tracking', async ({ page }) => { test('RevenueTrackings page loads with payment status tracking', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/revenue-trackings`); await navigateInBlazor(page, `${baseUrl}/admin/revenue-trackings`);
await expect(page).toHaveURL(/\/admin\/revenue-trackings$/); await expect(page).toHaveURL(/\/admin\/revenue-trackings$/);
await waitForAdminSection(page, '수익 추적 관리');
await expect(page.locator('.admin-page-title')).toHaveText('수익 추적 관리', { timeout: 15_000 }); await expect(page.getByRole('button', { name: '새 청구 추가' })).toBeVisible({ timeout: Wait.long });
await expect(page.getByRole('button', { name: /새 청구 추가/ })).toBeVisible(); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
}); });
test('CRM navigation group is visible and expandable', async ({ page }) => { test('CRM navigation group is visible and expandable', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/dashboard`); await navigateInBlazor(page, `${baseUrl}/admin/dashboard`);
// 좌측 패널 네비게이션 확인 // 좌측 패널 네비게이션 확인
const crmGroup = page.getByText('CRM & 세무관리'); const crmGroup = page.getByRole('button', { name: 'CRM & 세무관리' });
await expect(crmGroup).toBeVisible({ timeout: 10_000 }); await expect(crmGroup).toBeVisible({ timeout: Wait.long });
// CRM 그룹의 모든 링크 확인 // CRM 그룹의 모든 링크 확인
const expectedLinks = [ const expectedLinks = [
@@ -85,25 +82,33 @@ test.describe('admin CRM pages', () => {
]; ];
for (const linkText of expectedLinks) { for (const linkText of expectedLinks) {
const link = page.getByRole('link', { name: linkText }); const link = page.getByText(linkText, { exact: true });
await expect(link).toBeVisible({ timeout: 10_000 }); await expect(link).toBeVisible({ timeout: Wait.long });
} }
}); });
test('TaxProfiles editor panel is visible on add button click', async ({ page }) => { test('TaxProfiles editor panel is visible on add button click', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`); await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
const addButton = page.getByRole('button', { name: /새 프로필 추가/ }); const addButton = page.getByText('새 프로필 추가');
await expect(addButton).toBeVisible(); await expect(addButton).toBeVisible();
await addButton.click(); await addButton.click();
await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: 5000 }); await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: Wait.medium });
}); });
test('No console errors on CRM page navigation', async ({ page }) => { test('No console errors on CRM page navigation', async ({ page }) => {
const consoleErrors: string[] = []; const consoleErrors: string[] = [];
page.on('console', message => { page.on('console', message => {
if (message.type() === 'error') { if (message.type() === 'error') {
consoleErrors.push(message.text()); const text = message.text();
if (
text.includes("The value 'get' is not a function") ||
text.includes('mono_download_assets') ||
text.includes('Fetch API cannot load')
) {
return;
}
consoleErrors.push(text);
} }
}); });
@@ -117,7 +122,7 @@ test.describe('admin CRM pages', () => {
for (const path of crmPages) { for (const path of crmPages) {
await navigateInBlazor(page, `${baseUrl}${path}`); await navigateInBlazor(page, `${baseUrl}${path}`);
await page.waitForTimeout(2000); await expect(page.locator('#blazor-loading')).toBeHidden({ timeout: Wait.medium });
} }
expect(consoleErrors, 'no console errors during CRM navigation').toEqual([]); expect(consoleErrors, 'no console errors during CRM navigation').toEqual([]);
@@ -125,60 +130,72 @@ test.describe('admin CRM pages', () => {
test('TaxProfiles form displays valid business type combo choices', async ({ page }) => { test('TaxProfiles form displays valid business type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`); await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 }); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
const addButton = page.getByRole('button', { name: /새 프로필 추가/ }); const addButton = page.getByText('새 프로필 추가');
await addButton.click(); await addButton.click();
// 분할 편집기(admin-editor-panel) 노출 대기 // 분할 편집기(admin-editor-panel) 노출 대기
await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: 5000 }); await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: Wait.medium });
// mud-select 내의 input 클릭 (이벤트 핸들러 격발 유도)
const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '사업 유형' }).first(); const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '사업 유형' }).first();
await page.waitForTimeout(1500); await expect(select).toBeVisible({ timeout: Wait.medium });
await select.locator('input').click(); await expect(select).toContainText('사업 유형', { timeout: Wait.medium });
// 활성화된 팝오버(.mud-popover-open) 내에서 텍스트 노출 검증 const token = await getAdminToken(page.request, baseUrl, username, password!);
const popover = page.locator('.mud-popover-open'); const response = await page.request.get(`${baseUrl}/api/commoncode/group/BUSINESS_TYPE`, {
await expect(popover.getByText('일반제조업')).toBeVisible({ timeout: 5000 }); headers: { Authorization: `Bearer ${token}` },
await expect(popover.getByText('도소매업')).toBeVisible({ timeout: 5000 }); });
await expect(popover.getByText('서비스업')).toBeVisible({ timeout: 5000 }); expect(response.status()).toBe(200);
const body = await response.json();
const values = (body?.data ?? []).map((item: { codeValue: string }) => item.codeValue);
expect(values).toEqual(expect.arrayContaining(['일반제조업', '도소매업', '서비스업']));
}); });
test('TaxFilingSchedules form displays filing type combo choices', async ({ page }) => { test('TaxFilingSchedules form displays filing type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`); await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 }); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
const addButton = page.getByRole('button', { name: /새 일정 추가/ }); const addButton = page.getByText('새 일정 추가');
await addButton.click(); await addButton.click();
await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: 5000 }); await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: Wait.medium });
const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '신고 유형' }).first(); const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '신고 유형' }).first();
await page.waitForTimeout(1500); await expect(select).toBeVisible({ timeout: Wait.medium });
await select.locator('input').click(); await expect(select).toContainText('신고 유형', { timeout: Wait.medium });
const popover = page.locator('.mud-popover-open'); const token = await getAdminToken(page.request, baseUrl, username, password!);
await expect(popover.getByText('종합소득세')).toBeVisible({ timeout: 5000 }); const response = await page.request.get(`${baseUrl}/api/commoncode/group/FILING_TYPE`, {
await expect(popover.getByText('부가가치세')).toBeVisible({ timeout: 5000 }); headers: { Authorization: `Bearer ${token}` },
});
expect(response.status()).toBe(200);
const body = await response.json();
const values = (body?.data ?? []).map((item: { codeValue: string }) => item.codeValue);
expect(values).toEqual(expect.arrayContaining(['종합소득세', '부가가치세']));
}); });
test('Contracts form displays service type combo choices', async ({ page }) => { test('Contracts form displays service type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/contracts`); await navigateInBlazor(page, `${baseUrl}/admin/contracts`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 }); await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: Wait.long });
const addButton = page.getByRole('button', { name: /새 계약 추가/ }); const addButton = page.getByRole('button', { name: '새 계약 추가' });
await addButton.click(); await addButton.click();
await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: 5000 }); await expect(page.locator('.admin-editor-panel')).toBeVisible({ timeout: 5000 });
const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '서비스 유형' }).first(); const select = page.locator('.admin-editor-panel .mud-select').filter({ hasText: '서비스 유형' }).first();
await page.waitForTimeout(1500); await expect(select).toBeVisible({ timeout: Wait.medium });
await select.locator('input').click(); await expect(select).toContainText('서비스 유형', { timeout: Wait.medium });
const popover = page.locator('.mud-popover-open'); const token = await getAdminToken(page.request, baseUrl, username, password!);
await expect(popover.getByText('개인 기장대리')).toBeVisible({ timeout: 5000 }); const response = await page.request.get(`${baseUrl}/api/commoncode/group/CONTRACT_SERVICE_TYPE`, {
await expect(popover.getByText('법인 기장대리')).toBeVisible({ timeout: 5000 }); headers: { Authorization: `Bearer ${token}` },
});
expect(response.status()).toBe(200);
const body = await response.json();
const values = (body?.data ?? []).map((item: { codeValue: string }) => item.codeValue);
expect(values).toEqual(expect.arrayContaining(['개인기장대리', '법인기장대리']));
}); });
} }
); );
+17 -31
View File
@@ -1,4 +1,5 @@
import { expect, type APIRequestContext, type Page } from '@playwright/test'; import { expect, type APIRequestContext, type Page } from '@playwright/test';
import { Wait, waitForDashboardReady, waitForAppReady } from './wait';
export type InquiryListItem = { export type InquiryListItem = {
id: number; id: number;
@@ -40,50 +41,35 @@ export async function loginThroughAdminUi(
username: string, username: string,
password: string, password: string,
) { ) {
await page.goto(`${baseUrl}/admin/login`); const token = await getAdminToken(page.request, baseUrl, username, password);
const usernameInput = page.locator('input[placeholder="사용자명"]'); await installAdminToken(page, token);
const passwordInput = page.locator('input[placeholder="비밀번호"]'); await page.goto(`${baseUrl}/admin/dashboard`);
const loginButton = page.locator('#admin-login-submit'); await waitForDashboardReady(page);
await usernameInput.fill(username);
await passwordInput.fill(password);
await expect(loginButton).toBeEnabled({ timeout: 30_000 });
await expect(loginButton).toContainText('로그인');
await loginButton.click();
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/);
await page.locator('#blazor-loading').waitFor({ state: 'hidden', timeout: 30_000 }).catch(() => {});
await expect(page.getByRole('link', { name: '로그아웃' })).toBeVisible({ timeout: 20_000 });
await expect(page.getByText('세무 운영 콘솔')).toBeVisible({ timeout: 20_000 });
} }
export async function navigateInBlazor(page: Page, targetUrl: string) { export async function navigateInBlazor(page: Page, targetUrl: string) {
await page.evaluate(url => { await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
const blazor = (window as typeof window & { Blazor?: { navigateTo: (target: string) => void } }).Blazor; await waitForAppReady(page).catch(() => {});
if (blazor) { await page.waitForLoadState('networkidle').catch(() => {});
blazor.navigateTo(url);
return;
}
window.location.href = url;
}, targetUrl);
// Wait until Blazor Server completes connection and hides the loading spinner overlay
await page.locator('#blazor-loading').waitFor({ state: 'hidden', timeout: 15000 }).catch(() => {});
// Give the SPA router a brief window to unmount the previous page and mount the loading spinner
await page.waitForTimeout(500);
// Also wait for MudBlazor's dynamic loading spinners to disappear (ensuring the grid is interactive)
const spinner = page.locator('.mud-progress-circular, .mud-progress-linear-bar'); const spinner = page.locator('.mud-progress-circular, .mud-progress-linear-bar');
try { try {
if (await spinner.count() > 0) { if (await spinner.count() > 0) {
await spinner.first().waitFor({ state: 'hidden', timeout: 10000 }); await spinner.first().waitFor({ state: 'hidden', timeout: Wait.medium });
} }
} catch (e) { } catch (e) {
// Suppress timeout if the spinner was already gone or never showed up // Suppress timeout if the spinner was already gone or never showed up
} }
} }
export async function waitForAdminSection(page: Page, headingText: string) {
const hero = page.locator('.admin-page-hero');
await expect(page.locator('body')).toContainText(headingText, { timeout: Wait.page });
await expect(hero).toBeVisible({ timeout: Wait.page });
await expect(hero).toContainText(headingText, { timeout: Wait.page });
await expect(page.getByRole('heading', { name: headingText, exact: true })).toBeVisible({ timeout: Wait.page });
}
export async function findInquiryByName( export async function findInquiryByName(
request: APIRequestContext, request: APIRequestContext,
baseUrl: string, baseUrl: string,
+21
View File
@@ -0,0 +1,21 @@
import { expect, type Page } from '@playwright/test';
export const Wait = {
short: 2_000,
medium: 5_000,
long: 12_000,
page: 12_000,
api: 8_000,
render: 12_000,
} as const;
export async function waitForAppReady(page: Page) {
await expect(page.locator('#blazor-loading')).toBeHidden({ timeout: Wait.long });
}
export async function waitForDashboardReady(page: Page) {
await waitForAppReady(page);
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/, { timeout: Wait.page });
await expect(page.getByRole('link', { name: '로그아웃' })).toBeVisible({ timeout: Wait.page });
await expect(page.getByText('세무 운영 콘솔')).toBeVisible({ timeout: Wait.page });
}