diff --git a/frontend/src/__tests__/cypress/cypress/pages/clusterStorage.ts b/frontend/src/__tests__/cypress/cypress/pages/clusterStorage.ts index 50b82b80db..a8bbdcfa9c 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/clusterStorage.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/clusterStorage.ts @@ -19,6 +19,10 @@ class ClusterStorageRow extends TableRow { return this.find().findByTestId('storage-class-deprecated'); } + queryDeprecatedLabel() { + return this.find().get('[data-testid="storage-class-deprecated"]'); + } + shouldHaveDeprecatedTooltip() { cy.findByTestId('storage-class-deprecated-tooltip').should('be.visible'); return this; @@ -144,6 +148,10 @@ class ClusterStorage { ); } + shouldNotHaveDeprecatedAlertMessage() { + return cy.get('[date-testid="storage-class-deprecated-alert"]').should('not.exist'); + } + closeDeprecatedAlert() { cy.findByTestId('storage-class-deprecated-alert-close-button').click(); } diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts index 044a9cf5df..af794ec5ff 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts @@ -50,7 +50,7 @@ const initInterceptors = ({ isEmpty = false, storageClassName }: HandlersProps) ? [] : [ mockPVCK8sResource({ uid: 'test-id', storageClassName }), - mockPVCK8sResource({ displayName: 'Another Cluster Storage' }), + mockPVCK8sResource({ displayName: 'Another Cluster Storage', storageClassName }), ], ), ); @@ -81,7 +81,23 @@ describe('ClusterStorage', () => { }), ); - cy.interceptK8sList(StorageClassModel, mockStorageClassList()); + cy.interceptK8sList( + StorageClassModel, + mockStorageClassList([ + ...mockStorageClasses, + buildMockStorageClass( + { + ...mockStorageClasses[0], + metadata: { + ...mockStorageClasses[0].metadata, + name: 'test-initial-storage-class', + annotations: {}, + }, + }, + {}, + ), + ]), + ); }); it('Check whether the Storage class column is present', () => { @@ -103,6 +119,15 @@ describe('ClusterStorage', () => { clusterStorage.shouldHaveDeprecatedAlertMessage(); clusterStorage.closeDeprecatedAlert(); }); + + it('Should hide deprecated alert when the storage class is not configured', () => { + initInterceptors({ storageClassName: 'test-initial-storage-class' }); + clusterStorage.visit('test-project'); + + const clusterStorageRow = clusterStorage.getClusterStorageRow('Test Storage'); + clusterStorageRow.queryDeprecatedLabel().should('not.exist'); + clusterStorage.shouldNotHaveDeprecatedAlertMessage(); + }); }); it('Empty state', () => { diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/storageClasses/storageClasses.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/storageClasses/storageClasses.cy.ts index 9ca0af414b..aeddfd90a0 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/storageClasses/storageClasses.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/storageClasses/storageClasses.cy.ts @@ -395,7 +395,10 @@ describe('Storage classes', () => { const storageClasses = [ ...mockStorageClasses, buildMockStorageClass( - { ...mockStorageClasses[0], metadata: { ...mockStorageClasses[0], name: 'sc-2' } }, + { + ...mockStorageClasses[0], + metadata: { ...mockStorageClasses[0].metadata, name: 'sc-2' }, + }, { displayName: 'Test SC 2' }, ), ]; diff --git a/frontend/src/pages/projects/screens/detail/storage/StorageTable.tsx b/frontend/src/pages/projects/screens/detail/storage/StorageTable.tsx index 9ac0dd3580..7921662be5 100644 --- a/frontend/src/pages/projects/screens/detail/storage/StorageTable.tsx +++ b/frontend/src/pages/projects/screens/detail/storage/StorageTable.tsx @@ -31,7 +31,8 @@ const StorageTable: React.FC = ({ pvcs, refresh, onAddPVC }) () => storageClassesLoaded && storageTableData.some( - (data) => !data.storageClass || !getStorageClassConfig(data.storageClass)?.isEnabled, + (data) => + !data.storageClass || getStorageClassConfig(data.storageClass)?.isEnabled === false, ), [storageClassesLoaded, storageTableData], ); diff --git a/frontend/src/pages/projects/screens/detail/storage/StorageTableRow.tsx b/frontend/src/pages/projects/screens/detail/storage/StorageTableRow.tsx index c5d9b16039..cb84b7d6e9 100644 --- a/frontend/src/pages/projects/screens/detail/storage/StorageTableRow.tsx +++ b/frontend/src/pages/projects/screens/detail/storage/StorageTableRow.tsx @@ -131,7 +131,7 @@ const StorageTableRow: React.FC = ({ ) : ( - !storageClassConfig?.isEnabled && ( + storageClassConfig?.isEnabled === false && (