수정: 관리자 e2e 인증 흐름 안정화
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m13s
TaxBaik Browser E2E / browser-e2e (push) Failing after 3m26s

This commit is contained in:
2026-06-27 21:16:19 +09:00
parent 8f0cb690c4
commit e0067c6f55
18 changed files with 140 additions and 160 deletions
+4 -16
View File
@@ -1,11 +1,12 @@
import { expect, test } from '@playwright/test';
import { getAdminToken, installAdminToken } 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('navigates the main admin menus without circuit errors', async ({ page }) => {
test('navigates the main admin menus without circuit errors', async ({ page, request }) => {
test.skip(!password, 'E2E_ADMIN_PASSWORD is required.');
const consoleErrors: string[] = [];
@@ -18,21 +19,8 @@ test.describe('admin smoke', () => {
consoleErrors.push(error.message);
});
const token = await page.evaluate(async ({ baseUrl, username, password }) => {
const response = await fetch(`${baseUrl}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password }),
});
if (!response.ok) {
return null;
}
const body = await response.json();
return body?.token ?? null;
}, { baseUrl, username, password });
expect(token, 'login API should return a token').toBeTruthy();
await page.addInitScript(value => localStorage.setItem('auth_token', value), token);
const token = await getAdminToken(request, baseUrl, username, password);
await installAdminToken(page, token);
const menuChecks = [
{ path: '/admin/dashboard', heading: /대시보드/ },