Add the vector policy source embedding controls

This commit is contained in:
Sung-Hyun Kang
2026-06-16 11:03:20 -05:00
parent 74b6a92219
commit c6139c0cd1
11 changed files with 493 additions and 59 deletions
+78
View File
@@ -50,3 +50,81 @@ test("SQL database and container CRUD", async ({ page }) => {
await expect(databaseNode.element).not.toBeAttached();
});
test("SQL container with vector embedding policy and embedding source", async ({ page }) => {
const databaseId = generateUniqueName("vdb");
const containerId = "testvectorcontainer";
const explorer = await DataExplorer.open(page, TestAccount.SQL);
// Open the New Container panel and check if the embedding source capability is available
// before proceeding. We must skip before whilePanelOpen to avoid a timeout on panel close.
const newContainerButton = await explorer.globalCommandButton("New Container");
await newContainerButton.click();
const panel = explorer.panel("New Container");
await panel.waitFor();
// Expand vector policy section and add a vector embedding to check for the embedding source accordion
await panel.getByTestId("ContainerVectorPolicy/Section").click();
await panel.getByTestId("VectorEmbedding/AddButton").click();
const embeddingSourceSection = panel.getByTestId("VectorEmbeddingSource/Section/1");
if ((await embeddingSourceSection.count()) === 0) {
// Close the panel before skipping
await panel.getByRole("button", { name: "Close New Container" }).click();
await panel.waitFor({ state: "detached" });
test.skip(true, "Test account does not have the integrated embedding capability.");
}
await panel.getByPlaceholder("Type a new database id").fill(databaseId);
await panel.getByRole("textbox", { name: "Container id, Example Container1" }).fill(containerId);
await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
await panel.getByTestId("VectorEmbedding/Path/1").fill("/embedding");
await panel.getByTestId("VectorEmbedding/Dimensions/1").fill("1536");
// Expand embedding source section and fill fields
await embeddingSourceSection.click();
await panel.getByTestId("VectorEmbeddingSource/SourcePaths/1").fill("/description");
await panel.getByTestId("VectorEmbeddingSource/DeploymentName/1").fill("text-embedding-3-small");
await panel.getByTestId("VectorEmbeddingSource/ModelName/1").fill("text-embedding-3-small");
await panel
.getByTestId("VectorEmbeddingSource/Endpoint/1")
.fill("https://e2e-embedding.cognitiveservices.azure.com/");
const okButton = panel.getByTestId("Panel/OkButton");
await okButton.click();
await panel.waitFor({ state: "detached", timeout: 5 * 60 * 1000 });
const databaseNode = await explorer.waitForNode(databaseId);
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
// Cleanup
await containerNode.openContextMenu();
await containerNode.contextMenuItem("Delete Container").click();
await explorer.whilePanelOpen(
"Delete Container",
async (panel, okButton) => {
await panel.getByRole("textbox", { name: "Confirm by typing the container id" }).fill(containerId);
await okButton.click();
},
{ closeTimeout: 5 * 60 * 1000 },
);
await expect(containerNode.element).not.toBeAttached();
await databaseNode.openContextMenu();
await databaseNode.contextMenuItem("Delete Database").click();
await explorer.whilePanelOpen(
"Delete Database",
async (panel, okButton) => {
await panel.getByRole("textbox", { name: "Confirm by typing the database id" }).fill(databaseId);
await okButton.click();
},
{ closeTimeout: 5 * 60 * 1000 },
);
await expect(databaseNode.element).not.toBeAttached();
});
@@ -190,4 +190,59 @@ test.describe("Vector Policy under Scale & Settings", () => {
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await expect(saveButton).toBeDisabled();
});
test("Add embedding source to vector embedding policy", async () => {
const addButton = explorer.frame.getByTestId("VectorEmbedding/AddButton");
await addButton.click();
const embeddingSourceSection = explorer.frame.getByTestId("VectorEmbeddingSource/Section/1");
if ((await embeddingSourceSection.count()) === 0) {
test.skip(true, "Test account does not have the integrated embedding capability.");
}
await explorer.frame.getByTestId("VectorEmbedding/Path/1").fill("/embedding");
await explorer.frame.getByTestId("VectorEmbedding/Dimensions/1").fill("1536");
// Expand embedding source section and fill fields
await embeddingSourceSection.click();
await explorer.frame.getByTestId("VectorEmbeddingSource/SourcePaths/1").fill("/description");
await explorer.frame.getByTestId("VectorEmbeddingSource/DeploymentName/1").fill("text-embedding-3-small");
await explorer.frame.getByTestId("VectorEmbeddingSource/ModelName/1").fill("text-embedding-3-small");
await explorer.frame
.getByTestId("VectorEmbeddingSource/Endpoint/1")
.fill("https://e2e-embedding.cognitiveservices.azure.com/");
// Save changes
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await expect(saveButton).toBeEnabled();
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated container ${context.container.id}`,
{ timeout: 2 * ONE_MINUTE_MS },
);
});
test("Existing embedding source fields are disabled after save", async () => {
// Ensure a policy with embedding source exists (from previous test or create one)
const sourcePathsInput = explorer.frame.getByTestId("VectorEmbeddingSource/SourcePaths/1");
if ((await sourcePathsInput.count()) === 0) {
test.skip(true, "No embedding source present; previous test may have been skipped.");
}
await expect(sourcePathsInput).toBeDisabled();
await expect(sourcePathsInput).toHaveValue("/description");
const deploymentInput = explorer.frame.getByTestId("VectorEmbeddingSource/DeploymentName/1");
await expect(deploymentInput).toBeDisabled();
await expect(deploymentInput).toHaveValue("text-embedding-3-small");
const modelInput = explorer.frame.getByTestId("VectorEmbeddingSource/ModelName/1");
await expect(modelInput).toBeDisabled();
await expect(modelInput).toHaveValue("text-embedding-3-small");
const endpointInput = explorer.frame.getByTestId("VectorEmbeddingSource/Endpoint/1");
await expect(endpointInput).toBeDisabled();
await expect(endpointInput).toHaveValue("https://e2e-embedding.cognitiveservices.azure.com/");
});
});