forked from baron/baron-sso
af 린트 적용
This commit is contained in:
@@ -4,14 +4,16 @@ 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();
|
||||
await expect(
|
||||
page.getByRole("button", { name: "SSO 계정으로 로그인" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("authenticated user can access dashboard", async ({ page }) => {
|
||||
@@ -19,9 +21,9 @@ test.describe("Auth Flow", () => {
|
||||
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$/);
|
||||
});
|
||||
|
||||
@@ -82,7 +82,9 @@ test("tenant create and delete flow", async ({ page }) => {
|
||||
|
||||
await page.goto("/tenants");
|
||||
await expect(page).toHaveURL(/\/tenants$/);
|
||||
await expect(page.getByRole("heading", { name: "테넌트 목록" })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "테넌트 목록" }),
|
||||
).toBeVisible();
|
||||
|
||||
// Create
|
||||
const addTenantLink = page.getByRole("link", { name: "테넌트 추가" });
|
||||
@@ -94,8 +96,10 @@ test("tenant create and delete flow", async ({ page }) => {
|
||||
await page.getByLabel("테넌트 유형").selectOption("COMPANY");
|
||||
await page.getByLabel("슬러그 (Slug)").fill("test-tenant");
|
||||
await page.getByLabel("설명").fill("This is an E2E test tenant");
|
||||
await page.getByLabel("허용된 도메인 (콤마로 구분)").fill("test.com, example.com");
|
||||
|
||||
await page
|
||||
.getByLabel("허용된 도메인 (콤마로 구분)")
|
||||
.fill("test.com, example.com");
|
||||
|
||||
await page.getByRole("button", { name: "생성" }).click();
|
||||
await expect(page).toHaveURL(/\/tenants$/);
|
||||
|
||||
@@ -107,16 +111,17 @@ test("tenant create and delete flow", async ({ page }) => {
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
await createdRow.getByRole("button", { name: "삭제" }).click();
|
||||
|
||||
await expect(page.locator("tbody tr").filter({ hasText: uniqueName })).toHaveCount(0);
|
||||
await expect(
|
||||
page.locator("tbody tr").filter({ hasText: uniqueName }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("tenant creation form validation", async ({ page }) => {
|
||||
await page.goto("/tenants/new");
|
||||
|
||||
|
||||
// Try to submit empty form
|
||||
await page.getByRole("button", { name: "생성" }).click();
|
||||
|
||||
|
||||
// Since 'name' is required, we check if button is still disabled or form doesn't navigate
|
||||
await expect(page).toHaveURL(/\/tenants\/new$/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user