R34: 收口搜索查看更多跳转与采购 submit 二次减重
这个提交包含在:
@@ -1,4 +1,4 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { test, expect, type Page } from "@playwright/test";
|
||||
|
||||
import { ADMIN, login } from "./helpers/auth";
|
||||
|
||||
@@ -9,7 +9,7 @@ function envelope<T>(data: T) {
|
||||
};
|
||||
}
|
||||
|
||||
test("E2E 全局搜索:按钮打开后按分组展示结果并支持点击跳转", async ({ page }) => {
|
||||
async function mockSearchResults(page: Page) {
|
||||
await page.route("**/api/search?**", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
@@ -30,6 +30,10 @@ test("E2E 全局搜索:按钮打开后按分组展示结果并支持点击跳
|
||||
),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test("E2E 全局搜索:按钮打开后按分组展示结果并支持点击跳转", async ({ page }) => {
|
||||
await mockSearchResults(page);
|
||||
|
||||
await login(page, ADMIN);
|
||||
await page.goto("/portal");
|
||||
@@ -56,6 +60,26 @@ test("E2E 全局搜索:按钮打开后按分组展示结果并支持点击跳
|
||||
await expect(page).toHaveURL(/\/reimbursements\/reimbursement-1/);
|
||||
});
|
||||
|
||||
test("E2E 全局搜索:查看更多结果会关闭弹窗并跳到分组列表页", async ({ page }) => {
|
||||
await mockSearchResults(page);
|
||||
|
||||
await login(page, ADMIN);
|
||||
await page.goto("/portal");
|
||||
await page.getByTestId("global-search-trigger").click();
|
||||
await expect(page.getByRole("heading", { name: "全局搜索" })).toBeVisible();
|
||||
|
||||
const searchResponse = page.waitForResponse((response) => response.url().includes("/api/search?"));
|
||||
await page.getByPlaceholder("搜索人员、项目、合同、公告、资产、请假、报销、周报、待办").fill("海音");
|
||||
await searchResponse;
|
||||
|
||||
const documentsSection = page.locator("section").filter({ has: page.getByRole("heading", { name: "业务单据" }) });
|
||||
await expect(documentsSection.getByRole("button", { name: "查看更多结果" })).toBeVisible();
|
||||
await documentsSection.getByRole("button", { name: "查看更多结果" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/reimbursements$/);
|
||||
await expect(page.getByRole("heading", { name: "全局搜索" })).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("E2E 全局搜索:Ctrl+K 和 Cmd+K 可打开搜索弹窗", async ({ page }) => {
|
||||
await login(page, ADMIN);
|
||||
await page.goto("/portal");
|
||||
|
||||
在新工单中引用
屏蔽一个用户