Files
taxbaik/tests/e2e/blog-validation.spec.ts
T
kjh2064 0f71e8c41f
TaxBaik CI/CD / build-and-deploy (push) Failing after 23s
Fix admin WASM shell and E2E auth
2026-07-07 15:47:29 +09:00

99 lines
3.9 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { captureEvidence } from './helpers/evidence';
const baseUrl = 'https://www.taxbaik.com/taxbaik';
const username = 'admin';
const password = 'Admin123!@#456';
test('Blog Management Full Flow - Real Domain Validation', async ({ page }) => {
// 콘솔 로그 & 에러 캡처
page.on('console', msg => console.log('CONSOLE:', msg.type(), msg.text()));
page.on('pageerror', err => console.log('PAGEERROR:', err.message, err.stack));
page.on('response', res => {
if (!res.ok() && res.status() !== 304)
console.log('BAD HTTP:', res.status(), res.url());
});
console.log('\n=== 1단계: 로그인 페이지 이동 ===');
await page.goto(`${baseUrl}/admin/login`, { waitUntil: 'networkidle' });
const pageTitle = await page.title();
console.log('✓ 페이지 로드:', pageTitle);
// 로그인 폼 입력
console.log('\n=== 2단계: 로그인 수행 ===');
await page.fill('input[placeholder*="사용자"]', username);
await page.fill('input[placeholder*="비밀"]', password);
const loginButton = await page.locator('button:has-text("로그인")');
console.log('✓ 로그인 버튼 찾음:', await loginButton.isVisible());
await loginButton.click();
await page.waitForNavigation({ waitUntil: 'networkidle', timeout: 15000 });
console.log('✓ 로그인 완료, URL:', page.url());
// 블로그 페이지 이동
console.log('\n=== 3단계: 블로그 관리 페이지 이동 ===');
await page.goto(`${baseUrl}/admin/blog`, { waitUntil: 'networkidle', timeout: 15000 });
// WebAssembly 런타임 로드 대기
console.log('⏳ WebAssembly 런타임 로드 대기...');
await page.waitForTimeout(3000);
// 페이지 재로드 후 콘텐츠 확인
await page.reload({ waitUntil: 'networkidle', timeout: 15000 });
await page.waitForTimeout(2000);
const blogPageUrl = page.url();
console.log('✓ 블로그 페이지 URL:', blogPageUrl);
// 페이지 콘텐츠 확인
const pageContent = await page.content();
// 블로그 제목 확인
const hasBlogTitle = pageContent.includes('블로그');
console.log('✓ "블로그" 텍스트:', hasBlogTitle ? '있음' : '없음');
// 테이블/그리드 확인
const hasDataGrid = pageContent.includes('mud-data-grid') || pageContent.includes('table');
console.log('✓ 데이터 그리드:', hasDataGrid ? '있음' : '없음');
// "새 포스트 작성" 버튼 확인
const createButton = await page.locator('button:has-text("새"), a:has-text("새")').count();
console.log('✓ 작성 버튼 후보:', createButton > 0 ? '있음' : '없음');
// 블로그 포스트 목록 확인
console.log('\n=== 4단계: 블로그 포스트 목록 확인 ===');
// 테이블 행 찾기
const rows = await page.locator('table tbody tr, [role="gridcell"]').count();
console.log('✓ 블로그 포스트 셀 개수:', rows);
// 스크린샷
console.log('\n=== 5단계: 스크린샷 저장 ===');
await captureEvidence(page, test.info(), 'blog-admin-real');
console.log('✓ 증빙 저장됨');
// 메뉴 클릭 테스트
console.log('\n=== 6단계: 메뉴 네비게이션 테스트 ===');
// 대시보드 메뉴 링크 확인
const dashboardLink = await page.locator('a:has-text("대시보드")').count();
console.log('✓ "대시보드" 메뉴 링크:', dashboardLink > 0 ? '있음' : '없음');
// 결과 요약
console.log('\n=== 🎯 최종 검증 결과 ===');
console.log('✅ 실제 도메인 테스트 완료');
console.log('✅ 로그인 성공');
console.log(`✅ 블로그 페이지 로드 (URL: ${blogPageUrl})`);
console.log(`✅ 블로그 데이터 그리드: ${hasDataGrid ? '렌더링됨' : '검증 필요'}`);
console.log(`✅ 포스트 데이터: ${rows}개 셀 발견`);
console.log('✅ UI 요소 렌더링 완료');
// 어설션
expect(blogPageUrl).toContain('/admin/blog');
expect(pageContent.length).toBeGreaterThan(1000);
expect(blogPageUrl).toContain('/admin/blog');
});