Files
taxbaik/tests/e2e/contact-submit.spec.ts
kjh2064 e5981769b9
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m11s
fix: per-page WASM render mode, Contact checkbox binding, Telegram inquiry channel
- Admin: replace the global @rendermode on <Routes>/<Router> with per-page
  render mode. Login.razor now prerenders (form visible before WASM loads);
  every other [Authorize] page stays prerender: false to avoid the
  AuthorizeRouteView blank-render regression from earlier attempts. Adds a
  "준비 중" -> "로그인" splash tied to WASM boot completion, and lets the
  authenticated-shell loading overlay stay up until AdminShell actually renders.
- Contact.cshtml: fix the "Agree" checkbox missing value="true" - a checked
  box sent the browser-default "on", which bool model binding can't parse,
  so ModelState.IsValid silently went false and OnPostAsync returned a blank
  form with no visible error on every submission. Validation summary widened
  from ModelOnly to All so this class of failure isn't silent again.
- TelegramInquiryNotificationService: read Telegram:InquiryChatId (falling
  back to ChatId) instead of only ChatId, matching the channel routing
  CLAUDE.md documents and deploy.yml already provisions as separate secrets.
- Reconcile CLAUDE.md's self-contradicting Phase 8 prerender notes (Phase 9),
  rewrite validate_admin_render.sh for the per-page design, and add a
  SmartAdmin 5.5 design reference section to DOUZONE_UX_GUIDE.md for future
  admin screens (existing screens unchanged, tracked as WBS P4-03).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-03 10:15:27 +09:00

79 lines
3.3 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { findInquiryByName, getAdminToken, loginThroughAdminUi, navigateInBlazor } from './helpers/admin-auth';
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
const password = process.env.E2E_ADMIN_PASSWORD;
const baseUrl = (process.env.E2E_BASE_URL ?? 'http://178.104.200.7/taxbaik').replace(/\/$/, '');
test.describe('contact submit', () => {
test('creates an inquiry through the public API', async ({ request }) => {
const stamp = Date.now();
const createResponse = await request.post(`${baseUrl}/api/inquiry`, {
data: {
name: `Public-${stamp}`,
phone: '010-1234-5678',
email: `public-${stamp}@example.com`,
serviceType: '기타',
message: 'Playwright로 전송한 공개 문의 테스트입니다.',
suppressNotification: true,
},
});
expect(createResponse.ok()).toBeTruthy();
const createBody = await createResponse.json();
expect(createBody.message).toContain('상담 신청이 접수되었습니다');
});
test('creates an inquiry and shows it in admin list', async ({ page, request }) => {
test.skip(!password, 'E2E_ADMIN_PASSWORD is required to verify the admin list.');
const stamp = Date.now();
const name = `E2E-${stamp}`;
const phone = '010-1234-5678';
const email = `e2e-${stamp}@example.com`;
const message = 'Playwright로 전송한 공개 문의 테스트입니다.';
const createResponse = await request.post(`${baseUrl}/api/inquiry`, {
data: {
name,
phone,
email,
serviceType: '기타',
message,
suppressNotification: true,
},
});
expect(createResponse.ok()).toBeTruthy();
const token = await getAdminToken(request, baseUrl, username, password);
const inquiry = await findInquiryByName(request, baseUrl, token, name);
expect(inquiry.phone).toBe(phone);
expect(inquiry.message).toContain(message.slice(0, 20));
await loginThroughAdminUi(page, baseUrl, username, password);
await navigateInBlazor(page, `${baseUrl}/admin/inquiries`);
await expect(page.locator('.mud-main-content').getByText('문의 관리').first()).toBeVisible({ timeout: 20_000 });
});
test('submitting the public Contact.cshtml form shows the success message', async ({ page }) => {
// Regression test: Contact.cshtml's "Agree" checkbox had no value="true", so a
// checked box submitted the browser-default "on", which bool model binding
// cannot parse. ModelState.IsValid became false and OnPostAsync silently
// returned Page() with a blank form and no visible error - the "무한 작성 유도"
// bug. This drives the real form through a browser to catch that class of bug.
const stamp = Date.now();
await page.goto(`${baseUrl}/contact`, { waitUntil: 'networkidle' });
await page.fill('#name', `Contact-E2E-${stamp}`);
await page.fill('#phone', '010-1234-5678');
await page.fill('#email', `contact-e2e-${stamp}@example.com`);
await page.fill('#message', 'Playwright로 Contact.cshtml 폼을 직접 제출한 테스트입니다.');
await page.check('#agree');
await page.click('button[type="submit"]');
await expect(page.locator('#contact-success')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('#contact-success')).toContainText('접수되었습니다');
});
});