Removed preview label from DDM (#2442)

* Removed preview label from DDM

* Fix vector policy Playwright tests to handle shared container state and Node 19+ crypto

* fixed lint error

* updated lint

---------

Co-authored-by: Sakshi Gupta <sakshig@microsoft.com>
This commit is contained in:
sakshigupta12feb
2026-04-06 21:39:20 +05:30
committed by GitHub
parent 35be73dd6e
commit 8e879a1d7b
5 changed files with 76 additions and 72 deletions

View File

@@ -286,7 +286,7 @@ describe("SettingsUtils", () => {
expect(getTabTitle(SettingsV2TabTypes.ComputedPropertiesTab)).toBe("Computed Properties");
expect(getTabTitle(SettingsV2TabTypes.ContainerVectorPolicyTab)).toBe("Container Policies");
expect(getTabTitle(SettingsV2TabTypes.ThroughputBucketsTab)).toBe("Throughput Buckets");
expect(getTabTitle(SettingsV2TabTypes.DataMaskingTab)).toBe("Masking Policy (preview)");
expect(getTabTitle(SettingsV2TabTypes.DataMaskingTab)).toBe("Masking Policy");
});
it("handles partition key tab title based on fabric native", () => {

View File

@@ -615,7 +615,7 @@ exports[`SettingsComponent renders 1`] = `
"data-test": "settings-tab-header/DataMaskingTab",
}
}
headerText="Masking Policy (preview)"
headerText="Masking Policy"
itemKey="DataMaskingTab"
key="DataMaskingTab"
style={

View File

@@ -765,7 +765,7 @@
"containerPolicies": "Container Policies",
"throughputBuckets": "Throughput Buckets",
"globalSecondaryIndexPreview": "Global Secondary Index (Preview)",
"maskingPolicyPreview": "Masking Policy (preview)"
"maskingPolicyPreview": "Masking Policy"
},
"mongoNotifications": {
"selectTypeWarning": "Please select a type for each index.",

View File

@@ -36,17 +36,57 @@ test.describe("Vector Policy under Scale & Settings", () => {
await context?.dispose();
});
/** Count vector policy entries currently in the DOM. */
const getPolicyCount = async (): Promise<number> => {
for (let i = 1; i <= 20; i++) {
if ((await explorer.frame.locator(`#vector-policy-path-${i}`).count()) === 0) {
return i - 1;
}
}
return 20;
};
/**
* Ensure at least one saved (existing) vector policy exists on the container.
* If none exist, add one and save it. Returns the total policy count afterward.
*/
const ensureExistingPolicy = async (): Promise<number> => {
const count = await getPolicyCount();
if (count > 0) {
return count;
}
// No saved policies — add and save one
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
await explorer.frame.locator("#vector-policy-path-1").fill("/existingPolicy");
await explorer.frame.locator("#vector-policy-dimension-1").fill("500");
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated container ${context.container.id}`,
{ timeout: 2 * ONE_MINUTE_MS },
);
return 1;
};
test("Add new vector embedding policy", async () => {
const existingCount = await getPolicyCount();
// Click Add vector embedding button
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
const newIndex = existingCount + 1;
// Fill in path
const pathInput = explorer.frame.locator("#vector-policy-path-1");
const pathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`);
await pathInput.fill("/embedding");
// Fill in dimensions
const dimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
await dimensionsInput.fill("1500");
// Save changes
@@ -62,25 +102,8 @@ test.describe("Vector Policy under Scale & Settings", () => {
});
test("Existing vector embedding policy fields are disabled", async () => {
// First add a vector embedding policy
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
const pathInput = explorer.frame.locator("#vector-policy-path-1");
await pathInput.fill("/existingEmbedding");
const dimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
await dimensionsInput.fill("700");
// Save the policy
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated container ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
// Ensure there is at least one saved policy
await ensureExistingPolicy();
// Verify the path field is disabled for the existing policy
const existingPathInput = explorer.frame.locator("#vector-policy-path-1");
@@ -92,28 +115,14 @@ test.describe("Vector Policy under Scale & Settings", () => {
});
test("New vector embedding policy fields are enabled while existing are disabled", async () => {
// First, create an existing policy
// Ensure there is at least one saved policy
const existingCount = await ensureExistingPolicy();
// Now add a new policy
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
const firstPathInput = explorer.frame.locator("#vector-policy-path-1");
await firstPathInput.fill("/existingPolicy");
const firstDimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
await firstDimensionsInput.fill("500");
// Save the policy to make it "existing"
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated container ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
// Now add a new policy
await addButton.click();
const newIndex = existingCount + 1;
// Verify the existing policy fields are disabled
const existingPathInput = explorer.frame.locator("#vector-policy-path-1");
@@ -122,46 +131,31 @@ test.describe("Vector Policy under Scale & Settings", () => {
await expect(existingDimensionsInput).toBeDisabled();
// Verify the new policy fields are enabled
const newPathInput = explorer.frame.locator("#vector-policy-path-2");
const newDimensionsInput = explorer.frame.locator("#vector-policy-dimension-2");
const newPathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`);
const newDimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
await expect(newPathInput).toBeEnabled();
await expect(newDimensionsInput).toBeEnabled();
});
test("Delete existing vector embedding policy", async () => {
// First add a vector embedding policy
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
const pathInput = explorer.frame.locator("#vector-policy-path-1");
await pathInput.fill("/toBeDeleted");
const dimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
await dimensionsInput.fill("256");
// Save the policy
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated container ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
// Ensure there is at least one saved policy to delete
const existingCount = await ensureExistingPolicy();
// Verify the policy exists
const pathInput = explorer.frame.locator("#vector-policy-path-1");
await expect(pathInput).toBeVisible();
// Click the delete (trash) button for the vector embedding
// Click the delete (trash) button for the first vector embedding
const deleteButton = explorer.frame.locator("#delete-Vector-embedding-1");
await expect(deleteButton).toBeEnabled();
await deleteButton.click();
// Verify the policy fields are removed
await expect(explorer.frame.locator("#vector-policy-path-1")).not.toBeVisible();
await expect(explorer.frame.locator("#vector-policy-dimension-1")).not.toBeVisible();
// Verify one fewer policy entry in the UI
const countAfterDelete = await getPolicyCount();
expect(countAfterDelete).toBe(existingCount - 1);
// Save the deletion
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
await expect(saveButton).toBeEnabled();
await saveButton.click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
@@ -171,16 +165,21 @@ test.describe("Vector Policy under Scale & Settings", () => {
},
);
// Verify the policy is still gone after save
await expect(explorer.frame.locator("#vector-policy-path-1")).not.toBeVisible();
// Verify the count is still reduced after save
const countAfterSave = await getPolicyCount();
expect(countAfterSave).toBe(existingCount - 1);
});
test("Validation error for empty path", async () => {
const existingCount = await getPolicyCount();
const addButton = explorer.frame.locator("#add-vector-policy");
await addButton.click();
const newIndex = existingCount + 1;
// Leave path empty, just fill dimensions
const dimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
await dimensionsInput.fill("512");
// Check for validation error on path

View File

@@ -18,7 +18,12 @@ import {
subscriptionId,
TestAccount,
} from "./fx";
globalThis.crypto = webcrypto as Crypto;
// In Node.js >= 19, globalThis.crypto is already available as a read-only getter.
// Only assign the polyfill for older versions.
if (!globalThis.crypto) {
Object.defineProperty(globalThis, "crypto", { value: webcrypto, writable: true, configurable: true });
}
export interface TestItem {
id: string;