1
0
forked from baron/baron-sso
Files
baron-sso/adminfront/tests/auth.spec.ts
chan 0ccd1db649 test: 프론트엔드/백엔드 테스트 커버리지 및 시나리오 보강 (Issue #291)
- FE: Vitest 환경 구축 및 공통 UI 컴포넌트(Badge, Button) 테스트 추가
- FE: Playwright E2E 테스트(Auth, Tenant CRUD 및 Validation) 시나리오 보강
- BE: Testcontainers 기반 Repository 통합 테스트(PostgreSQL) 추가
- BE: TenantRepository 계층 구조(Hierarchy), DB 제약조건(Unique) 테스트
- BE: UserRepository 통합 테스트(CRUD, Delete) 추가
- BE: PasswordPolicy 유틸리티 테스트 보강
- BE: TenantService 엣지 케이스(중복 슬러그, 권한 등) 검증 로직 추가
- Fix: 하위 테넌트 생성 시 ParentID 누락 문제 해결
2026-02-23 11:23:48 +09:00

29 lines
1.0 KiB
TypeScript

import { expect, test } from "@playwright/test";
test.describe("Auth Flow", () => {
test("unauthenticated user is redirected to login", async ({ page }) => {
// Navigate to a protected route without setting localStorage
await page.goto("/");
// Check if it redirects to login
await expect(page).toHaveURL(/\/login$/);
// Verify login page content
await expect(page.getByText("Baron SSO")).toBeVisible();
await expect(page.getByText("관리자 로그인")).toBeVisible();
await expect(page.getByRole("button", { name: "SSO 계정으로 로그인" })).toBeVisible();
});
test("authenticated user can access dashboard", async ({ page }) => {
// Inject mock session
await page.addInitScript(() => {
window.localStorage.setItem("admin_session", "playwright-admin-session");
});
await page.goto("/");
// Should stay on dashboard (or another protected route) and not redirect to login
await expect(page).not.toHaveURL(/\/login$/);
});
});