This commit is contained in:
@@ -496,7 +496,7 @@ test.each(synchronizationScopes)(
|
||||
},
|
||||
);
|
||||
|
||||
test("starts Generate Missing for one configured database without confirmation", async () => {
|
||||
test("discloses source sampling before starting Generate Missing", async () => {
|
||||
const user = userEvent.setup();
|
||||
const queuedRun = makeDescriptionGenerationRun({ scope: "missing", total: 3 });
|
||||
let startBody: unknown;
|
||||
@@ -519,6 +519,15 @@ test("starts Generate Missing for one configured database without confirmation",
|
||||
await user.click(screen.getByRole("button", { name: "Actions" }));
|
||||
await user.click(await screen.findByRole("menuitem", { name: "Generate Missing" }));
|
||||
|
||||
expect(screen.getByText("Generate missing descriptions for Policlinico San Donato?")).toBeVisible();
|
||||
expect(screen.getByRole("note", {
|
||||
name: "Metadata generation source data disclosure",
|
||||
})).toHaveTextContent(
|
||||
"When available, up to five real source rows and five representative values from columns not marked sensitive are sent to the selected provider.",
|
||||
);
|
||||
expect(startBody).toBeUndefined();
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Generate Missing" }));
|
||||
await waitFor(() => expect(startBody).toEqual({
|
||||
modelId: "local-qwen",
|
||||
scope: "missing",
|
||||
@@ -527,6 +536,44 @@ test("starts Generate Missing for one configured database without confirmation",
|
||||
expect(await screen.findByRole("dialog", { name: "Description generation" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("keeps Fleet Generate Missing behind the source-data disclosure", async () => {
|
||||
const user = userEvent.setup();
|
||||
let generationStarts = 0;
|
||||
server.use(
|
||||
http.get("/api/catalog/metadata-generation/models", () => HttpResponse.json({
|
||||
models: [{ id: "local-qwen", label: "Local Qwen" }],
|
||||
default: "local-qwen",
|
||||
})),
|
||||
http.post("/api/catalog/databases/:databaseId/description-generation-runs", () => {
|
||||
generationStarts += 1;
|
||||
return HttpResponse.json(makeDescriptionGenerationRun({ scope: "missing" }), { status: 202 });
|
||||
}),
|
||||
);
|
||||
renderPage({ rows: [makeDatabase()], presentation: "fleet" });
|
||||
|
||||
const databaseRow = await screen.findByRole("row", { name: /Policlinico San Donato/ });
|
||||
await user.click(within(databaseRow).getByRole("checkbox", { name: /toggle row selection/i }));
|
||||
await user.selectOptions(
|
||||
screen.getByRole("combobox", { name: "Batch action" }),
|
||||
"generate-missing",
|
||||
);
|
||||
await waitFor(() => expect(screen.getByRole("combobox", {
|
||||
name: "Metadata description model",
|
||||
})).toHaveValue("local-qwen"));
|
||||
await user.click(screen.getByRole("button", { name: "Run action" }));
|
||||
|
||||
expect(screen.getByRole("note", {
|
||||
name: "Metadata generation source data disclosure",
|
||||
})).toBeVisible();
|
||||
expect(generationStarts).toBe(0);
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Cancel" }));
|
||||
expect(screen.queryByRole("note", {
|
||||
name: "Metadata generation source data disclosure",
|
||||
})).not.toBeInTheDocument();
|
||||
expect(generationStarts).toBe(0);
|
||||
});
|
||||
|
||||
test("confirms Generate All replacement, supports cancel, and sends the database-wide scope", async () => {
|
||||
const user = userEvent.setup();
|
||||
const queuedRun = makeDescriptionGenerationRun({ scope: "all", total: 6 });
|
||||
@@ -552,6 +599,9 @@ test("confirms Generate All replacement, supports cancel, and sends the database
|
||||
|
||||
expect(screen.getByText("Replace generated descriptions for Policlinico San Donato?")).toBeVisible();
|
||||
expect(screen.getByText(/existing generated descriptions for eligible tables and columns will be replaced/i)).toBeVisible();
|
||||
expect(screen.getByRole("note", {
|
||||
name: "Metadata generation source data disclosure",
|
||||
})).toHaveTextContent(/real source rows.*selected provider/i);
|
||||
expect(startBody).toBeUndefined();
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Cancel" }));
|
||||
@@ -587,6 +637,7 @@ test("keeps the database selected and safely explains when no descriptions are e
|
||||
await user.click(within(databaseRow).getByRole("checkbox", { name: /toggle row selection/i }));
|
||||
await user.click(screen.getByRole("button", { name: "Actions" }));
|
||||
await user.click(await screen.findByRole("menuitem", { name: "Generate Missing" }));
|
||||
await user.click(screen.getByRole("button", { name: "Generate Missing" }));
|
||||
|
||||
expect(await screen.findByText(
|
||||
"No eligible catalog tables or columns need description generation.",
|
||||
@@ -648,7 +699,9 @@ test.each([
|
||||
await user.click(await screen.findByRole("menuitem", {
|
||||
name: scope === "all" ? "Generate All" : "Generate Missing",
|
||||
}));
|
||||
if (scope === "all") await user.click(screen.getByRole("button", { name: "Generate All" }));
|
||||
await user.click(screen.getByRole("button", {
|
||||
name: scope === "all" ? "Generate All" : "Generate Missing",
|
||||
}));
|
||||
|
||||
expect(await screen.findByRole("heading", {
|
||||
name: status === "completed" ? "Completed" : "Completed with errors",
|
||||
@@ -752,6 +805,7 @@ test("disables database-wide generation while a description generation is active
|
||||
await user.click(within(databaseRow).getByRole("checkbox", { name: /toggle row selection/i }));
|
||||
await user.click(screen.getByRole("button", { name: "Actions" }));
|
||||
await user.click(await screen.findByRole("menuitem", { name: "Generate Missing" }));
|
||||
await user.click(screen.getByRole("button", { name: "Generate Missing" }));
|
||||
expect(await screen.findByRole("dialog", { name: "Description generation" })).toBeVisible();
|
||||
|
||||
databaseRow = await screen.findByRole("row", { name: /Policlinico San Donato/ });
|
||||
|
||||
Reference in New Issue
Block a user