From 27c254acbd896f710ae6d7c2ac8e15cdddcb1ab0 Mon Sep 17 00:00:00 2001 From: Cesar N <11819101+cesnietor@users.noreply.github.com> Date: Thu, 4 May 2023 11:35:24 -0700 Subject: [PATCH] Add tests for Describe tab content in PVC and Pods (#1596) --- .../TenantDetails/pods/PodDescribe.tsx | 242 +++++++++--------- .../TenantDetails/pvcs/PVCDescribe.tsx | 91 ++++--- .../operator/tenant/test-1/tenant-test-1.ts | 31 ++- 3 files changed, 206 insertions(+), 158 deletions(-) diff --git a/web-app/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx b/web-app/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx index 9dd6395220f..df982bfe2a2 100644 --- a/web-app/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx +++ b/web-app/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx @@ -181,16 +181,18 @@ const HeaderSection = ({ title }: { title: string }) => { const PodDescribeSummary = ({ describeInfo }: IPodDescribeSummaryProps) => { return ( - - - - - - - - - - +
+ + + + + + + + + + +
); }; @@ -200,16 +202,18 @@ const PodDescribeAnnotations = ({ }: IPodDescribeAnnotationsProps) => { return ( - - - {annotations.map((annotation, index) => ( - - ))} - +
+ + + {annotations.map((annotation, index) => ( + + ))} + +
); }; @@ -217,28 +221,32 @@ const PodDescribeAnnotations = ({ const PodDescribeLabels = ({ labels }: IPodDescribeLabelsProps) => { return ( - - - {labels.map((label, index) => ( - - ))} - +
+ + + {labels.map((label, index) => ( + + ))} + +
); }; const PodDescribeConditions = ({ conditions }: IPodDescribeConditionsProps) => { return ( - +
+ +
); }; @@ -246,41 +254,45 @@ const PodDescribeTolerations = ({ tolerations, }: IPodDescribeTolerationsProps) => { return ( - +
+ +
); }; const PodDescribeVolumes = ({ volumes }: IPodDescribeVolumesProps) => { return ( - {volumes.map((volume, index) => ( - - - - {volume.pvc && ( - - - - - )} - {/* TODO Add component to display projected data (Maybe change API response) */} - {volume.projected && ( - - )} - - - ))} +
+ {volumes.map((volume, index) => ( + + + + {volume.pvc && ( + + + + + )} + {/* TODO Add component to display projected data (Maybe change API response) */} + {volume.projected && ( + + )} + + + ))} +
); }; @@ -325,57 +337,59 @@ const PodDescribeTable = ({ const PodDescribeContainers = ({ containers }: IPodDescribeContainersProps) => { return ( - {containers.map((container, index) => ( - - - - - - - + {containers.map((container, index) => ( + + + + + + + + + + + + + + + + - - - - - - - - - - - - ))} + + ))} + ); }; diff --git a/web-app/src/screens/Console/Tenants/TenantDetails/pvcs/PVCDescribe.tsx b/web-app/src/screens/Console/Tenants/TenantDetails/pvcs/PVCDescribe.tsx index 03b135cc08a..54598ab9ff0 100644 --- a/web-app/src/screens/Console/Tenants/TenantDetails/pvcs/PVCDescribe.tsx +++ b/web-app/src/screens/Console/Tenants/TenantDetails/pvcs/PVCDescribe.tsx @@ -74,27 +74,32 @@ const HeaderSection = ({ title }: { title: string }) => { const PVCDescribeSummary = ({ describeInfo }: IPVCDescribeSummaryProps) => { return ( - - - - - - - - - - - - +
+ + + + + + + + + + + + +
); }; @@ -104,16 +109,18 @@ const PVCDescribeAnnotations = ({ }: IPVCDescribeAnnotationsProps) => { return ( - - - {annotations.map((annotation, index) => ( - - ))} - +
+ + + {annotations.map((annotation, index) => ( + + ))} + +
); }; @@ -121,16 +128,18 @@ const PVCDescribeAnnotations = ({ const PVCDescribeLabels = ({ labels }: IPVCDescribeLabelsProps) => { return ( - - - {labels.map((label, index) => ( - - ))} - +
+ + + {labels.map((label, index) => ( + + ))} + +
); }; diff --git a/web-app/tests/operator/tenant/test-1/tenant-test-1.ts b/web-app/tests/operator/tenant/test-1/tenant-test-1.ts index 6c764dad603..647a45de9aa 100644 --- a/web-app/tests/operator/tenant/test-1/tenant-test-1.ts +++ b/web-app/tests/operator/tenant/test-1/tenant-test-1.ts @@ -27,7 +27,6 @@ import { fixture("For user with default permissions").page("http://localhost:9090"); -// Test 1 test("Create Tenant and List Tenants", async (t) => { const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`; await loginToOperator(); @@ -35,7 +34,6 @@ test("Create Tenant and List Tenants", async (t) => { await deleteTenant(tenantName); }); -// Test 3 test("Test describe section for PODs in new tenant", async (t) => { const tenantName = "myminio"; await loginToOperator(); @@ -46,6 +44,7 @@ const testPODDescribe = async (tenantName: string) => { await goToPodInTenant(tenantName); await goToPodSection(1); await checkPodDescribeHasSections(); + await checkRendersPodDecribeTabContents(); }; const checkPodDescribeHasSections = async () => { @@ -66,7 +65,26 @@ const checkPodDescribeHasSections = async () => { .ok(); }; -// Test 4 +const checkRendersPodDecribeTabContents = async () => { + await checkRendersTabContentOnClick("#pod-describe-summary"); + await checkRendersTabContentOnClick("#pod-describe-annotations"); + await checkRendersTabContentOnClick("#pod-describe-labels"); + await checkRendersTabContentOnClick("#pod-describe-conditions"); + await checkRendersTabContentOnClick("#pod-describe-tolerations"); + await checkRendersTabContentOnClick("#pod-describe-volumes"); + await checkRendersTabContentOnClick("#pod-describe-containers"); +}; + +const checkRendersTabContentOnClick = async (tabSection: string) => { + // expects tab content id to be like `-content` + const contentId = tabSection + "-content"; + await t + .click(tabSection) + .expect(Selector(contentId).exists) + .ok(contentId + " not found") + .wait(100); +}; + test("Test describe section for PVCs in new tenant", async (t) => { const tenantName = `myminio`; await loginToOperator(); @@ -77,6 +95,13 @@ const testPvcDescribe = async (tenantName: string) => { await goToPvcInTenant(tenantName); await goToPvcSection(1); await checkPvcDescribeHasSections(); + await checkRendersPvcDecribeTabContents(); +}; + +const checkRendersPvcDecribeTabContents = async () => { + await checkRendersTabContentOnClick("#pvc-describe-summary"); + await checkRendersTabContentOnClick("#pvc-describe-annotations"); + await checkRendersTabContentOnClick("#pvc-describe-labels"); }; const checkPvcDescribeHasSections = async () => {