Skip to content

Commit 68cccf2

Browse files
add fix requested
Signed-off-by: Philip Colares Carneiro <philip.colares@gmail.com>
1 parent 5e76062 commit 68cccf2

1 file changed

Lines changed: 24 additions & 35 deletions

File tree

clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/manageColumns.cy.ts

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import {
88
type ModelCatalogInterceptOptions,
99
} from '~/__tests__/cypress/cypress/support/interceptHelpers/modelCatalog';
1010
import { NBSP } from '~/__tests__/cypress/cypress/support/constants';
11-
12-
const STORAGE_KEY = 'hardware-config-table-columns';
11+
import {
12+
DEFAULT_VISIBLE_COLUMN_FIELDS,
13+
HARDWARE_CONFIG_COLUMNS_STORAGE_KEY as STORAGE_KEY,
14+
} from '~/app/pages/modelCatalog/components/HardwareConfigurationTableColumns';
1315

1416
const initIntercepts = (options: Partial<ModelCatalogInterceptOptions> = {}) => {
1517
const resolvedOptions = {
@@ -33,14 +35,22 @@ const navigateToPerformanceInsights = () => {
3335
modelCatalog.clickPerformanceInsightsTab();
3436
};
3537

38+
const navigateWithPerformanceView = () => {
39+
modelCatalog.visit();
40+
modelCatalog.findLoadingState().should('not.exist');
41+
modelCatalog.togglePerformanceView();
42+
modelCatalog.findModelCatalogDetailLink().first().click();
43+
modelCatalog.clickPerformanceInsightsTab();
44+
};
45+
3646
describe('Manage Columns Modal', () => {
3747
beforeEach(() => {
3848
cy.intercept('GET', '/model-registry/api/v1/model_registry*', [
3949
mockModelRegistry({ name: 'modelregistry-sample' }),
4050
]).as('getModelRegistries');
4151

4252
cy.clearLocalStorage(STORAGE_KEY);
43-
initIntercepts({ useValidatedModel: true, includePerformanceArtifacts: true });
53+
initIntercepts();
4454
});
4555

4656
describe('Opening the Modal', () => {
@@ -49,7 +59,6 @@ describe('Manage Columns Modal', () => {
4959

5060
modelCatalog.findManageColumnsButton().should('be.visible');
5161
modelCatalog.openManageColumnsModal();
52-
modelCatalog.findManageColumnsModal().should('be.visible');
5362
});
5463

5564
it('should display search input and column list in the modal', () => {
@@ -64,17 +73,11 @@ describe('Manage Columns Modal', () => {
6473
});
6574

6675
describe('Sticky Columns Exclusion', () => {
67-
it('should not show Hardware configuration column in the modal', () => {
76+
it('should not show sticky columns in the modal', () => {
6877
navigateToPerformanceInsights();
6978
modelCatalog.openManageColumnsModal();
7079

7180
modelCatalog.findManageColumnsModal().should('not.contain.text', 'Hardware configuration');
72-
});
73-
74-
it('should not show Workload type column in the modal', () => {
75-
navigateToPerformanceInsights();
76-
modelCatalog.openManageColumnsModal();
77-
7881
modelCatalog.findManageColumnsModal().should('not.contain.text', 'Workload type');
7982
});
8083

@@ -102,11 +105,14 @@ describe('Manage Columns Modal', () => {
102105
});
103106

104107
it('should add a column back when re-checked and Update is clicked', () => {
105-
navigateToPerformanceInsights();
108+
const columnsWithoutReplicas = DEFAULT_VISIBLE_COLUMN_FIELDS.filter(
109+
(col) => col !== 'replicas',
110+
);
111+
cy.window().then((win) => {
112+
win.localStorage.setItem(STORAGE_KEY, JSON.stringify(columnsWithoutReplicas));
113+
});
106114

107-
modelCatalog.openManageColumnsModal();
108-
modelCatalog.findManageColumnCheckbox('Replicas').uncheck();
109-
modelCatalog.findManageColumnsUpdateButton().click();
115+
navigateToPerformanceInsights();
110116

111117
modelCatalog.findHardwareConfigurationTableHeaders().should('not.contain.text', 'Replicas');
112118

@@ -201,17 +207,8 @@ describe('Manage Columns Modal', () => {
201207
});
202208

203209
describe('Latency Filter Interaction with Column Visibility', () => {
204-
beforeEach(() => {
205-
cy.clearLocalStorage(STORAGE_KEY);
206-
initIntercepts({ useValidatedModel: true, includePerformanceArtifacts: true });
207-
});
208-
209210
it('should update visible columns when latency filter is applied', () => {
210-
modelCatalog.visit();
211-
modelCatalog.findLoadingState().should('not.exist');
212-
modelCatalog.togglePerformanceView();
213-
modelCatalog.findModelCatalogDetailLink().first().click();
214-
modelCatalog.clickPerformanceInsightsTab();
211+
navigateWithPerformanceView();
215212

216213
modelCatalog.openLatencyFilter();
217214
modelCatalog.selectLatencyMetric('E2E');
@@ -228,11 +225,7 @@ describe('Manage Columns Modal', () => {
228225
});
229226

230227
it('should reflect latency filter changes in the manage columns modal state', () => {
231-
modelCatalog.visit();
232-
modelCatalog.findLoadingState().should('not.exist');
233-
modelCatalog.togglePerformanceView();
234-
modelCatalog.findModelCatalogDetailLink().first().click();
235-
modelCatalog.clickPerformanceInsightsTab();
228+
navigateWithPerformanceView();
236229

237230
modelCatalog.openLatencyFilter();
238231
modelCatalog.selectLatencyMetric('ITL');
@@ -251,11 +244,7 @@ describe('Manage Columns Modal', () => {
251244
});
252245

253246
it('should keep non-latency columns unchanged when latency filter updates column visibility', () => {
254-
modelCatalog.visit();
255-
modelCatalog.findLoadingState().should('not.exist');
256-
modelCatalog.togglePerformanceView();
257-
modelCatalog.findModelCatalogDetailLink().first().click();
258-
modelCatalog.clickPerformanceInsightsTab();
247+
navigateWithPerformanceView();
259248

260249
modelCatalog.findHardwareConfigurationTableHeaders().should('contain.text', 'Replicas');
261250

0 commit comments

Comments
 (0)