mirror of
https://github.com/zuiidea/antd-admin.git
synced 2026-10-19 16:14:37 +00:00
- Add second sample resource (orders): API, schemas, MSW, routes, menu, Lingui, and E2E. - Introduce useCrudToasts, useUrlSearchState, useTableFitHeight; extend useResourceCRUD with optimistic updates; add Vitest coverage for hooks and createHandler. - Implement token refresh in http layer, RouteError, and new E2E specs (auth-refresh, rbac, url-state). - Replace gen-resource codegen with English add-resource.instructions.md; fix Copilot instruction YAML in with-lingui and basic. - Add with-lingui CI workflow, Cursor thin rules, optimization plan doc, and refresh README/AGENTS. - Bump packages/create and lockfile where applicable. Made-with: Cursor
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import { gotoUsers, loginAsAdmin } from "./helpers";
|
|
|
|
test.describe("User Management", () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await gotoUsers(page);
|
|
});
|
|
|
|
test("should display user table", async ({ page }) => {
|
|
const thead = page.locator(".ant-table-thead");
|
|
await expect(thead.getByText(/Username|用户名/)).toBeVisible();
|
|
await expect(thead.getByText(/Email|邮箱/)).toBeVisible();
|
|
await expect(thead.getByText(/Roles|角色/)).toBeVisible();
|
|
});
|
|
|
|
test("should search users", async ({ page }) => {
|
|
const searchInput = page.getByPlaceholder(/Search User|搜索用户/);
|
|
await searchInput.fill("zhao.ming");
|
|
await searchInput.press("Enter");
|
|
await expect(page).toHaveURL(/keyword=zhao\.ming/);
|
|
await expect(page.getByText("zhao.ming", { exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("should open create user modal", async ({ page }) => {
|
|
await page.getByRole("button", { name: /Create User|创建用户/ }).click();
|
|
await expect(page.getByRole("dialog").getByText(/New User|新建用户/)).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe("User Management — role in URL", () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await loginAsAdmin(page);
|
|
await page.goto("/users?role=admin");
|
|
await expect(page.getByPlaceholder(/Search User|搜索用户/)).toBeVisible({ timeout: 15_000 });
|
|
});
|
|
|
|
test("should filter users by role", async ({ page }) => {
|
|
await expect(page).toHaveURL(/role=admin/);
|
|
await expect(page.getByRole("cell", { name: "ops.admin@northstar.io" })).toBeVisible();
|
|
});
|
|
});
|