phase 5 part 2: vite 8, webpack 5, fe-testing-perf topics with verified examples
This commit is contained in:
1 parent
7b5cae7d24
commit
9eeb10aede
38 files changed
+1823
-37
No files matched your search
@@ -0,0 +1,13 @@
|
||||
// 不自动运行:Playwright 端到端测试示意(需要 npx playwright install 并启动被测站点;本仓库未在浏览器中实际运行)
|
||||
// 以官方文档为准:https://playwright.dev/docs/intro
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("用户搜索订单并看到结果", async ({ page }) => {
|
||||
// 拦截接口返回固定数据:端到端测试只验证前端流程,不依赖后端数据
|
||||
await page.route("**/api/orders/search**", (route) =>
|
||||
route.fulfill({ json: ["A001", "A002"] }),
|
||||
);
|
||||
await page.goto("http://localhost:5173/orders");
|
||||
await page.getByLabel("搜索订单").fill("A00");
|
||||
await expect(page.getByRole("list", { name: "搜索结果" }).getByRole("listitem")).toHaveCount(2);
|
||||
});
|
||||
Reference in new issue
Block a user