forked from baron/baron-sso
feat(adminfront): add user profile dropdown and enhance session sync
This commit is contained in:
@@ -44,16 +44,19 @@ test.describe("Tenant Owners Management", () => {
|
||||
|
||||
test("should list tenant owners", async ({ page }) => {
|
||||
// Mock owners list
|
||||
await page.route("**/api/v1/admin/tenants/tenant-1/owners**", async (route) => {
|
||||
await route.fulfill({
|
||||
json: [
|
||||
{ id: "owner-1", name: "Owner One", email: "owner1@example.com" },
|
||||
],
|
||||
});
|
||||
});
|
||||
await page.route(
|
||||
"**/api/v1/admin/tenants/tenant-1/owners**",
|
||||
async (route) => {
|
||||
await route.fulfill({
|
||||
json: [
|
||||
{ id: "owner-1", name: "Owner One", email: "owner1@example.com" },
|
||||
],
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
await page.goto("/tenants/tenant-1/owners");
|
||||
|
||||
|
||||
// Check if the page title and the owner are visible
|
||||
await expect(page.locator("h3")).toContainText("테넌트 소유자");
|
||||
await expect(page.locator("table")).toContainText("Owner One");
|
||||
@@ -62,13 +65,16 @@ test.describe("Tenant Owners Management", () => {
|
||||
|
||||
test("should add a new owner", async ({ page }) => {
|
||||
// Mock owners list (initially empty)
|
||||
await page.route("**/api/v1/admin/tenants/tenant-1/owners**", async (route) => {
|
||||
if (route.request().method() === "GET") {
|
||||
await route.fulfill({ json: [] });
|
||||
} else if (route.request().method() === "POST") {
|
||||
await route.fulfill({ status: 200 });
|
||||
}
|
||||
});
|
||||
await page.route(
|
||||
"**/api/v1/admin/tenants/tenant-1/owners**",
|
||||
async (route) => {
|
||||
if (route.request().method() === "GET") {
|
||||
await route.fulfill({ json: [] });
|
||||
} else if (route.request().method() === "POST") {
|
||||
await route.fulfill({ status: 200 });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Mock users search
|
||||
await page.route("**/api/v1/admin/users?**", async (route) => {
|
||||
@@ -83,17 +89,19 @@ test.describe("Tenant Owners Management", () => {
|
||||
});
|
||||
|
||||
await page.goto("/tenants/tenant-1/owners");
|
||||
|
||||
|
||||
// Click add button
|
||||
await page.click('button:has-text("소유자 추가")');
|
||||
|
||||
|
||||
// Search for user
|
||||
await page.fill('input[placeholder*="사용자 검색"]', "User Two");
|
||||
|
||||
|
||||
// Wait for results and add - using a more specific selector to target the button in the dialog
|
||||
const addButton = page.locator('role=dialog').getByRole('button', { name: '추가' });
|
||||
const addButton = page
|
||||
.locator("role=dialog")
|
||||
.getByRole("button", { name: "추가" });
|
||||
await addButton.click();
|
||||
|
||||
|
||||
// Verify toast or mutation (in a real app, the list would refresh)
|
||||
// Here we just check if the dialog was closed or toast appears
|
||||
// toast is shown on success
|
||||
|
||||
Reference in New Issue
Block a user