feat: finalize operations model workspace
This commit is contained in:
@@ -15,13 +15,12 @@ const sections = [
|
||||
["conversations", "回忆时间轴", "聊天记录"],
|
||||
["stories", "故事与记忆", "故事与记忆"],
|
||||
["subjects", "长者资料", "长者资料"],
|
||||
["messages", "日程与提醒", "日程与提醒"],
|
||||
["messages", "提醒与待办", "提醒与待办"],
|
||||
["members", "家庭管理", "家庭管理"],
|
||||
["devices", "陪伴设备", "陪伴设备"],
|
||||
["sharing", "内容分享", "内容分享"],
|
||||
["privacy", "数据与授权", "数据与授权"],
|
||||
["billing", "服务用量", "服务用量"],
|
||||
["models", "大模型管理", "大模型管理"],
|
||||
["profile", "设置与权限", "设置与权限"],
|
||||
];
|
||||
|
||||
@@ -97,6 +96,43 @@ try {
|
||||
results.push({ section, heading, layout });
|
||||
}
|
||||
|
||||
await page.getByRole("menuitem", { name: /聊天记录$/ }).click();
|
||||
await page.getByRole("heading", { name: "回忆时间轴", exact: true, level: 1 }).waitFor();
|
||||
const timelineHeaders = page.locator(".timeline-day-group__header");
|
||||
await timelineHeaders.first().waitFor();
|
||||
const timelineHeaderCount = await timelineHeaders.count();
|
||||
const timelineDefaultsWork = timelineHeaderCount >= 3
|
||||
&& await timelineHeaders.nth(0).getAttribute("aria-expanded") === "true"
|
||||
&& await timelineHeaders.nth(1).getAttribute("aria-expanded") === "true"
|
||||
&& await timelineHeaders.nth(2).getAttribute("aria-expanded") === "false";
|
||||
const timelineLayout = await page.locator(".memory-timeline-grid .conversation-list").evaluate((element) => ({
|
||||
height: element.getBoundingClientRect().height,
|
||||
viewportHeight: window.innerHeight,
|
||||
overflowY: getComputedStyle(element.querySelector(".memory-timeline-scroll")).overflowY,
|
||||
}));
|
||||
const timelineIsBounded = timelineLayout.height <= 721 && timelineLayout.height < timelineLayout.viewportHeight && timelineLayout.overflowY === "auto";
|
||||
await timelineHeaders.nth(2).click();
|
||||
const olderTimelineExpands = await timelineHeaders.nth(2).getAttribute("aria-expanded") === "true";
|
||||
await timelineHeaders.nth(2).click();
|
||||
|
||||
const portalSearch = page.getByPlaceholder("搜索长者、设备、通话", { exact: true });
|
||||
await portalSearch.fill("设备");
|
||||
await portalSearch.press("Enter");
|
||||
await page.getByRole("heading", { name: "陪伴设备", exact: true, level: 1 }).waitFor();
|
||||
const searchNavigationWorks = new URL(page.url()).searchParams.get("section") === "devices";
|
||||
await page.getByRole("button", { name: "打开提醒与待办", exact: true }).click();
|
||||
await page.getByRole("heading", { name: "提醒与待办", exact: true, level: 1 }).waitFor();
|
||||
const reminderNavigationWorks = new URL(page.url()).searchParams.get("section") === "messages";
|
||||
const reminderPaletteWorks = await page.evaluate(() => {
|
||||
const controls = [...document.querySelectorAll(".reminder-todo, .reminder-history__summary > button")];
|
||||
return controls.length > 0 && controls.every((item) => {
|
||||
const channels = getComputedStyle(item).backgroundColor.match(/\d+/g)?.slice(0, 3).map(Number) ?? [];
|
||||
return channels.length === 3 && channels.reduce((sum, value) => sum + value, 0) / 3 > 210;
|
||||
});
|
||||
});
|
||||
|
||||
const customerModelNavigationHidden = await page.getByRole("menuitem", { name: /大模型管理$/ }).count() === 0;
|
||||
|
||||
await page.getByRole("menuitem", { name: /长者资料$/ }).click();
|
||||
await page.getByRole("heading", { name: "长者资料", exact: true, level: 1 }).waitFor();
|
||||
await page.locator("button.subject-add-button").click();
|
||||
@@ -107,7 +143,8 @@ try {
|
||||
await page.screenshot({ path: resolve(outputDirectory, "subjects-avatar-upload.png") });
|
||||
const disabledCursorResult = await page.evaluate(() => {
|
||||
const controls = [...document.querySelectorAll("button:disabled")];
|
||||
return { count: controls.length, allWait: controls.length > 0 && controls.every((item) => getComputedStyle(item).cursor === "wait") };
|
||||
const cursors = controls.map((item) => ({ className: item.className, cursor: getComputedStyle(item).cursor }));
|
||||
return { count: controls.length, cursors, allNotAllowed: controls.length > 0 && cursors.every((item) => item.cursor === "not-allowed") };
|
||||
});
|
||||
await page.getByRole("button", { name: "关闭新增长者弹窗" }).click();
|
||||
|
||||
@@ -132,7 +169,6 @@ try {
|
||||
await checkModal("陪伴设备", ".workspace--devices .workspace__actions button:has-text('绑定设备')", "绑定设备", "绑定新设备");
|
||||
await checkModal("内容分享", ".subject-list-toolbar > button", "新建分享", "新建资源分享");
|
||||
await checkModal("数据与授权", ".privacy-actions button:has-text('资料更正')", "资料更正", "提交资料更正");
|
||||
await checkModal("大模型管理", ".model-active-hero > button", "添加大模型", "添加总结大模型");
|
||||
|
||||
await page.getByRole("menuitem", { name: /故事与记忆$/ }).click();
|
||||
await page.locator("button.story-candidate-card").first().click();
|
||||
@@ -146,9 +182,9 @@ try {
|
||||
|
||||
const uniqueResponseErrors = [...new Set(errorResponses)].filter((item) => !item.includes("/api/v1/events") && !(/^403 .*\/media$/.test(item)));
|
||||
const relevantConsoleErrors = consoleErrors.filter((item) => !item.startsWith("Failed to load resource:"));
|
||||
const report = { results, avatarPreviewVisible, modalChecks, disabledCursorResult, familyNavigationVisible, pageFailures, consoleErrors: relevantConsoleErrors, errorResponses: uniqueResponseErrors, failedRequests };
|
||||
const report = { results, timelineHeaderCount, timelineDefaultsWork, timelineIsBounded, olderTimelineExpands, searchNavigationWorks, reminderNavigationWorks, reminderPaletteWorks, customerModelNavigationHidden, avatarPreviewVisible, modalChecks, disabledCursorResult, familyNavigationVisible, pageFailures, consoleErrors: relevantConsoleErrors, errorResponses: uniqueResponseErrors, failedRequests };
|
||||
console.log(JSON.stringify(report, null, 2));
|
||||
if (!avatarPreviewVisible || modalChecks.some((item) => !item.passed) || !disabledCursorResult.allWait || !familyNavigationVisible || pageFailures.length || relevantConsoleErrors.length || uniqueResponseErrors.length || failedRequests.length) {
|
||||
if (!timelineDefaultsWork || !timelineIsBounded || !olderTimelineExpands || !searchNavigationWorks || !reminderNavigationWorks || !reminderPaletteWorks || !customerModelNavigationHidden || !avatarPreviewVisible || modalChecks.some((item) => !item.passed) || !disabledCursorResult.allNotAllowed || !familyNavigationVisible || pageFailures.length || relevantConsoleErrors.length || uniqueResponseErrors.length || failedRequests.length) {
|
||||
throw new Error("Customer portal v0.74 visual/function smoke failed");
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user