feat(infra): 落地 M01 基础框架与本机开发环境
交付 FastAPI/Celery/Vue 薄壳、FORCE RLS、Compose 回环与 review 修复证据,关闭 M01 DONE_LOCAL。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8b2a809f06
commit
8fb16f4a4a
97 files changed
+8059
-22
No files matched your search
@@ -0,0 +1,92 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const evidenceDir = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"../../../../docs/evidence/M01/ui",
|
||||
);
|
||||
|
||||
test.describe("health three states", () => {
|
||||
test("loading then success", async ({ page }) => {
|
||||
await page.route("**/health", async (route) => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: true,
|
||||
data: { status: "ok", app: "watchman", version: "0.1.0" },
|
||||
request_id: "pw-success",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("health-loading")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-loading.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await expect(page.getByTestId("health-success")).toBeVisible();
|
||||
await expect(page.getByTestId("health-tag")).toContainText("健康检查成功");
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-success.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("failure state", async ({ page }) => {
|
||||
await page.route("**/health", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 500,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: false,
|
||||
error: {
|
||||
code: 50000,
|
||||
message: "Internal server error",
|
||||
details: {},
|
||||
retryable: true,
|
||||
},
|
||||
request_id: "pw-fail",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("health-failure")).toBeVisible();
|
||||
await expect(page.getByTestId("health-tag")).toContainText("健康检查失败");
|
||||
await expect(page.getByTestId("health-failure")).toContainText("50000");
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-failure.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("english locale via query override is readable", async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
window.localStorage.setItem("watchman.lang", "en");
|
||||
});
|
||||
await page.route("**/health", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: true,
|
||||
data: { status: "ok", app: "watchman", version: "0.1.0" },
|
||||
request_id: "pw-en",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/?lang=en");
|
||||
await expect(page.getByTestId("health-tag")).toContainText("Health check succeeded");
|
||||
await expect(page.getByTestId("health-success")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-success-en.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user