diff --git a/devops-pipelines/templates/ui-build-and-deploy-stages.yml b/devops-pipelines/templates/ui-build-and-deploy-stages.yml index c7f08d249..b86603805 100644 --- a/devops-pipelines/templates/ui-build-and-deploy-stages.yml +++ b/devops-pipelines/templates/ui-build-and-deploy-stages.yml @@ -84,7 +84,7 @@ stages: VITE_CLIENT_ID: $(VITE_CLIENT_ID) VITE_TENANT_ID: $(VITE_TENANT_ID) VITE_PRIVATE_BETA_USER_GROUP: $(VITE_PRIVATE_BETA_USER_GROUP) - VITE_PRIVATE_BETA_USER_GROUP2: $(VITE_PRIVATE_BETA_USER_GROUP2) + VITE_PRIVATE_BETA_FEATURE_USER_GROUP2: $(VITE_PRIVATE_BETA_FEATURE_USER_GROUP2) VITE_PRIVATE_BETA_CONTACT_EMAIL: $(VITE_PRIVATE_BETA_CONTACT_EMAIL) VITE_FEATURE_FLAG_TRANSFER_MOVE: $(VITE_FEATURE_FLAG_TRANSFER_MOVE) VITE_FEATURE_FLAG_GLOBAL_NAV: $(VITE_FEATURE_FLAG_GLOBAL_NAV) diff --git a/ui-spa/.env.playwright b/ui-spa/.env.playwright index f0dedf481..21c5465ba 100644 --- a/ui-spa/.env.playwright +++ b/ui-spa/.env.playwright @@ -7,6 +7,7 @@ VITE_MOCK_AUTH="true" VITE_FEATURE_FLAG_CASE_DETAILS=false VITE_FEATURE_FLAG_TRANSFER_MOVE=true VITE_FEATURE_FLAG_DISCONNECT_SHARED_DRIVE=true +VITE_PRIVATE_BETA_FEATURE_USER_GROUP2=test-group-id VITE_FEATURE_FLAG_GLOBAL_NAV=false VITE_FEATURE_FLAG_TRANSFER_MATERIALS_V1=false VITE_GLOBAL_NAV_SCRIPT_URL= diff --git a/ui-spa/playwright/integration-tests/transfer-materials-v1/egress-netapp-transfer.spec.ts b/ui-spa/playwright/integration-tests/transfer-materials-v1/egress-netapp-transfer.spec.ts index cf44bb7e4..bbb26d63a 100644 --- a/ui-spa/playwright/integration-tests/transfer-materials-v1/egress-netapp-transfer.spec.ts +++ b/ui-spa/playwright/integration-tests/transfer-materials-v1/egress-netapp-transfer.spec.ts @@ -468,7 +468,7 @@ test.describe("transfer material egress netapp transfer", () => { const transferMaterialsSourcePage = new TransferMaterialsSourcePage(page); await transferMaterialsSourcePage.verifyPageElements(); await transferMaterialsSourcePage.verifyEgressTransferSourceElements(); - await transferMaterialsSourcePage.verifyMoveBtnEnabled(false); + await transferMaterialsSourcePage.verifyMoveBtnHidden(); }); test("Should show the egress connection error screen, if user who does not have access to egress come to the application when there is an active transfer Id", async ({ diff --git a/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.test.tsx b/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.test.tsx new file mode 100644 index 000000000..5c9646ff7 --- /dev/null +++ b/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.test.tsx @@ -0,0 +1,88 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { describe, it, vi, expect } from "vitest"; +import TransferControls from "./TransferControls"; + +describe("TransferControls", () => { + const defaultProps = { + transferSource: "egress" as const, + disableControls: false, + toggleTransferDirection: vi.fn(), + onCopy: vi.fn(), + }; + + it("renders the Move button when transferSource is egress and onMove is provided", () => { + const onMove = vi.fn(); + render(); + + expect(screen.getByText("Move selected")).toBeInTheDocument(); + }); + + it("does not render the Move button when transferSource is egress but onMove is undefined", () => { + render(); + + expect(screen.queryByText("Move selected")).not.toBeInTheDocument(); + }); + + it("does not render the Move button when transferSource is netapp even if onMove is provided", () => { + const onMove = vi.fn(); + render( + , + ); + + expect(screen.queryByText("Move selected")).not.toBeInTheDocument(); + }); + + it("calls onMove when the Move button is clicked", () => { + const onMove = vi.fn(); + render(); + + userEvent.click(screen.getByText("Move selected")); + expect(onMove).toHaveBeenCalledTimes(1); + }); + + it("disables the Move button when disableControls is true", () => { + const onMove = vi.fn(); + render( + , + ); + + expect(screen.getByText("Move selected")).toBeDisabled(); + }); + + it("always renders the Copy button", () => { + render(); + + expect(screen.getByText("Copy selected")).toBeInTheDocument(); + }); + + it("calls onCopy when the Copy button is clicked", () => { + render(); + + userEvent.click(screen.getByText("Copy selected")); + expect(defaultProps.onCopy).toHaveBeenCalledTimes(1); + }); + + it("shows View Shared Drive link when transferSource is egress", () => { + render(); + + expect(screen.getByText("View Shared Drive")).toBeInTheDocument(); + }); + + it("shows View Egress link when transferSource is netapp", () => { + render(); + + expect(screen.getByText("View Egress")).toBeInTheDocument(); + }); + + it("calls toggleTransferDirection when the direction link is clicked", () => { + render(); + + userEvent.click(screen.getByTestId("toggle-transfer-direction")); + expect(defaultProps.toggleTransferDirection).toHaveBeenCalledTimes(1); + }); +}); diff --git a/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.tsx b/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.tsx index cb29ed77d..dc0e48cde 100644 --- a/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.tsx +++ b/ui-spa/src/components/case-management/transfer-materials-v1/TransferControls.tsx @@ -25,7 +25,7 @@ const TransferControls = ({ > Copy selected - {transferSource === "egress" && ( + {transferSource === "egress" && onMove && (