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
25 lines
866 B
TypeScript
25 lines
866 B
TypeScript
import { expect } from "@playwright/test";
|
|
import type { Page } from "@playwright/test";
|
|
|
|
export async function loginAsAdmin(page: Page) {
|
|
await page.goto("/login");
|
|
await page.getByLabel(/Username|用户名/).fill("admin");
|
|
await page.getByLabel(/Password|密码/).fill("admin");
|
|
await page.getByRole("button", { name: /Sign In|登录/ }).click();
|
|
await expect(page).toHaveURL(/dashboard/);
|
|
}
|
|
|
|
export async function gotoUsers(page: Page) {
|
|
await loginAsAdmin(page);
|
|
await page.goto("/users");
|
|
await expect(page).toHaveURL(/users/);
|
|
}
|
|
|
|
export async function loginAsGuest(page: Page) {
|
|
await page.goto("/login");
|
|
await page.getByLabel(/Username|用户名/).fill("guest");
|
|
await page.getByLabel(/Password|密码/).fill("guest");
|
|
await page.getByRole("button", { name: /Sign In|登录/ }).click();
|
|
await expect(page).toHaveURL(/dashboard/);
|
|
}
|