import { expect, test } from '@playwright/test'; import { 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('admin smoke', () => { test('@smoke navigates the main admin menus without circuit errors', async ({ page }) => { test.skip(!password, 'E2E_ADMIN_PASSWORD is required.'); const consoleErrors: string[] = []; page.on('console', message => { if (message.type() === 'error') { const text = message.text(); if ( text.includes('Failed to load resource: the server responded with a status of 404') || text.includes('Blocked: pdb') || text.includes('mono_download_assets') || text.includes('.pdb') ) { return; } consoleErrors.push(text); } }); page.on('pageerror', error => { const text = error.message; if ( text.includes('Blocked: pdb') || text.includes('mono_download_assets') || text.includes('.pdb') ) { return; } consoleErrors.push(text); }); await page.goto(`${baseUrl}/admin/login`); await expect(page).toHaveTitle(/관리자/); await expect(page.getByRole('heading', { name: /관리자 로그인/ })).toBeVisible(); await loginThroughAdminUi(page, baseUrl, username, password); const menuChecks = [ { path: '/admin/dashboard' }, { path: '/admin/blog' }, { path: '/admin/inquiries' }, { path: '/admin/settings' }, ]; for (const check of menuChecks) { await navigateInBlazor(page, `${baseUrl}${check.path}`); await expect(page).toHaveURL(new RegExp(`${check.path}$`)); } expect(consoleErrors, 'browser console/page errors').toEqual([]); }); });