mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-01 07:11:23 +00:00
update FTs for Migration type radio button and action confirmation dialog
This commit is contained in:
@@ -49,7 +49,7 @@ describe("MigrationType", () => {
|
||||
it("should render migration type component with radio buttons", () => {
|
||||
const { container } = render(<MigrationType />);
|
||||
|
||||
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(<MigrationType />);
|
||||
|
||||
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(<MigrationType />);
|
||||
|
||||
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(<MigrationType />);
|
||||
const { container } = render(<MigrationType />);
|
||||
|
||||
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(<MigrationType />);
|
||||
const { container } = render(<MigrationType />);
|
||||
|
||||
expect(screen.getByTestId("migration-type")).toBeInTheDocument();
|
||||
expect(container.querySelector("[data-test='migration-type']")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ export const MigrationType: React.FC<MigrationTypeProps> = React.memo(() => {
|
||||
const selectedKeyContent = ContainerCopyMessages.migrationTypeOptions[selectedKeyLowercase];
|
||||
|
||||
return (
|
||||
<Stack data-testid="migration-type" className="migrationTypeContainer">
|
||||
<Stack data-test="migration-type" className="migrationTypeContainer">
|
||||
<Stack.Item>
|
||||
<ChoiceGroup
|
||||
selectedKey={selectedKey}
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`MigrationType Component Rendering should render migration type componen
|
||||
<div>
|
||||
<div
|
||||
class="ms-Stack migrationTypeContainer css-109"
|
||||
data-testid="migration-type"
|
||||
data-test="migration-type"
|
||||
>
|
||||
<div
|
||||
class="ms-StackItem css-110"
|
||||
@@ -81,16 +81,27 @@ exports[`MigrationType Component Rendering should render migration type componen
|
||||
class="migrationTypeDescription css-124"
|
||||
data-testid="migration-type-description-online"
|
||||
>
|
||||
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.
|
||||
|
||||
<a
|
||||
class="ms-Link root-125"
|
||||
href="https://learn.microsoft.com/en-us/azure/cosmos-db/container-copy?tabs=offline-copy"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
<div
|
||||
class="markdown-body "
|
||||
>
|
||||
Learn more
|
||||
</a>
|
||||
<p>
|
||||
Online container copy jobs let you copy data from a source container to a destination Cosmos DB NoSQL API container using the
|
||||
<a
|
||||
href="https://learn.microsoft.com/azure/cosmos-db/change-feed-modes?tabs=all-versions-and-deletes#all-versions-and-deletes-change-feed-mode-preview"
|
||||
target="_blank"
|
||||
>
|
||||
All Versions and Delete
|
||||
</a>
|
||||
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
|
||||
<a
|
||||
href="https://learn.microsoft.com/azure/cosmos-db/container-copy?tabs=online-copy&pivots=api-nosql#getting-started"
|
||||
target="_blank"
|
||||
>
|
||||
online copy jobs
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,7 +126,6 @@ const CopyJobActionMenu: React.FC<CopyJobActionMenuProps> = ({ job, handleClick
|
||||
menuIconProps={{ iconName: "", className: "hidden" }}
|
||||
ariaLabel={ContainerCopyMessages.MonitorJobs.Columns.actions}
|
||||
title={ContainerCopyMessages.MonitorJobs.Columns.actions}
|
||||
data-test={`CopyJobActionMenu/Button:${job.Name}`}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user