feat: refine metadata catalog workflows
This commit is contained in:
@@ -72,6 +72,28 @@ const table = {
|
||||
updatedAt: "2026-08-27T09:00:00Z",
|
||||
};
|
||||
|
||||
const descriptionRun = {
|
||||
id: "77777777-7777-4777-8777-777777777777",
|
||||
databaseId,
|
||||
scope: "selected_columns",
|
||||
modelId: "glm-53",
|
||||
language: "it",
|
||||
status: "completed",
|
||||
total: 5,
|
||||
processed: 5,
|
||||
generated: 4,
|
||||
nonGeneratable: 1,
|
||||
failed: 0,
|
||||
inputTokens: 1200,
|
||||
cacheReadTokens: 80,
|
||||
outputTokens: 420,
|
||||
createdAt: "2026-08-31T09:00:00Z",
|
||||
startedAt: "2026-08-31T09:00:01Z",
|
||||
updatedAt: "2026-08-31T09:00:04Z",
|
||||
finishedAt: "2026-08-31T09:00:04Z",
|
||||
errorSummary: null,
|
||||
};
|
||||
|
||||
function metrics(requestedDatabaseId: string | null) {
|
||||
return {
|
||||
scope: requestedDatabaseId ? "database" : "global",
|
||||
@@ -133,7 +155,8 @@ async function expectContextPanelGeometry(page: Page, accessibleName: string) {
|
||||
const managerCenter = managerBox.x + managerBox.width / 2;
|
||||
const panelCenter = panelBox.x + panelBox.width / 2;
|
||||
expect(Math.abs(panelCenter - managerCenter)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(panelBox.width / managerBox.width - 0.6)).toBeLessThanOrEqual(0.005);
|
||||
const expectedPanelWidth = Math.min(1200, managerBox.width - (managerBox.width <= 768 ? 24 : 32));
|
||||
expect(Math.abs(panelBox.width - expectedPanelWidth)).toBeLessThanOrEqual(1);
|
||||
expect(panelBox.x).toBeGreaterThanOrEqual(managerBox.x - 1);
|
||||
expect(panelBox.x + panelBox.width).toBeLessThanOrEqual(managerBox.x + managerBox.width + 1);
|
||||
expect(panelBox.x + panelBox.width).toBeLessThanOrEqual(sessionRailBox.x + 1);
|
||||
@@ -297,7 +320,8 @@ async function expectWorkAreaPanelGeometry(page: Page, accessibleName: string) {
|
||||
expect(Math.abs(
|
||||
panelBox.x + panelBox.width / 2 - (workAreaBox.x + workAreaBox.width / 2),
|
||||
)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(panelBox.width / workAreaBox.width - 0.6)).toBeLessThanOrEqual(0.005);
|
||||
const expectedPanelWidth = Math.min(1200, workAreaBox.width - (workAreaBox.width <= 768 ? 24 : 32));
|
||||
expect(Math.abs(panelBox.width - expectedPanelWidth)).toBeLessThanOrEqual(1);
|
||||
expect(panelBox.x).toBeGreaterThanOrEqual(workAreaBox.x - 1);
|
||||
expect(panelBox.x + panelBox.width).toBeLessThanOrEqual(workAreaBox.x + workAreaBox.width + 1);
|
||||
expect(panelBox.x + panelBox.width).toBeLessThanOrEqual(sessionRailBox.x + 1);
|
||||
@@ -344,12 +368,20 @@ test("context panels stay inside the manager and the Tables grid sits in a sideb
|
||||
"GET /api/catalog/metadata-generation/models": {
|
||||
models: [
|
||||
{ id: "deepseek-v4-pro", label: "DeepSeek V4 Pro" },
|
||||
{ id: "deepseek-v4-flash", label: "DeepSeek V4 Flash" },
|
||||
{ id: "glm-53", label: "GLM 5.3" },
|
||||
{ id: "qwen-36", label: "AritmoLab Qwen 3.6 35B A3B" },
|
||||
],
|
||||
default: "glm-53",
|
||||
},
|
||||
"GET /api/catalog/description-generation-runs?limit=50": [],
|
||||
"GET /api/catalog/description-generation-runs?limit=50": [descriptionRun],
|
||||
[`GET /api/catalog/description-generation-runs/${descriptionRun.id}`]: descriptionRun,
|
||||
[`GET /api/catalog/description-generation-runs/${descriptionRun.id}/events-list?after=0`]: [{
|
||||
sequence: 1,
|
||||
level: "info",
|
||||
message: "Description generation completed.",
|
||||
createdAt: "2026-08-31T09:00:04Z",
|
||||
}],
|
||||
"GET /api/catalog/sensitive-data-suggestion-runs?limit=50": [],
|
||||
[`GET /api/catalog/databases/${databaseId}/tables`]: [table],
|
||||
};
|
||||
@@ -387,6 +419,7 @@ test("context panels stay inside the manager and the Tables grid sits in a sideb
|
||||
|
||||
const adminNavigationRail = page.getByRole("complementary", { name: "Session navigation" });
|
||||
const administration = adminNavigationRail.getByRole("button", { name: "Administration", exact: true });
|
||||
await expect(administration).toHaveCSS("font-family", /Manrope/);
|
||||
await expect(administration).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(adminNavigationRail.getByRole("region", { name: "Administration" })).toHaveCount(0);
|
||||
await administration.click();
|
||||
@@ -435,6 +468,7 @@ test("context panels stay inside the manager and the Tables grid sits in a sideb
|
||||
await expect(metadataModelSelector).toHaveValue("glm-53");
|
||||
await expect(metadataModelSelector.locator("option")).toHaveText([
|
||||
"DeepSeek V4 Pro",
|
||||
"DeepSeek V4 Flash",
|
||||
"GLM 5.3",
|
||||
"AritmoLab Qwen 3.6 35B A3B",
|
||||
]);
|
||||
@@ -488,10 +522,55 @@ test("context panels stay inside the manager and the Tables grid sits in a sideb
|
||||
.click();
|
||||
await expectContextPanelGeometry(page, "Description generation");
|
||||
await expectContextPanelHeaderUsesPrimary(page, "Description generation");
|
||||
await page
|
||||
.getByRole("dialog", { name: "Description generation" })
|
||||
.getByRole("button", { name: /close/i })
|
||||
.click();
|
||||
const descriptionPanel = page.getByRole("dialog", { name: "Description generation" });
|
||||
const descriptionBody = descriptionPanel.locator(
|
||||
':scope > [data-catalog-panel-region="body"]',
|
||||
);
|
||||
const progressTable = descriptionPanel.getByRole("table", {
|
||||
name: "Description generation progress",
|
||||
});
|
||||
const eventLog = descriptionPanel.getByRole("log", {
|
||||
name: "Description generation events",
|
||||
});
|
||||
const recentRuns = descriptionPanel.getByRole("region", {
|
||||
name: "Description generation history",
|
||||
});
|
||||
await expect(progressTable.getByRole("columnheader")).toHaveCount(5);
|
||||
await expect(eventLog).toBeVisible();
|
||||
await expect(recentRuns).toBeVisible();
|
||||
|
||||
const [bodyBox, eventLogBox, recentRunsBox] = await Promise.all([
|
||||
descriptionBody.boundingBox(),
|
||||
eventLog.boundingBox(),
|
||||
recentRuns.boundingBox(),
|
||||
]);
|
||||
expect(bodyBox).not.toBeNull();
|
||||
expect(eventLogBox).not.toBeNull();
|
||||
expect(recentRunsBox).not.toBeNull();
|
||||
if (bodyBox && eventLogBox && recentRunsBox) {
|
||||
const eventBottomGutter = bodyBox.y + bodyBox.height - eventLogBox.y - eventLogBox.height;
|
||||
const recentBottomGutter = bodyBox.y + bodyBox.height - recentRunsBox.y - recentRunsBox.height;
|
||||
expect(eventBottomGutter).toBeGreaterThanOrEqual(10);
|
||||
expect(recentBottomGutter).toBeGreaterThanOrEqual(10);
|
||||
expect(eventLogBox.x + eventLogBox.width).toBeLessThan(recentRunsBox.x);
|
||||
}
|
||||
|
||||
await page.setViewportSize({ width: 720, height: 800 });
|
||||
const [compactManagerBox, compactDescriptionPanelBox] = await Promise.all([
|
||||
page.getByTestId("conversation-column").getByRole("main", {
|
||||
name: "Database management",
|
||||
}).boundingBox(),
|
||||
descriptionPanel.boundingBox(),
|
||||
]);
|
||||
expect(compactManagerBox).not.toBeNull();
|
||||
expect(compactDescriptionPanelBox).not.toBeNull();
|
||||
if (compactManagerBox && compactDescriptionPanelBox) {
|
||||
expect(compactManagerBox.width - compactDescriptionPanelBox.width).toBeGreaterThanOrEqual(20);
|
||||
}
|
||||
expect(await descriptionBody.evaluate((element) => getComputedStyle(element).display)).not.toBe("grid");
|
||||
|
||||
await page.setViewportSize({ width: 1910, height: 911 });
|
||||
await descriptionPanel.getByRole("button", { name: /close/i }).click();
|
||||
|
||||
const applicationBar = page.locator(
|
||||
'main[aria-label="Database management"] .thot-fleet-ledger__header',
|
||||
@@ -734,7 +813,7 @@ test("Workspace and Pi management share the centered work-area panel without cov
|
||||
expect(compactWorkAreaBox).not.toBeNull();
|
||||
expect(compactPanelBox).not.toBeNull();
|
||||
if (compactWorkAreaBox && compactPanelBox) {
|
||||
expect(Math.abs(compactPanelBox.width - compactWorkAreaBox.width + 16)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(compactPanelBox.width - compactWorkAreaBox.width + 24)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(
|
||||
compactPanelBox.x + compactPanelBox.width / 2
|
||||
- (compactWorkAreaBox.x + compactWorkAreaBox.width / 2),
|
||||
|
||||
Reference in New Issue
Block a user