mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-23 11:44:03 +00:00
Compare commits
2 Commits
master
...
users/saks
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56bc65f5fb | ||
|
|
6c2ad8b001 |
@@ -7,27 +7,16 @@ import { HttpStatusCodes } from "./Constants";
|
|||||||
import { logError } from "./Logger";
|
import { logError } from "./Logger";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
export interface HandleErrorOptions {
|
export const handleError = (error: string | ARMError | Error, area: string, consoleErrorPrefix?: string): void => {
|
||||||
/** Optional redacted error to use for telemetry logging instead of the original error */
|
|
||||||
redactedError?: string | ARMError | Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const handleError = (
|
|
||||||
error: string | ARMError | Error,
|
|
||||||
area: string,
|
|
||||||
consoleErrorPrefix?: string,
|
|
||||||
options?: HandleErrorOptions,
|
|
||||||
): void => {
|
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
const errorCode = error instanceof ARMError ? error.code : undefined;
|
const errorCode = error instanceof ARMError ? error.code : undefined;
|
||||||
|
|
||||||
// logs error to data explorer console (always shows original, non-redacted message)
|
// logs error to data explorer console
|
||||||
const consoleErrorMessage = consoleErrorPrefix ? `${consoleErrorPrefix}:\n ${errorMessage}` : errorMessage;
|
const consoleErrorMessage = consoleErrorPrefix ? `${consoleErrorPrefix}:\n ${errorMessage}` : errorMessage;
|
||||||
logConsoleError(consoleErrorMessage);
|
logConsoleError(consoleErrorMessage);
|
||||||
|
|
||||||
// logs error to both app insight and kusto (use redacted message if provided)
|
// logs error to both app insight and kusto
|
||||||
const telemetryErrorMessage = options?.redactedError ? getErrorMessage(options.redactedError) : errorMessage;
|
logError(errorMessage, area, errorCode);
|
||||||
logError(telemetryErrorMessage, area, errorCode);
|
|
||||||
|
|
||||||
// checks for errors caused by firewall and sends them to portal to handle
|
// checks for errors caused by firewall and sends them to portal to handle
|
||||||
sendNotificationForError(errorMessage, errorCode);
|
sendNotificationForError(errorMessage, errorCode);
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ export const deleteDocuments = async (
|
|||||||
documentIds: DocumentId[],
|
documentIds: DocumentId[],
|
||||||
abortSignal: AbortSignal,
|
abortSignal: AbortSignal,
|
||||||
): Promise<IBulkDeleteResult[]> => {
|
): Promise<IBulkDeleteResult[]> => {
|
||||||
const totalCount = documentIds.length;
|
const clearMessage = logConsoleProgress(`Deleting ${documentIds.length} ${getEntityName(true)}`);
|
||||||
const clearMessage = logConsoleProgress(`Deleting ${totalCount} ${getEntityName(true)}`);
|
|
||||||
try {
|
try {
|
||||||
const v2Container = await client().database(collection.databaseId).container(collection.id());
|
const v2Container = await client().database(collection.databaseId).container(collection.id());
|
||||||
|
|
||||||
@@ -84,7 +83,11 @@ export const deleteDocuments = async (
|
|||||||
const flatAllResult = Array.prototype.concat.apply([], allResult);
|
const flatAllResult = Array.prototype.concat.apply([], allResult);
|
||||||
return flatAllResult;
|
return flatAllResult;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, "DeleteDocuments", `Error while deleting ${totalCount} ${getEntityName(totalCount > 1)}`);
|
handleError(
|
||||||
|
error,
|
||||||
|
"DeleteDocuments",
|
||||||
|
`Error while deleting ${documentIds.length} ${getEntityName(documentIds.length > 1)}`,
|
||||||
|
);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
clearMessage();
|
clearMessage();
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
import { redactSyntaxErrorMessage } from "./queryDocumentsPage";
|
|
||||||
|
|
||||||
/* Typical error to redact looks like this (the message property contains a JSON string with nested structure):
|
|
||||||
{
|
|
||||||
"message": "{\"code\":\"BadRequest\",\"message\":\"{\\\"errors\\\":[{\\\"severity\\\":\\\"Error\\\",\\\"location\\\":{\\\"start\\\":0,\\\"end\\\":5},\\\"code\\\":\\\"SC1001\\\",\\\"message\\\":\\\"Syntax error, incorrect syntax near 'Crazy'.\\\"}]}\\r\\nActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17, Windows/10.0.20348 cosmos-netstandard-sdk/3.18.0\"}"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Helper to create the nested error structure that matches what the SDK returns
|
|
||||||
const createNestedError = (
|
|
||||||
errors: Array<{ severity?: string; location?: { start: number; end: number }; code: string; message: string }>,
|
|
||||||
activityId: string = "test-activity-id",
|
|
||||||
): { message: string } => {
|
|
||||||
const innerErrorsJson = JSON.stringify({ errors });
|
|
||||||
const innerMessage = `${innerErrorsJson}\r\n${activityId}`;
|
|
||||||
const outerJson = JSON.stringify({ code: "BadRequest", message: innerMessage });
|
|
||||||
return { message: outerJson };
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper to parse the redacted result
|
|
||||||
const parseRedactedResult = (result: { message: string }) => {
|
|
||||||
const outerParsed = JSON.parse(result.message);
|
|
||||||
const [innerErrorsJson, activityIdPart] = outerParsed.message.split("\r\n");
|
|
||||||
const innerErrors = JSON.parse(innerErrorsJson);
|
|
||||||
return { outerParsed, innerErrors, activityIdPart };
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("redactSyntaxErrorMessage", () => {
|
|
||||||
it("should redact SC1001 error message", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
severity: "Error",
|
|
||||||
location: { start: 0, end: 5 },
|
|
||||||
code: "SC1001",
|
|
||||||
message: "Syntax error, incorrect syntax near 'Crazy'.",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"ActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { outerParsed, innerErrors, activityIdPart } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(outerParsed.code).toBe("BadRequest");
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(activityIdPart).toContain("ActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should redact SC2001 error message", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
severity: "Error",
|
|
||||||
location: { start: 0, end: 10 },
|
|
||||||
code: "SC2001",
|
|
||||||
message: "Some sensitive syntax error message.",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"ActivityId: abc123",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { outerParsed, innerErrors, activityIdPart } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(outerParsed.code).toBe("BadRequest");
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(activityIdPart).toContain("ActivityId: abc123");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should redact multiple errors with SC1001 and SC2001 codes", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{ severity: "Error", code: "SC1001", message: "First error" },
|
|
||||||
{ severity: "Error", code: "SC2001", message: "Second error" },
|
|
||||||
],
|
|
||||||
"ActivityId: xyz",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(innerErrors.errors[1].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not redact errors with other codes", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[{ severity: "Error", code: "SC9999", message: "This should not be redacted." }],
|
|
||||||
"ActivityId: test123",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error); // Should return original error unchanged
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not modify non-BadRequest errors", () => {
|
|
||||||
const innerMessage = JSON.stringify({ errors: [{ code: "SC1001", message: "Should not be redacted" }] });
|
|
||||||
const error = {
|
|
||||||
message: JSON.stringify({ code: "NotFound", message: innerMessage }),
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle errors without message property", () => {
|
|
||||||
const error = { code: "BadRequest" };
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle non-object errors", () => {
|
|
||||||
const stringError = "Simple string error";
|
|
||||||
const nullError: null = null;
|
|
||||||
const undefinedError: undefined = undefined;
|
|
||||||
|
|
||||||
expect(redactSyntaxErrorMessage(stringError)).toBe(stringError);
|
|
||||||
expect(redactSyntaxErrorMessage(nullError)).toBe(nullError);
|
|
||||||
expect(redactSyntaxErrorMessage(undefinedError)).toBe(undefinedError);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle malformed JSON in message", () => {
|
|
||||||
const error = {
|
|
||||||
message: "not valid json",
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle message without ActivityId suffix", () => {
|
|
||||||
const innerErrorsJson = JSON.stringify({
|
|
||||||
errors: [{ severity: "Error", code: "SC1001", message: "Syntax error near something." }],
|
|
||||||
});
|
|
||||||
const error = {
|
|
||||||
message: JSON.stringify({ code: "BadRequest", message: innerErrorsJson + "\r\n" }),
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should preserve other error properties", () => {
|
|
||||||
const baseError = createNestedError([{ code: "SC1001", message: "Error" }], "ActivityId: test");
|
|
||||||
const error = {
|
|
||||||
...baseError,
|
|
||||||
statusCode: 400,
|
|
||||||
additionalInfo: "extra data",
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as {
|
|
||||||
message: string;
|
|
||||||
statusCode: number;
|
|
||||||
additionalInfo: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(result.statusCode).toBe(400);
|
|
||||||
expect(result.additionalInfo).toBe("extra data");
|
|
||||||
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -4,51 +4,6 @@ import { getEntityName } from "../DocumentUtility";
|
|||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
import { MinimalQueryIterator, nextPage } from "../IteratorUtilities";
|
import { MinimalQueryIterator, nextPage } from "../IteratorUtilities";
|
||||||
|
|
||||||
// Redact sensitive information from BadRequest errors with specific codes
|
|
||||||
export const redactSyntaxErrorMessage = (error: unknown): unknown => {
|
|
||||||
const codesToRedact = ["SC1001", "SC2001"];
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Handle error objects with a message property
|
|
||||||
if (error && typeof error === "object" && "message" in error) {
|
|
||||||
const errorObj = error as { code?: string; message?: string };
|
|
||||||
if (typeof errorObj.message === "string") {
|
|
||||||
// Parse the inner JSON from the message
|
|
||||||
const innerJson = JSON.parse(errorObj.message);
|
|
||||||
if (innerJson.code === "BadRequest" && typeof innerJson.message === "string") {
|
|
||||||
const [innerErrorsJson, activityIdPart] = innerJson.message.split("\r\n");
|
|
||||||
const innerErrorsObj = JSON.parse(innerErrorsJson);
|
|
||||||
if (Array.isArray(innerErrorsObj.errors)) {
|
|
||||||
let modified = false;
|
|
||||||
innerErrorsObj.errors = innerErrorsObj.errors.map((err: { code?: string; message?: string }) => {
|
|
||||||
if (err.code && codesToRedact.includes(err.code)) {
|
|
||||||
modified = true;
|
|
||||||
return { ...err, message: "__REDACTED__" };
|
|
||||||
}
|
|
||||||
return err;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (modified) {
|
|
||||||
// Reconstruct the message with the redacted content
|
|
||||||
const redactedMessage = JSON.stringify(innerErrorsObj) + `\r\n${activityIdPart}`;
|
|
||||||
const redactedError = {
|
|
||||||
...error,
|
|
||||||
message: JSON.stringify({ ...innerJson, message: redactedMessage }),
|
|
||||||
body: undefined as unknown, // Clear body to avoid sensitive data
|
|
||||||
};
|
|
||||||
return redactedError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// If parsing fails, return the original error
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const queryDocumentsPage = async (
|
export const queryDocumentsPage = async (
|
||||||
resourceName: string,
|
resourceName: string,
|
||||||
documentsIterator: MinimalQueryIterator,
|
documentsIterator: MinimalQueryIterator,
|
||||||
@@ -63,12 +18,7 @@ export const queryDocumentsPage = async (
|
|||||||
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Redact sensitive information for telemetry while showing original in console
|
handleError(error, "QueryDocumentsPage", `Failed to query ${entityName} for container ${resourceName}`);
|
||||||
const redactedError = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
handleError(error, "QueryDocumentsPage", `Failed to query ${entityName} for container ${resourceName}`, {
|
|
||||||
redactedError: redactedError as Error,
|
|
||||||
});
|
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
clearMessage();
|
clearMessage();
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
notebookBasePath: get("notebookbasepath"),
|
notebookBasePath: get("notebookbasepath"),
|
||||||
notebookServerToken: get("notebookservertoken"),
|
notebookServerToken: get("notebookservertoken"),
|
||||||
notebookServerUrl: get("notebookserverurl"),
|
notebookServerUrl: get("notebookserverurl"),
|
||||||
sandboxNotebookOutputs: true,
|
sandboxNotebookOutputs: "true" === get("sandboxnotebookoutputs", "true"),
|
||||||
selfServeType: get("selfservetype"),
|
selfServeType: get("selfservetype"),
|
||||||
showMinRUSurvey: "true" === get("showminrusurvey"),
|
showMinRUSurvey: "true" === get("showminrusurvey"),
|
||||||
ttl90Days: "true" === get("ttl90days"),
|
ttl90Days: "true" === get("ttl90days"),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe("AuthorizationUtils", () => {
|
|||||||
enableKoResourceTree: false,
|
enableKoResourceTree: false,
|
||||||
enableThroughputBuckets: false,
|
enableThroughputBuckets: false,
|
||||||
hostedDataExplorer: false,
|
hostedDataExplorer: false,
|
||||||
sandboxNotebookOutputs: true,
|
sandboxNotebookOutputs: false,
|
||||||
showMinRUSurvey: false,
|
showMinRUSurvey: false,
|
||||||
ttl90Days: false,
|
ttl90Days: false,
|
||||||
enableThroughputCap: false,
|
enableThroughputCap: false,
|
||||||
|
|||||||
169
test/sql/scaleAndSettings/dataMasking.spec.ts
Normal file
169
test/sql/scaleAndSettings/dataMasking.spec.ts
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
import { expect, Page, test } from "@playwright/test";
|
||||||
|
import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
|
||||||
|
import { createTestSQLContainer, TestContainerContext } from "../../testData";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for Dynamic Data Masking (DDM) feature.
|
||||||
|
*
|
||||||
|
* Prerequisites:
|
||||||
|
* - Test account must have the EnableDynamicDataMasking capability enabled
|
||||||
|
* - If the capability is not enabled, the DataMaskingTab will not be visible and tests will be skipped
|
||||||
|
*
|
||||||
|
* Important Notes:
|
||||||
|
* - Once DDM is enabled on a container, it cannot be disabled (isPolicyEnabled cannot be set to false)
|
||||||
|
* - Tests focus on enabling DDM and modifying the masking policy configuration
|
||||||
|
*/
|
||||||
|
test.describe("Data Masking under Scale & Settings", () => {
|
||||||
|
let context: TestContainerContext = null!;
|
||||||
|
let explorer: DataExplorer = null!;
|
||||||
|
|
||||||
|
test.beforeAll("Create Test Database", async () => {
|
||||||
|
context = await createTestSQLContainer();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach("Open Data Masking tab under Scale & Settings", async ({ page }) => {
|
||||||
|
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||||
|
|
||||||
|
// Click Scale & Settings
|
||||||
|
await explorer.openScaleAndSettings(context);
|
||||||
|
|
||||||
|
// Check if Data Masking tab is available (requires EnableDynamicDataMasking capability)
|
||||||
|
const dataMaskingTab = explorer.frame.getByTestId("settings-tab-header/DataMaskingTab");
|
||||||
|
const isTabVisible = await dataMaskingTab.isVisible().catch(() => false);
|
||||||
|
|
||||||
|
if (!isTabVisible) {
|
||||||
|
test.skip(
|
||||||
|
true,
|
||||||
|
"Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await dataMaskingTab.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll("Delete Test Database", async () => {
|
||||||
|
await context?.dispose();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Data Masking editor should be visible", async () => {
|
||||||
|
// Verify the Data Masking editor is visible
|
||||||
|
const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor");
|
||||||
|
await expect(dataMaskingEditor).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Enable data masking policy with valid JSON", async ({ page }) => {
|
||||||
|
await clearDataMaskingEditorContent({ page });
|
||||||
|
|
||||||
|
// Type a valid data masking policy
|
||||||
|
// Note: Once DDM is enabled on a container, it cannot be disabled
|
||||||
|
const validPolicy = JSON.stringify(
|
||||||
|
{
|
||||||
|
includedPaths: [
|
||||||
|
{
|
||||||
|
path: "/email",
|
||||||
|
strategy: "Default",
|
||||||
|
startPosition: 0,
|
||||||
|
length: -1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
excludedPaths: [],
|
||||||
|
isPolicyEnabled: true,
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.keyboard.type(validPolicy);
|
||||||
|
|
||||||
|
// Wait a moment for the changes to be processed
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// Click Save button
|
||||||
|
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||||
|
await expect(saveButton).toBeEnabled();
|
||||||
|
await saveButton.click();
|
||||||
|
|
||||||
|
// Verify success message
|
||||||
|
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||||
|
`Successfully updated container ${context.container.id}`,
|
||||||
|
{
|
||||||
|
timeout: 2 * ONE_MINUTE_MS,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Show validation error for invalid JSON", async ({ page }) => {
|
||||||
|
await clearDataMaskingEditorContent({ page });
|
||||||
|
|
||||||
|
// Type invalid JSON
|
||||||
|
await page.keyboard.type("{invalid json}");
|
||||||
|
|
||||||
|
// Wait a moment for validation
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// Save button should be disabled due to invalid JSON
|
||||||
|
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||||
|
await expect(saveButton).toBeDisabled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Update data masking policy with multiple paths", async ({ page }) => {
|
||||||
|
await clearDataMaskingEditorContent({ page });
|
||||||
|
|
||||||
|
// Type a policy with multiple included paths and excluded paths
|
||||||
|
const multiPathPolicy = JSON.stringify(
|
||||||
|
{
|
||||||
|
includedPaths: [
|
||||||
|
{
|
||||||
|
path: "/email",
|
||||||
|
strategy: "Default",
|
||||||
|
startPosition: 0,
|
||||||
|
length: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/phoneNumber",
|
||||||
|
strategy: "Default",
|
||||||
|
startPosition: 0,
|
||||||
|
length: -1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
excludedPaths: ["/id", "/timestamp"],
|
||||||
|
isPolicyEnabled: true,
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.keyboard.type(multiPathPolicy);
|
||||||
|
|
||||||
|
// Wait a moment for the changes to be processed
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// Click Save button
|
||||||
|
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||||
|
await expect(saveButton).toBeEnabled();
|
||||||
|
await saveButton.click();
|
||||||
|
|
||||||
|
// Verify success message
|
||||||
|
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||||
|
`Successfully updated container ${context.container.id}`,
|
||||||
|
{
|
||||||
|
timeout: 2 * ONE_MINUTE_MS,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to clear the data masking editor content.
|
||||||
|
*/
|
||||||
|
const clearDataMaskingEditorContent = async ({ page }: { page: Page }): Promise<void> => {
|
||||||
|
// Wait for the Monaco editor to be visible
|
||||||
|
await explorer.frame.waitForSelector(".settingsV2Editor", { state: "visible" });
|
||||||
|
const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor");
|
||||||
|
await dataMaskingEditor.click();
|
||||||
|
|
||||||
|
// Clear existing content (Ctrl+A + Backspace does not work reliably with webkit)
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
await page.keyboard.press("Backspace");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user