Skip to content

Commit 828b9bd

Browse files
RPG-coder-intcfjcooper5KaliszWiktoriaguptagunjan
authored
[ITEP-24904] fix manual deployment cluster drawer (#3)
Co-authored-by: Fred Cooper <fred.cooper@intel.com> Co-authored-by: Kalisz <wiktoria.kalisz@intel.com> Co-authored-by: Gupta <gunjan.gupta@intel.com> Co-authored-by: guptagunjan <88308027+guptagunjan@users.noreply.github.com>
1 parent 3c87067 commit 828b9bd

37 files changed

Lines changed: 622 additions & 337 deletions

File tree

apps/app-orch/src/components/organisms/setup-deployments/ClusterDetails/ClusterDetails.cy.tsx

Lines changed: 0 additions & 48 deletions
This file was deleted.

apps/app-orch/src/components/organisms/setup-deployments/ClusterDetails/ClusterDetails.pom.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

apps/app-orch/src/components/organisms/setup-deployments/ClusterDetails/ClusterDetails.tsx

Lines changed: 0 additions & 125 deletions
This file was deleted.

apps/app-orch/src/components/organisms/setup-deployments/SelectCluster/SelectCluster.cy.tsx

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,57 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import SelectCluster from "./SelectCluster";
6+
import { Button } from "@spark-design/react";
7+
import React from "react";
8+
import SelectCluster, { SelectClusterMode } from "./SelectCluster";
79
import SelectClusterPom from "./SelectCluster.pom";
810

11+
const ClusterListMock = ({
12+
onShowDetails,
13+
}: {
14+
onShowDetails: (clusterId: string) => void;
15+
}) => {
16+
return (
17+
<Button
18+
data-cy="testShowDrawer"
19+
onPress={() => {
20+
onShowDetails("cluster1");
21+
}}
22+
>
23+
cluster1
24+
</Button>
25+
);
26+
};
27+
928
const pom = new SelectClusterPom();
1029
describe("<SelectCluster/>", () => {
1130
beforeEach(() => {
1231
cy.mount(
1332
<SelectCluster
14-
onDeploymentNameChange={() => {}}
1533
selectedIds={[]}
16-
onSelect={() => {}}
34+
onSelect={cy.stub().as("onSelectStub")}
35+
onDeploymentNameChange={cy.stub().as("onDeploymentNameChangeStub")}
36+
mode={SelectClusterMode.CREATE}
37+
__ClusterListRemote={React.lazy(() =>
38+
Promise.resolve({
39+
default: () => (
40+
<ClusterListMock onShowDetails={cy.stub().as("onShowDetails")} />
41+
),
42+
}),
43+
)}
1744
/>,
1845
);
1946
});
2047
it("should render component", () => {
2148
pom.root.should("exist");
2249
pom.el.title.contains("Enter Deployment Details");
2350
});
51+
52+
it("should show cluster details", () => {
53+
// This will avoid the error shown when no name is entered
54+
pom.el.deploymentNameField.type("test");
55+
56+
cy.get("[data-cy='testShowDrawer']").click();
57+
cy.get("@onShowDetails").should("be.calledWith", "cluster1");
58+
});
2459
});

apps/app-orch/src/components/organisms/setup-deployments/SelectCluster/SelectCluster.pom.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@
55

66
import { SiTablePom } from "@orch-ui/poms";
77
import { Cy, CyPom } from "@orch-ui/tests";
8-
import { dataCy as clusterDetailDataCy } from "../ClusterDetails/ClusterDetails";
9-
import ClusterDetailsPom from "../ClusterDetails/ClusterDetails.pom";
108

119
const dataCySelectors = ["title", "deploymentNameField"] as const;
1210
type Selectors = (typeof dataCySelectors)[number];
1311
type ApiAliases = "getClusterSuccess";
1412

1513
class SelectClusterPom extends CyPom<Selectors, ApiAliases> {
1614
public clusterTable: SiTablePom;
17-
public clusterDetail: ClusterDetailsPom;
1815
constructor(public rootCy: string = "selectCluster") {
1916
super(rootCy, [...dataCySelectors]);
2017
this.clusterTable = new SiTablePom("table");
21-
this.clusterDetail = new ClusterDetailsPom(clusterDetailDataCy);
2218
}
2319

2420
public selectNthCluster(n: number): Cy {

0 commit comments

Comments
 (0)