fix(web): 收敛控制台列表主按钮、报警可读性与焦点环
按 UI 评审闭环 UI-02~UI-07(查询降权、对象/处理人可读化、筛选分层、数据源名映射、焦点外环);概览与登录壳按约定暂缓。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c7a23837f4
commit
9dffeae667
25 files changed
+1057
-94
No files matched your search
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* UI review evidence capture. Credentials via env only; never log password.
|
||||
* WATCHMAN_UI_USER / WATCHMAN_UI_PASSWORD
|
||||
*/
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const user = process.env.WATCHMAN_UI_USER;
|
||||
const password = process.env.WATCHMAN_UI_PASSWORD;
|
||||
if (!user || !password) {
|
||||
console.error("Missing WATCHMAN_UI_USER or WATCHMAN_UI_PASSWORD");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-full/screenshots");
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
const routes = [
|
||||
{ key: "home", path: "/#/" },
|
||||
{ key: "datasources", path: "/#/datasources" },
|
||||
{ key: "queries", path: "/#/queries" },
|
||||
{ key: "mappings", path: "/#/mappings" },
|
||||
{ key: "alarms", path: "/#/alarms" },
|
||||
];
|
||||
|
||||
const viewports = [
|
||||
{ name: "1440x900", width: 1440, height: 900 },
|
||||
{ name: "1280x800", width: 1280, height: 800 },
|
||||
];
|
||||
|
||||
async function login(page) {
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.getByTestId("login-username").locator("input").fill(user);
|
||||
await page.getByTestId("login-password").locator("input").fill(password);
|
||||
await page.getByTestId("login-submit").click();
|
||||
await page.getByTestId("logout").waitFor({ timeout: 20000 });
|
||||
}
|
||||
|
||||
async function shot(page, name) {
|
||||
await page.waitForTimeout(400);
|
||||
await page.screenshot({ path: path.join(outDir, name), fullPage: false });
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
await page.setViewportSize(viewports[0]);
|
||||
await login(page);
|
||||
await shot(page, "home-1440x900-data-01.png");
|
||||
|
||||
// keyboard focus on home then datasources filter
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "datasources-1440x900-data-02.png");
|
||||
|
||||
const nameFilter = page.getByTestId("datasource-filter-name").locator("input");
|
||||
if (await nameFilter.count()) {
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
// focus name filter explicitly via real Tab from a known start
|
||||
await page.locator("body").click({ position: { x: 5, y: 5 } });
|
||||
for (let i = 0; i < 12; i++) {
|
||||
await page.keyboard.press("Tab");
|
||||
const active = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
return {
|
||||
tag: el?.tagName,
|
||||
testid: el?.closest("[data-testid]")?.getAttribute("data-testid") || null,
|
||||
placeholder: el?.getAttribute("placeholder"),
|
||||
};
|
||||
});
|
||||
if (active.testid === "datasource-filter-name" || active.placeholder === "名称") {
|
||||
await shot(page, "datasources-1440x900-keyboard-focus-03.png");
|
||||
const styles = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
const wrap = el?.closest(".el-input__wrapper") || el;
|
||||
const cs = getComputedStyle(wrap);
|
||||
return { outline: cs.outline, boxShadow: cs.boxShadow, borderColor: cs.borderColor };
|
||||
});
|
||||
fs.writeFileSync(
|
||||
path.join(outDir, "..", "focus-styles.json"),
|
||||
JSON.stringify(styles, null, 2),
|
||||
"utf8",
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await nameFilter.fill("__no_match_ui_review__");
|
||||
await page.getByRole("button", { name: "查询" }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, "datasources-1440x900-empty-filter-04.png");
|
||||
await page.getByRole("button", { name: "重置" }).click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/queries", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "queries-1440x900-data-05.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/mappings", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "mappings-1440x900-data-06.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "alarms-1440x900-data-07.png");
|
||||
|
||||
// second viewport sweep
|
||||
await page.setViewportSize(viewports[1]);
|
||||
for (const r of routes) {
|
||||
await page.goto(`http://127.0.0.1:5173${r.path}`, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, `${r.key}-1280x800-data-08.png`.replace("data-08", `data-${r.key}-08`));
|
||||
}
|
||||
|
||||
// open first datasource detail if row exists
|
||||
await page.setViewportSize(viewports[0]);
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const openBtn = page.getByRole("button", { name: "打开" }).first();
|
||||
if (await openBtn.count()) {
|
||||
await openBtn.click();
|
||||
await page.waitForTimeout(700);
|
||||
await shot(page, "datasource-detail-1440x900-data-09.png");
|
||||
}
|
||||
|
||||
const alarmOpen = page.locator("a, button").filter({ hasText: /打开|详情/ }).first();
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const alarmRowOpen = page.getByRole("button", { name: "打开" }).first();
|
||||
if (await alarmRowOpen.count()) {
|
||||
await alarmRowOpen.click();
|
||||
await page.waitForTimeout(700);
|
||||
await shot(page, "alarm-detail-1440x900-data-10.png");
|
||||
}
|
||||
|
||||
// scroll metrics
|
||||
const metrics = {};
|
||||
for (const r of routes) {
|
||||
await page.goto(`http://127.0.0.1:5173${r.path}`, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(300);
|
||||
metrics[r.key] = await page.evaluate(() => ({
|
||||
innerWidth: window.innerWidth,
|
||||
innerHeight: window.innerHeight,
|
||||
scrollHeight: document.documentElement.scrollHeight,
|
||||
clientHeight: document.documentElement.clientHeight,
|
||||
bodyScroll: document.body.scrollHeight === document.body.clientHeight,
|
||||
}));
|
||||
}
|
||||
fs.writeFileSync(path.join(outDir, "..", "viewport-metrics.json"), JSON.stringify(metrics, null, 2), "utf8");
|
||||
|
||||
await browser.close();
|
||||
console.log("capture complete");
|
||||
@@ -0,0 +1,22 @@
|
||||
import { chromium } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-full/screenshots");
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await page.screenshot({ path: path.join(outDir, "login-1440x900-default-01.png"), fullPage: true });
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
await page.screenshot({ path: path.join(outDir, "login-1280x800-default-02.png"), fullPage: true });
|
||||
const theme = page.getByRole("button", { name: "切换昼夜" });
|
||||
if (await theme.count()) {
|
||||
await theme.click();
|
||||
await page.waitForTimeout(400);
|
||||
await page.screenshot({ path: path.join(outDir, "login-1280x800-dark-03.png"), fullPage: true });
|
||||
}
|
||||
await browser.close();
|
||||
console.log("login screenshots ok");
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Post-fix UI recheck. Credentials via env only.
|
||||
* WATCHMAN_UI_USER / WATCHMAN_UI_PASSWORD
|
||||
*/
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const user = process.env.WATCHMAN_UI_USER;
|
||||
const password = process.env.WATCHMAN_UI_PASSWORD;
|
||||
if (!user || !password) {
|
||||
console.error("Missing WATCHMAN_UI_USER or WATCHMAN_UI_PASSWORD");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-recheck/screenshots");
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
async function shot(page, name) {
|
||||
await page.waitForTimeout(350);
|
||||
await page.screenshot({ path: path.join(outDir, name), fullPage: false });
|
||||
}
|
||||
|
||||
async function buttonTone(page, testId) {
|
||||
const loc = page.getByTestId(testId);
|
||||
if ((await loc.count()) === 0) return null;
|
||||
return loc.evaluate((el) => ({
|
||||
testId: el.getAttribute("data-testid"),
|
||||
classes: el.className,
|
||||
isPrimary: el.classList.contains("el-button--primary"),
|
||||
}));
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.getByTestId("login-username").locator("input").fill(user);
|
||||
await page.getByTestId("login-password").locator("input").fill(password);
|
||||
await page.getByTestId("login-submit").click();
|
||||
await page.getByTestId("logout").waitFor({ timeout: 20000 });
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/", { waitUntil: "networkidle" });
|
||||
await shot(page, "home-1440x900-01.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const dsButtons = {
|
||||
search: await buttonTone(page, "datasource-filter-search"),
|
||||
create: await buttonTone(page, "datasource-create"),
|
||||
};
|
||||
await shot(page, "datasources-1440x900-02.png");
|
||||
|
||||
// keyboard focus on name filter
|
||||
await page.getByTestId("datasource-filter-name").locator("input").focus();
|
||||
await page.waitForTimeout(200);
|
||||
const focusStyles = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
const wrap = el?.closest(".el-input__wrapper") || el;
|
||||
const cs = getComputedStyle(wrap);
|
||||
return { outline: cs.outline, boxShadow: cs.boxShadow };
|
||||
});
|
||||
await shot(page, "datasources-1440x900-focus-03.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/queries", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(800);
|
||||
const qButtons = {
|
||||
search: await buttonTone(page, "query-filter-search"),
|
||||
create: await buttonTone(page, "query-create"),
|
||||
};
|
||||
const dsCellSample = await page.locator("[data-testid=query-table] tbody tr").first().locator("td").nth(1).innerText().catch(() => "");
|
||||
await shot(page, "queries-1440x900-04.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/mappings", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, "mappings-1440x900-05.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
const moreVisible = await page.getByTestId("alarm-filter-more").isVisible();
|
||||
const moduleHidden = (await page.getByTestId("alarm-filter-module").count()) === 0;
|
||||
await shot(page, "alarms-1440x900-default-06.png");
|
||||
await page.getByTestId("alarm-filter-more").click();
|
||||
await page.waitForTimeout(200);
|
||||
const moduleVisible = await page.getByTestId("alarm-filter-module").isVisible();
|
||||
await shot(page, "alarms-1440x900-more-07.png");
|
||||
|
||||
const objectText = await page.locator("[data-testid=alarm-object-label]").first().innerText().catch(() => "");
|
||||
const objectTitle = await page.locator("[data-testid=alarm-object-label]").first().getAttribute("title").catch(() => "");
|
||||
|
||||
await page.getByTestId("alarm-open").first().click();
|
||||
await page.waitForTimeout(700);
|
||||
const identityText = await page.getByTestId("alarm-identity").innerText().catch(() => "");
|
||||
const identityTitle = await page.getByTestId("alarm-identity").getAttribute("title").catch(() => "");
|
||||
const handlerText = await page.getByTestId("alarm-handler").innerText().catch(() => "");
|
||||
await shot(page, "alarm-detail-1440x900-08.png");
|
||||
|
||||
const notes = {
|
||||
dsButtons,
|
||||
qButtons,
|
||||
focusStyles,
|
||||
dsCellSample: dsCellSample.trim(),
|
||||
alarms: {
|
||||
moreVisible,
|
||||
moduleHiddenBeforeMore: moduleHidden,
|
||||
moduleVisibleAfterMore: moduleVisible,
|
||||
objectText: objectText.trim(),
|
||||
objectTitle,
|
||||
identityText: identityText.trim(),
|
||||
identityTitle,
|
||||
handlerText: handlerText.trim(),
|
||||
},
|
||||
};
|
||||
fs.writeFileSync(path.join(outDir, "..", "recheck-notes.json"), JSON.stringify(notes, null, 2), "utf8");
|
||||
console.log(JSON.stringify(notes, null, 2));
|
||||
await browser.close();
|
||||
Reference in new issue
Block a user