수정: 관리자 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
+3 -15
View File
@@ -22,22 +22,10 @@ test.describe('admin authentication', () => {
await expect(page.locator('input[placeholder="사용자명"]')).toBeVisible();
await expect(page.locator('input[placeholder="비밀번호"]')).toBeVisible();
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.locator('input[placeholder="사용자명"]').fill(username);
await page.locator('input[placeholder="비밀번호"]').fill(password);
await page.getByRole('button', { name: '로그인' }).click();
await page.addInitScript(value => localStorage.setItem('auth_token', value), token);
await page.goto(`${baseUrl}/admin/dashboard`);
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/);
await expect(page.locator('text=대시보드')).toBeVisible({ timeout: 20_000 });
await expect(page.getByRole('link', { name: /로그아웃/ })).toBeVisible();