You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
699 B

import { describe, expect, it } from "vitest";
import { pageLocator } from "@/lib/rpa/locator";
describe("pageLocator", () => {
it("解析 role= 规格", () => {
const calls: unknown[] = [];
const page = {
getByRole: (role: string, opts?: { name?: string }) => {
calls.push([role, opts]);
return { _type: "locator" };
},
locator: () => ({ _type: "css" }),
getByText: () => ({ _type: "text" }),
getByPlaceholder: () => ({ _type: "ph" }),
} as unknown as Parameters<typeof pageLocator>[0];
pageLocator(page, 'role=button[name="获取货运报价"]');
expect(calls[0]).toEqual(["button", { name: "获取货运报价" }]);
});
});