import { test, expect } from '@playwright/test'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); test.describe('Vite SPA 어드민 템플릿 네비게이션 E2E 테스트', () => { test('프로토타입 갤러리 진입 및 카드 목록 확인', async ({ page }) => { // 1. 로컬 개발 서버 진입 await page.goto('http://localhost:5173/templates'); // 2. 갤러리 타이틀 렌더링 확인 const header = page.locator('h2'); await expect(header).toContainText('11대 표준 업무 템플릿'); // 3. 카드 수 검증 (11대 표준 + 9대 프로토타입) const cardButtons = page.locator('button:has-text("템플릿")'); await expect(cardButtons).toHaveCount(20); // 4. Playwright E2E 스크린샷 캡쳐 (범용 아티팩트 경로 생성) const screenshotPath = path.resolve(__dirname, '../../../../antigravity-cli/brain/4ffb3a8c-b0d4-4610-9caa-b043a85a33af/templates_gallery_screenshot.png'); await page.screenshot({ path: screenshotPath, fullPage: true }); console.log('✓ E2E 검증 통과: 9대 CRUD/엑셀/OLAP 프로토타입 카드가 100% 정상 활성화되었습니다.'); console.log(`✓ 스크린샷 증빙 파일 생성 완료: ${screenshotPath}`); }); // 9대 프로토타입 개별 라우트 전수 딥 스캔 테스트 const prototypeRoutes = [ { name: 'FactorParamDetailLayout', path: '/templates/factor-detail', keyword: '팩터' }, { name: 'AdvancedAgGridMarketLayout', path: '/templates/ag-grid-market', keyword: '괴리율' }, { name: 'RebalancePipelineLayout', path: '/templates/rebalance-pipeline', keyword: '파이프라인' }, { name: 'RealDashboardLayout', path: '/templates/real-dashboard', keyword: '즉시방어' }, { name: 'WaterfallShadowTreeLayout', path: '/templates/waterfall-tree', keyword: 'Waterfall' }, { name: 'RealMakerCheckerLayout', path: '/templates/maker-checker', keyword: 'Checker' }, { name: 'RealRollbackLayout', path: '/templates/real-rollback', keyword: '롤백' }, { name: 'RealExcelUploadMapper', path: '/templates/excel-upload', keyword: '엑셀' }, { name: 'RealOlapExportLayout', path: '/templates/olap-export', keyword: '다차원' } ]; for (const route of prototypeRoutes) { test(`프로토타입 개별 딥 스캔: ${route.name}`, async ({ page }) => { await page.goto(`http://localhost:5173${route.path}`); await expect(page.locator('body')).toContainText(route.keyword); const shotPath = path.resolve(__dirname, `../../../../antigravity-cli/brain/4ffb3a8c-b0d4-4610-9caa-b043a85a33af/shot_${route.name}.png`); await page.screenshot({ path: shotPath }); console.log(`✓ 딥 스캔 증빙 캡처 완료 [${route.name}]: ${shotPath}`); }); } // 12대 어드민 전체 메인 라우트 전수 딥 스캔 테스트 const mainAdminRoutes = [ { name: 'SCR-11_DashboardView', path: '/dashboard', keyword: 'QuantEngine' }, { name: 'SCR-01_MarketTimeSeriesView', path: '/timeseries', keyword: '시계열' }, { name: 'SCR-02_FactorHistoryView', path: '/factors', keyword: '팩터' }, { name: 'SCR-03_WaterfallExecutionView', path: '/waterfall', keyword: 'Waterfall' }, { name: 'SCR-04_ShadowLedgerView', path: '/shadow', keyword: 'Shadow' }, { name: 'SCR-05_DataComparisonView', path: '/comparison', keyword: 'KIS' }, { name: 'SCR-06_EtfNavAnalysisView', path: '/etf', keyword: 'ETF' }, { name: 'SCR-07_SystemSettingsView', path: '/settings', keyword: '캘리브레이션' }, { name: 'SCR-09_DatabaseView', path: '/database', keyword: 'PostgreSQL' }, { name: 'SCR-10_SnapshotAdminView', path: '/snapshots', keyword: 'snapshot' }, { name: 'SCR-12_UserManagementView', path: '/users', keyword: '사용자' } ]; for (const route of mainAdminRoutes) { test(`어드민 메인 화면 전수 딥 스캔: ${route.name}`, async ({ page }) => { await page.goto(`http://localhost:5173${route.path}`); await expect(page.locator('body')).toContainText(route.keyword); const shotPath = path.resolve(__dirname, `../../../../antigravity-cli/brain/4ffb3a8c-b0d4-4610-9caa-b043a85a33af/full_${route.name}.png`); await page.screenshot({ path: shotPath }); console.log(`✓ 메인 어드민 딥 스캔 증빙 캡처 완료 [${route.name}]: ${shotPath}`); }); } });