From bf23889877d1bdb1866501a3806bb8b92595d976 Mon Sep 17 00:00:00 2001 From: Bikram Choudhury Date: Wed, 31 Dec 2025 18:29:44 +0530 Subject: [PATCH] update FTs for Migration type radio button and action confirmation dialog --- .../Components/MigrationType.test.tsx | 12 +++---- .../Components/MigrationType.tsx | 2 +- .../__snapshots__/MigrationType.test.tsx.snap | 31 ++++++++++------ .../Components/CopyJobActionMenu.tsx | 1 - test/sql/containercopy.spec.ts | 36 ++++++++++++++----- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.test.tsx b/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.test.tsx index 81384feb3..8e3a46f24 100644 --- a/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.test.tsx +++ b/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.test.tsx @@ -49,7 +49,7 @@ describe("MigrationType", () => { it("should render migration type component with radio buttons", () => { const { container } = render(); - expect(screen.getByTestId("migration-type")).toBeInTheDocument(); + expect(container.querySelector("[data-test='migration-type']")).toBeInTheDocument(); expect(screen.getByRole("radiogroup")).toBeInTheDocument(); const offlineRadio = screen.getByRole("radio", { @@ -99,7 +99,6 @@ describe("MigrationType", () => { it("should render online description and learn more link when online is selected", () => { render(); - expect(screen.getByText(ContainerCopyMessages.migrationTypeOptions.online.description)).toBeInTheDocument(); expect(screen.getByTestId("migration-type-description-online")).toBeInTheDocument(); const learnMoreLink = screen.getByRole("link", { @@ -124,7 +123,6 @@ describe("MigrationType", () => { render(); - expect(screen.getByText(ContainerCopyMessages.migrationTypeOptions.offline.description)).toBeInTheDocument(); expect(screen.getByTestId("migration-type-description-offline")).toBeInTheDocument(); const learnMoreLink = screen.getByRole("link", { @@ -218,9 +216,9 @@ describe("MigrationType", () => { }, }); - render(); + const { container } = render(); - expect(screen.getByTestId("migration-type")).toBeInTheDocument(); + expect(container.querySelector("[data-test='migration-type']")).toBeInTheDocument(); expect( screen.getByRole("radio", { name: ContainerCopyMessages.migrationTypeOptions.offline.title }), ).toBeInTheDocument(); @@ -235,9 +233,9 @@ describe("MigrationType", () => { copyJobState: null, }); - render(); + const { container } = render(); - expect(screen.getByTestId("migration-type")).toBeInTheDocument(); + expect(container.querySelector("[data-test='migration-type']")).toBeInTheDocument(); }); }); }); diff --git a/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.tsx b/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.tsx index 9f838d432..4bb48441c 100644 --- a/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.tsx +++ b/src/Explorer/ContainerCopy/CreateCopyJob/Screens/SelectAccount/Components/MigrationType.tsx @@ -37,7 +37,7 @@ export const MigrationType: React.FC = React.memo(() => { const selectedKeyContent = ContainerCopyMessages.migrationTypeOptions[selectedKeyLowercase]; return ( - +
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - - - Learn more - +

+ Online container copy jobs let you copy data from a source container to a destination Cosmos DB NoSQL API container using the + + All Versions and Delete + + change feed. This allows updates to continue on the source while data is copied. A brief downtime is required at the end to safely switch over client applications to the destination container. Learn more about + + online copy jobs + + . +

+
diff --git a/src/Explorer/ContainerCopy/MonitorCopyJobs/Components/CopyJobActionMenu.tsx b/src/Explorer/ContainerCopy/MonitorCopyJobs/Components/CopyJobActionMenu.tsx index 1a2da31a8..682e20c9a 100644 --- a/src/Explorer/ContainerCopy/MonitorCopyJobs/Components/CopyJobActionMenu.tsx +++ b/src/Explorer/ContainerCopy/MonitorCopyJobs/Components/CopyJobActionMenu.tsx @@ -126,7 +126,6 @@ const CopyJobActionMenu: React.FC = ({ job, handleClick menuIconProps={{ iconName: "", className: "hidden" }} ariaLabel={ContainerCopyMessages.MonitorJobs.Columns.actions} title={ContainerCopyMessages.MonitorJobs.Columns.actions} - data-test={`CopyJobActionMenu/Button:${job.Name}`} /> ); }; diff --git a/test/sql/containercopy.spec.ts b/test/sql/containercopy.spec.ts index a7b05b07e..15df59c15 100644 --- a/test/sql/containercopy.spec.ts +++ b/test/sql/containercopy.spec.ts @@ -50,7 +50,7 @@ test("Opening the Create Copy Job panel", async () => { await expect(panel.getByRole("heading", { name: "Create copy job" })).toBeVisible(); }); -test("select different account dropdown", async () => { +test("select different account dropdown and choose online copy radio button", async () => { const accountDropdown = panel.getByTestId("account-dropdown"); await accountDropdown.click(); @@ -75,8 +75,9 @@ test("select different account dropdown", async () => { throw new Error("No dropdown items available after filtering"); } - const fluentUiCheckboxContainer = panel.getByTestId("migration-type-checkbox").locator("div.ms-Checkbox"); - await fluentUiCheckboxContainer.click(); + const migrationTypeContainer = panel.getByTestId("migration-type"); + const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i }); + await onlineCopyRadioButton.click(); await panel.getByRole("button", { name: "Next" }).click(); }); @@ -339,22 +340,28 @@ test("Loading and verifying subscription & account dropdown", async () => { expectedSourceAccount = selectedAccount; }); -test("Verifying online or offline checkbox", async () => { +test("Verifying online or offline content", async () => { /** - * This test verifies the functionality of the migration type checkbox that toggles between + * This test verifies the functionality of the migration type radio that toggles between * online and offline container copy modes. It ensures that: * 1. When online mode is selected, the user is directed to a permissions screen * 2. When offline mode is selected, the user bypasses the permissions screen * 3. The UI correctly reflects the selected migration type throughout the workflow */ - const fluentUiCheckboxContainer = panel.getByTestId("migration-type-checkbox").locator("div.ms-Checkbox"); - await fluentUiCheckboxContainer.click(); + const migrationTypeContainer = panel.getByTestId("migration-type"); + const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i }); + await onlineCopyRadioButton.click(); + await panel.getByRole("button", { name: "Next" }).click(); + await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).toBeVisible(); await expect(panel.getByText("Online container copy", { exact: true })).toBeVisible(); await panel.getByRole("button", { name: "Previous" }).click(); - await fluentUiCheckboxContainer.click(); + + const offlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Offline mode/i }); + await offlineCopyRadioButton.click(); await panel.getByRole("button", { name: "Next" }).click(); + await expect(panel.getByTestId("Panel:SelectSourceAndTargetContainers")).toBeVisible(); await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).not.toBeVisible(); }); @@ -636,6 +643,19 @@ test("Cancel a copy job", async () => { const cancelAction = frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')"); if (await cancelAction.isVisible({ timeout: 1000 })) { await cancelAction.click(); + await expect(frame.locator(".ms-Dialog-main")).toBeVisible({ timeout: 1000 }); + await expect(frame.locator(".ms-Dialog-main")).toContainText(cancelJobName); + + // Click cancel button on dialog to close it first + const cancelDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Cancel"); + await expect(cancelDialogButton).toBeVisible(); + await cancelDialogButton.click(); + + // Click confirm button + await actionMenuButton.click({ timeout: 1000 }); + await cancelAction.click(); + const confirmDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Confirm"); + await confirmDialogButton.click(); // Verify cancellation await expect(statusCell).toContainText(/cancelled|canceled|failed/i, { timeout: 5000 });