Files
taxbaik/tests/e2e/admin-smoke.spec.ts
T
kjh2064 ecd40e7856
TaxBaik CI/CD / build-and-deploy (push) Successful in 4m37s
Restore admin shell and harden smoke tests
2026-07-08 01:49:03 +09:00

70 lines
2.9 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loginThroughAdminUi } from './helpers/admin-auth';
import { captureEvidence } from './helpers/evidence';
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
const password = process.env.E2E_ADMIN_PASSWORD;
const baseUrl = (process.env.E2E_BASE_URL ?? 'https://www.taxbaik.com/taxbaik').replace(/\/$/, '');
test.describe('admin smoke', () => {
test('@smoke logs in and lands on dashboard 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') ||
text.includes('Fetch API cannot load') ||
text.includes('Failed to fetch') ||
text.includes('instantiate_wasm_module') ||
text.includes('resource-collection') ||
text.includes("The value 'get' is not a function") ||
text.includes('download \'http://localhost:5001/taxbaik/admin/_framework/') ||
text.includes('failed 404 Not Found')
) {
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') ||
text.includes('Failed to fetch') ||
text.includes('resource-collection') ||
text.includes("The value 'get' is not a function") ||
text.includes('download \'http://localhost:5001/taxbaik/admin/_framework/') ||
text.includes('failed 404 Not Found')
) {
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);
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/, { timeout: 20_000 });
await expect(page.locator('body')).toContainText('세무 운영 콘솔', { timeout: 60_000 });
await expect(page.getByRole('link', { name: /로그아웃/ })).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-shell')).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-drawer')).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-content')).toContainText(/대시보드|세무 운영 콘솔/, { timeout: 30_000 });
await captureEvidence(page, test.info(), 'admin-dashboard-smoke');
expect(consoleErrors, 'browser console/page errors').toEqual([]);
});
});