Compare commits

..

6 Commits

Author SHA1 Message Date
Copilot
56bc65f5fb Fix format and lint errors in DDM Playwright tests (#2350)
* Initial plan

* Fix format and lint errors in dataMasking.spec.ts

Co-authored-by: sakshigupta12feb <206070758+sakshigupta12feb@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sakshigupta12feb <206070758+sakshigupta12feb@users.noreply.github.com>
2026-01-22 22:19:56 +05:30
Copilot
6c2ad8b001 Add Playwright E2E tests for Dynamic Data Masking feature (#2348)
* Initial plan

* Add DDM Playwright test with comprehensive test cases

Co-authored-by: sakshigupta12feb <206070758+sakshigupta12feb@users.noreply.github.com>

* Remove disable DDM test - DDM cannot be disabled once enabled

Co-authored-by: sakshigupta12feb <206070758+sakshigupta12feb@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sakshigupta12feb <206070758+sakshigupta12feb@users.noreply.github.com>
2026-01-22 20:39:29 +05:30
sakshigupta12feb
31385950dd removed NotebookViewer file (#2281)
Co-authored-by: Sakshi Gupta <sakshig@microsoft.com>
2026-01-22 00:07:06 +05:30
Laurent Nguyen
6dce2632c8 fix: prevent race condition by initializing scenario tracking after config is set (#2339)
Co-authored-by: Laurent Nguyen <languye@microsoft.com>
2026-01-21 17:28:08 +01:00
BChoudhury-ms
80ad5f10d4 update args type for FT data creation (#2330) 2026-01-21 15:59:26 +05:30
BChoudhury-ms
f02611c90e Fix: Disable Complete action when any job update is in progress (#2335)
* Fix: Disable Complete action when any job update is in progress

- Updated CopyJobActionMenu to disable Complete button when any action is being performed
- Added comprehensive tests to verify Complete button is disabled during updates
- Improved user experience by preventing concurrent actions on copy jobs

This PR was generated by GitHub Copilot CLI

* Fix lint error: Remove unused variable in CopyJobActionMenu (#2336)

* Initial plan

* Fix lint error: Remove unused variable 'updatingAction' in CopyJobActionMenu.tsx

Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>
2026-01-21 11:55:15 +05:30
7 changed files with 206 additions and 99 deletions

4
package-lock.json generated
View File

@@ -29907,9 +29907,7 @@
}
},
"node_modules/node-forge": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.3.tgz",
"integrity": "sha512-rLvcdSyRCyouf6jcOIPe/BgwG/d7hKjzMKOas33/pHEr6gbq18IK9zV7DiPvzsz0oBJPme6qr6H6kGZuI9/DZg==",
"version": "1.3.1",
"dev": true,
"license": "(BSD-3-Clause OR GPL-2.0)",
"engines": {

View File

@@ -516,7 +516,7 @@ describe("CopyJobActionMenu", () => {
expect(screen.getByText("Cancel")).toBeInTheDocument();
});
it("should handle complete action disabled state for online jobs", () => {
it("should disable complete action when job is being updated", () => {
const job = createMockJob({
Status: CopyJobStatusType.InProgress,
Mode: CopyJobMigrationType.Online,
@@ -530,8 +530,34 @@ describe("CopyJobActionMenu", () => {
const completeButton = screen.getByText("Complete");
fireEvent.click(completeButton);
// Simulate dialog confirmation to trigger state update
const [, , , onOkCallback] = mockShowOkCancelModalDialog.mock.calls[0];
onOkCallback();
fireEvent.click(actionButton);
expect(screen.getByText("Complete")).toBeInTheDocument();
const completeButtonAfterClick = screen.getByText("Complete").closest("button");
expect(completeButtonAfterClick).toBeInTheDocument();
expect(completeButtonAfterClick).toHaveAttribute("aria-disabled", "true");
});
it("should disable complete action when any other action is being performed", () => {
const job = createMockJob({
Status: CopyJobStatusType.InProgress,
Mode: CopyJobMigrationType.Online,
});
render(<TestComponentWrapper job={job} />);
const actionButton = screen.getByRole("button", { name: "Actions" });
fireEvent.click(actionButton);
const pauseButton = screen.getByText("Pause");
fireEvent.click(pauseButton);
fireEvent.click(actionButton);
const completeButtonAfterClick = screen.getByText("Complete").closest("button");
expect(completeButtonAfterClick).toBeInTheDocument();
expect(completeButtonAfterClick).toHaveAttribute("aria-disabled", "true");
});
});

View File

@@ -61,7 +61,6 @@ const CopyJobActionMenu: React.FC<CopyJobActionMenuProps> = ({ job, handleClick
const getMenuItems = (): IContextualMenuProps["items"] => {
const isThisJobUpdating = updatingJobAction?.jobName === job.Name;
const updatingAction = updatingJobAction?.action;
const baseItems = [
{
@@ -105,7 +104,7 @@ const CopyJobActionMenu: React.FC<CopyJobActionMenuProps> = ({ job, handleClick
text: ContainerCopyMessages.MonitorJobs.Actions.complete,
iconProps: { iconName: "CheckMark" },
onClick: () => showActionConfirmationDialog(job, CopyJobActions.complete),
disabled: isThisJobUpdating && updatingAction === CopyJobActions.complete,
disabled: isThisJobUpdating,
});
}
return filteredItems;

View File

@@ -105,9 +105,12 @@ const App = (): JSX.Element => {
// Scenario-based health tracking: start ApplicationLoad and complete phases.
const { startScenario, completePhase } = useMetricScenario();
React.useEffect(() => {
startScenario(MetricScenario.ApplicationLoad);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// Only start scenario after config is initialized to avoid race conditions
// with message handlers that depend on configContext.platform
if (config) {
startScenario(MetricScenario.ApplicationLoad);
}
}, [config, startScenario]);
React.useEffect(() => {
if (explorer) {

View File

@@ -1,88 +0,0 @@
import { initializeIcons } from "@fluentui/react";
import "bootstrap/dist/css/bootstrap.css";
import React from "react";
import * as ReactDOM from "react-dom";
import { configContext, initializeConfiguration } from "../ConfigContext";
import { GalleryHeaderComponent } from "../Explorer/Controls/Header/GalleryHeaderComponent";
import { GalleryTab } from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
import {
NotebookViewerComponent,
NotebookViewerComponentProps,
} from "../Explorer/Controls/NotebookViewer/NotebookViewerComponent";
import * as FileSystemUtil from "../Explorer/Notebook/FileSystemUtil";
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
import * as GalleryUtils from "../Utils/GalleryUtils";
const onInit = async () => {
initializeIcons();
await initializeConfiguration();
const galleryViewerProps = GalleryUtils.getGalleryViewerProps(window.location.search);
const notebookViewerProps = GalleryUtils.getNotebookViewerProps(window.location.search);
let backNavigationText: string;
let onBackClick: () => void;
if (galleryViewerProps.selectedTab !== undefined) {
backNavigationText = GalleryUtils.getTabTitle(galleryViewerProps.selectedTab);
onBackClick = () =>
(window.location.href = `${configContext.hostedExplorerURL}gallery.html?tab=${
GalleryTab[galleryViewerProps.selectedTab]
}`);
}
const hideInputs = notebookViewerProps.hideInputs;
const notebookUrl = decodeURIComponent(notebookViewerProps.notebookUrl);
const galleryItemId = notebookViewerProps.galleryItemId;
let galleryItem: IGalleryItem;
if (galleryItemId) {
const junoClient = new JunoClient();
const galleryItemJunoResponse = await junoClient.getNotebookInfo(galleryItemId);
galleryItem = galleryItemJunoResponse.data;
}
// The main purpose of hiding the prompt is to hide everything when hiding inputs.
// It is generally not very useful to just hide the prompt.
const hidePrompts = hideInputs;
render(notebookUrl, backNavigationText, hideInputs, hidePrompts, galleryItem, onBackClick);
};
const render = (
notebookUrl: string,
backNavigationText: string,
hideInputs?: boolean,
hidePrompts?: boolean,
galleryItem?: IGalleryItem,
onBackClick?: () => void,
) => {
const props: NotebookViewerComponentProps = {
junoClient: galleryItem ? new JunoClient() : undefined,
notebookUrl,
galleryItem,
backNavigationText,
hideInputs,
hidePrompts,
onBackClick: onBackClick,
onTagClick: undefined,
};
if (galleryItem) {
document.title = FileSystemUtil.stripExtension(galleryItem.name, "ipynb");
}
const element = (
<>
<header>
<GalleryHeaderComponent />
</header>
<div style={{ marginLeft: 120, marginRight: 120 }}>
<NotebookViewerComponent {...props} />
</div>
</>
);
ReactDOM.render(element, document.getElementById("notebookContent"));
};
// Entry point
window.addEventListener("load", onInit);

View File

@@ -10,7 +10,7 @@ let CONTAINER_ID: string;
// Set up test database and container with data before all tests
test.beforeAll(async () => {
testContainer = await createTestSQLContainer(true);
testContainer = await createTestSQLContainer({ includeTestData: true });
DATABASE_ID = testContainer.database.id;
CONTAINER_ID = testContainer.container.id;
});

View 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");
}
};
});