Skip to content

Commit de25e2f

Browse files
committed
Add cypress test, and rename/combine tests for table
1 parent 03ccd39 commit de25e2f

File tree

12 files changed

+85
-79
lines changed

12 files changed

+85
-79
lines changed

frontend/src/pages/modelServing/screens/global/InferenceServiceTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const InferenceServiceTable: React.FC<InferenceServiceTableProps> = ({
6161
return (
6262
<>
6363
<Table
64-
data-testid="inference-service-table"
64+
data-testid="deployments-table"
6565
data={inferenceServices}
6666
columns={mappedColumns}
6767
loading={isLoading}

frontend/src/pages/modelServing/screens/projects/KServeSection/KServeInferenceServiceTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const KServeInferenceServiceTable: React.FC = () => {
5151
<>
5252
<Table
5353
data={inferenceServices}
54-
data-testid="kserve-inference-service-table"
54+
data-testid="deployments-table"
5555
columns={columns}
5656
disableRowRenderSupport
5757
defaultSortColumn={1}

packages/cypress/cypress/pages/modelRegistry.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ class ModelRegistry {
253253
return cy.findByTestId('deployments-tab');
254254
}
255255

256-
findInferenceServiceTable() {
257-
return cy.findByTestId('inference-service-table');
256+
findDeploymentsTable() {
257+
return cy.findByTestId('deployments-table');
258258
}
259259

260-
getInferenceServiceRow(name: string) {
261-
return this.findInferenceServiceTable()
260+
getDeploymentRow(name: string) {
261+
return this.findDeploymentsTable()
262262
.find('tbody')
263263
.find('[data-label="Name"]')
264264
.contains(name)

packages/cypress/cypress/pages/modelServing.ts

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,14 @@ class ModelServingGlobal {
9999
}
100100

101101
private findModelsTable() {
102-
// TODO be more precise
103-
return cy.findByTestId('inference-service-table');
102+
return cy.findByTestId('deployments-table');
104103
}
105104

106105
getModelRow(name: string) {
107106
return this.findModelsTable().find(`[data-label=Name]`).contains(name).parents('tr');
108107
}
109108

110-
getInferenceServiceRow(name: string) {
109+
getDeploymentRow(name: string) {
111110
return new InferenceServiceRow(() => this.getModelRow(name));
112111
}
113112

@@ -664,6 +663,14 @@ class ModelServingRow extends TableRow {
664663
return this.find().find(`[data-label="API protocol"]`);
665664
}
666665

666+
findServingRuntime() {
667+
return this.find().find(`[data-label="Serving runtime"]`);
668+
}
669+
670+
findServiceRuntime() {
671+
return this.findServingRuntime();
672+
}
673+
667674
findLastDeployed() {
668675
return this.find().find(`[data-label="Last deployed"]`);
669676
}
@@ -710,7 +717,7 @@ class KServeRow extends ModelServingRow {
710717
}
711718
}
712719

713-
class InferenceServiceRow extends TableRow {
720+
class InferenceServiceRow extends ModelServingRow {
714721
findServingRuntimeVersionLabel() {
715722
return this.find().findByTestId('serving-runtime-version-label');
716723
}
@@ -737,38 +744,10 @@ class InferenceServiceRow extends TableRow {
737744
});
738745
}
739746

740-
findLastDeployed() {
741-
return this.find().find(`[data-label="Last deployed"]`);
742-
}
743-
744747
findLastDeployedTimestamp() {
745748
return this.find().findByTestId('last-deployed-timestamp');
746749
}
747750

748-
findAPIProtocol() {
749-
return this.find().find(`[data-label="API protocol"]`);
750-
}
751-
752-
findInternalServiceButton() {
753-
return this.find().findByTestId('internal-service-button');
754-
}
755-
756-
findInternalServicePopover() {
757-
return cy.findByTestId('internal-service-popover');
758-
}
759-
760-
findExternalServiceButton() {
761-
return this.find().findByTestId('internal-external-service-button');
762-
}
763-
764-
findExternalServicePopover() {
765-
return cy.findByTestId('external-service-popover');
766-
}
767-
768-
findServingRuntime() {
769-
return this.find().find(`[data-label="Serving runtime"]`);
770-
}
771-
772751
findProject() {
773752
return this.find().find(`[data-label=Project]`);
774753
}
@@ -835,7 +814,7 @@ class ModelServingSection {
835814
}
836815

837816
findKServeTable() {
838-
return this.find().findByTestId('kserve-inference-service-table');
817+
return this.findDeploymentsTable();
839818
}
840819

841820
findModelServerDeployedName(name: string) {
@@ -863,7 +842,7 @@ class ModelServingSection {
863842
}
864843

865844
findKServeTableHeaderButton(name: string) {
866-
return this.findKServeTable().find('thead').findByRole('button', { name });
845+
return this.findDeploymentsTableHeaderButton(name);
867846
}
868847

869848
findInternalExternalServiceButton() {
@@ -876,7 +855,7 @@ class ModelServingSection {
876855

877856
getKServeRow(name: string) {
878857
return new KServeRow(() =>
879-
this.findKServeTable().find('[data-label=Name]').contains(name).parents('tr'),
858+
this.findDeploymentsTable().find('[data-label=Name]').contains(name).parents('tr'),
880859
);
881860
}
882861

@@ -888,17 +867,22 @@ class ModelServingSection {
888867
return this.find().findByTestId('add-server-button');
889868
}
890869

891-
findInferenceServiceTable() {
892-
return cy.findByTestId('inference-service-table');
870+
findDeploymentsTable() {
871+
return cy.get('body').then(($body) => {
872+
if ($body.find('[data-testid="section-model-server"]').length > 0) {
873+
return cy.findByTestId('section-model-server').findByTestId('deployments-table');
874+
}
875+
return cy.findByTestId('deployments-table');
876+
});
893877
}
894878

895-
findInferenceServiceTableHeaderButton(name: string) {
896-
return this.findInferenceServiceTable().find('thead').findByRole('button', { name });
879+
findDeploymentsTableHeaderButton(name: string) {
880+
return this.findDeploymentsTable().find('thead').findByRole('button', { name });
897881
}
898882

899-
getInferenceServiceRow(name: string) {
883+
getDeploymentRow(name: string) {
900884
return new InferenceServiceRow(() =>
901-
this.findInferenceServiceTable()
885+
this.findDeploymentsTable()
902886
.find('tbody')
903887
.find('[data-label="Name"]')
904888
.contains(name)

packages/cypress/cypress/pages/projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class ProjectDetails {
302302
}
303303

304304
findKserveModelsTable() {
305-
return cy.findByTestId('kserve-inference-service-table');
305+
return cy.findByTestId('deployments-table');
306306
}
307307

308308
getKserveModelMetricLink(name: string) {

packages/cypress/cypress/tests/e2e/dataScienceProjects/models/testDeployLLMDServing.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('[Product Bug: RHOAIENG-45528] A user can deploy an LLMD model', () =>
129129
cy.step('Verify the model Row');
130130
modelServingGlobal.visit(projectName);
131131

132-
const llmdRow = modelServingGlobal.getInferenceServiceRow(modelName);
132+
const llmdRow = modelServingGlobal.getDeploymentRow(modelName);
133133
llmdRow.findStatusLabel(ModelStateLabel.STARTED).should('exist');
134134
// Expand row to verify deployment details
135135
llmdRow.findServingRuntime().should('have.text', servingRuntime);

packages/cypress/cypress/tests/e2e/modelCatalog/testCatalogDeployModel.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('Verify a model can be deployed from model catalog', () => {
118118

119119
cy.step('Verify redirection to the global page');
120120
cy.location('pathname').should('eq', `/ai-hub/deployments/${projectName}`);
121-
modelServingGlobal.getInferenceServiceRow(modelName);
121+
modelServingGlobal.getDeploymentRow(modelName);
122122
},
123123
);
124124
});

packages/cypress/cypress/tests/e2e/modelRegistry/testRegistryDeployModel.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('Verify models can be deployed from model registry', () => {
203203
cy.step('Review');
204204
modelServingWizard.findSubmitButton().click();
205205
modelRegistry
206-
.getInferenceServiceRow(`${modelName} - ${testData.version1Name}`)
206+
.getDeploymentRow(`${modelName} - ${testData.version1Name}`)
207207
.should('be.visible');
208208

209209
// Verify model deployment is ready

packages/cypress/cypress/tests/mocked/modelServing/modelServingGlobal.cy.ts

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,12 @@ describe('Model Serving Global', () => {
290290
servingType: 'NVIDIA NIM serving enabled',
291291
},
292292
].forEach((row) => {
293-
modelServingSection.getInferenceServiceRow(row.model).findProject().findByText(row.project);
294-
modelServingSection
295-
.getInferenceServiceRow(row.model)
296-
.findProject()
297-
.findByText(row.servingType);
293+
modelServingSection.getDeploymentRow(row.model).findProject().findByText(row.project);
294+
modelServingSection.getDeploymentRow(row.model).findProject().findByText(row.servingType);
298295
});
299296
// Double check NIM Runtime is listed
300297
modelServingSection
301-
.getInferenceServiceRow('NIM Model')
298+
.getDeploymentRow('NIM Model')
302299
.findServingRuntime()
303300
.should('contain.text', 'NVIDIA NIM');
304301

@@ -422,11 +419,11 @@ describe('Model Serving Global', () => {
422419

423420
modelServingGlobal.visit('test-project');
424421

425-
const latestRow = modelServingSection.getInferenceServiceRow('Latest Model');
422+
const latestRow = modelServingSection.getDeploymentRow('Latest Model');
426423
latestRow.findServingRuntimeVersionLabel().should('contain.text', '1.0.0');
427424
latestRow.findServingRuntimeVersionStatusLabel().should('have.text', 'Latest');
428425

429-
const outdatedRow = modelServingSection.getInferenceServiceRow('Outdated Model');
426+
const outdatedRow = modelServingSection.getDeploymentRow('Outdated Model');
430427
outdatedRow.findServingRuntimeVersionLabel().should('contain.text', '0.5.0');
431428
outdatedRow.findServingRuntimeVersionStatusLabel().should('have.text', 'Outdated');
432429
});
@@ -440,15 +437,44 @@ describe('Model Serving Global', () => {
440437

441438
modelServingGlobal.visit('test-project');
442439
modelServingSection
443-
.getInferenceServiceRow('Test Inference Service')
440+
.getDeploymentRow('Test Inference Service')
444441
.findServingRuntimeVersionLabel()
445442
.should('not.exist');
446443
modelServingSection
447-
.getInferenceServiceRow('Test Inference Service')
444+
.getDeploymentRow('Test Inference Service')
448445
.findServingRuntimeVersionStatusLabel()
449446
.should('not.exist');
450447
});
451448

449+
it('Check table row expandable section', () => {
450+
initIntercepts({
451+
inferenceServices: [
452+
mockInferenceServiceK8sResource({
453+
name: 'llama-service',
454+
displayName: 'Llama Service',
455+
runtimeName: 'llama-service',
456+
}),
457+
],
458+
servingRuntimes: [
459+
mockServingRuntimeK8sResource({
460+
name: 'llama-service',
461+
displayName: 'Llama Service',
462+
namespace: 'test-project',
463+
}),
464+
],
465+
});
466+
467+
modelServingGlobal.visit('test-project');
468+
const kserveRow = modelServingSection.getKServeRow('Llama Service');
469+
kserveRow.findExpansion().should(be.collapsed);
470+
kserveRow.findToggleButton().click();
471+
kserveRow.findDescriptionListItem('Framework').next('dd').should('have.text', 'onnx-1');
472+
kserveRow
473+
.findDescriptionListItem('Hardware profile')
474+
.next('dd')
475+
.should('have.text', 'Small Profile');
476+
});
477+
452478
describe('Table filter and pagination', () => {
453479
it('filter by name', () => {
454480
initIntercepts({});
@@ -532,7 +558,7 @@ describe('Model Serving Global', () => {
532558
modelServingGlobal.findSortButton('Last deployed').click();
533559
modelServingGlobal.findSortButton('Last deployed').should(be.sortAscending);
534560

535-
const oldModelRow = modelServingSection.getInferenceServiceRow('Old Model');
561+
const oldModelRow = modelServingSection.getDeploymentRow('Old Model');
536562
oldModelRow.findLastDeployedTimestamp().trigger('mouseenter');
537563
cy.findByRole('tooltip').should('contain.text', '9/4/2024, 4:12:41 PM UTC');
538564
});
@@ -633,15 +659,15 @@ describe('Model Serving Global', () => {
633659

634660
// Verify "Deleted" label appears in hardware profile column
635661
const deletedLabel = modelServingGlobal
636-
.getInferenceServiceRow('Test Model')
662+
.getDeploymentRow('Test Model')
637663
.findHardwareProfileDeletedLabel();
638664

639665
deletedLabel.should('be.visible');
640666
deletedLabel.click();
641667

642668
// Verify "Deleted" popover shows correct message
643669
const popover = modelServingGlobal
644-
.getInferenceServiceRow('Test Model')
670+
.getDeploymentRow('Test Model')
645671
.findHardwareProfileDeletedPopover();
646672
popover.title().should('be.visible');
647673
popover.body().should('be.visible');
@@ -694,14 +720,14 @@ describe('Model Serving Global', () => {
694720

695721
// Verify "Disabled" label appears in hardware profile column
696722
const disabledLabel = modelServingGlobal
697-
.getInferenceServiceRow('Test Model')
723+
.getDeploymentRow('Test Model')
698724
.findHardwareProfileDisabledLabel();
699725
disabledLabel.should('be.visible');
700726
disabledLabel.click();
701727

702728
// Verify "Disabled" popover shows correct message
703729
const popover = modelServingGlobal
704-
.getInferenceServiceRow('Test Model')
730+
.getDeploymentRow('Test Model')
705731
.findHardwareProfileDisabledPopover();
706732
popover.title().should('be.visible');
707733
popover.body().should('be.visible');
@@ -754,14 +780,14 @@ describe('Model Serving Global', () => {
754780

755781
// Verify "Updated" label appears in hardware profile column
756782
const updatedLabel = modelServingGlobal
757-
.getInferenceServiceRow('Test Model')
783+
.getDeploymentRow('Test Model')
758784
.findHardwareProfileUpdatedLabel();
759785
updatedLabel.should('be.visible');
760786
updatedLabel.click();
761787

762788
// Verify "Updated" popover shows correct message
763789
const popover = modelServingGlobal
764-
.getInferenceServiceRow('Test Model')
790+
.getDeploymentRow('Test Model')
765791
.findHardwareProfileUpdatedPopover();
766792
popover.title().should('be.visible');
767793
popover.body().should('be.visible');
@@ -789,7 +815,7 @@ describe('Model Serving Global', () => {
789815

790816
modelServingGlobal.visit('test-project');
791817

792-
const modelRow = modelServingGlobal.getInferenceServiceRow('Test Model');
818+
const modelRow = modelServingGlobal.getDeploymentRow('Test Model');
793819
const errorIcon = modelRow.findHardwareProfileErrorIcon();
794820
errorIcon.should('exist');
795821
errorIcon.trigger('mouseenter');

packages/cypress/cypress/tests/mocked/modelServing/modelServingNim.cy.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,22 @@ describe('NIM Models Deployments', () => {
1616
modelServingGlobal.visit('test-project');
1717

1818
// Table is visible and has 1 row
19-
modelServingSection.findInferenceServiceTable().should('have.length', 1);
19+
modelServingSection.findDeploymentsTable().should('have.length', 1);
2020

2121
// First row matches the NIM inference service details
2222
modelServingSection
23-
.getInferenceServiceRow('Test Name')
23+
.getDeploymentRow('Test Name')
2424
.findProject()
2525
.should('contains.text', 'Test Project');
2626
modelServingSection
27-
.getInferenceServiceRow('Test Name')
27+
.getDeploymentRow('Test Name')
2828
.findProject()
2929
.should('contains.text', 'NVIDIA NIM serving enabled');
3030
modelServingSection
31-
.getInferenceServiceRow('Test Name')
31+
.getDeploymentRow('Test Name')
3232
.findServingRuntime()
3333
.should('have.text', 'NVIDIA NIM');
34-
modelServingSection
35-
.getInferenceServiceRow('Test Name')
36-
.findAPIProtocol()
37-
.should('have.text', 'REST');
34+
modelServingSection.getDeploymentRow('Test Name').findAPIProtocol().should('have.text', 'REST');
3835
});
3936

4037
it('should be allowed to be deleted and edit', () => {

0 commit comments

Comments
 (0)