Skip to content

Commit

Permalink
test: final touchups
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Figenblat <tfigenbl@redhat.com>
  • Loading branch information
TomerFi committed Oct 29, 2024
1 parent b01fe1b commit 06baa5e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
5 changes: 3 additions & 2 deletions frontend/src/__tests__/cypress/cypress/pages/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,13 @@ class ProjectDetailsOverviewTab extends ProjectDetails {
super.visitSection(project, 'overview');
}

findDeployedModel(name: string) {
findDeployedModelServingRuntime(name: string) {
return cy
.findByTestId('section-overview')
.get('div')
.contains(name)
.parents('.odh-type-bordered-card .model-server');
.parents('.odh-type-bordered-card .model-server')
.get('dd');
}

findModelServingPlatform(name: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import {
} from '~/__tests__/cypress/cypress/pages/projects';
import { nimDeployModal } from '~/__tests__/cypress/cypress/pages/components/NIMDeployModal';
import {
findNimModelDeployButton,
initInterceptorsValidatingNimEnablement,
initInterceptsForDeleteModel,
initInterceptsToDeployModel,
initInterceptsToEnableNim,
modalDialogTitle,
} from '~/__tests__/cypress/cypress/utils/nimUtils';
import { deleteModal } from '~/__tests__/cypress/cypress/pages/components/DeleteModal';

Expand All @@ -26,23 +24,23 @@ describe('NIM Model Serving', () => {

projectDetails.visitSection('test-project', 'model-server');
// For multiple cards use case
findNimModelDeployButton().click();
cy.contains(modalDialogTitle).should('be.visible');
projectDetails
.findModelServingPlatform('nvidia-nim-model')
.findByTestId('nim-serving-deploy-button')
.click();

// test that you can not submit on empty
nimDeployModal.shouldBeOpen();
nimDeployModal.findSubmitButton().should('be.disabled');
});

it('should be enabled if the card has the minimal info', () => {
it('should be enabled if the modal has the minimal info', () => {
initInterceptsToEnableNim({});
const nimInferenceService = mockNimInferenceService();
initInterceptsToDeployModel(nimInferenceService);

projectDetails.visitSection('test-project', 'model-server');
cy.findByTestId('deploy-button').should('exist');
cy.findByTestId('deploy-button').click();
cy.contains(modalDialogTitle).should('be.visible');
cy.get('button[data-testid=deploy-button]').click();

// test that you can not submit on empty
nimDeployModal.shouldBeOpen();
Expand Down Expand Up @@ -146,8 +144,7 @@ describe('NIM Model Serving', () => {

// Card is visible
projectDetailsOverviewTab
.findDeployedModel('Test Name')
.get('dd')
.findDeployedModelServingRuntime('Test Name')
.should('have.text', 'NVIDIA NIM');
});

Expand Down Expand Up @@ -188,7 +185,7 @@ describe('NIM Model Serving', () => {
it("should allow deploying NIM from a Project's Models tab when the only platform", () => {
initInterceptsToEnableNim({});
projectDetails.visitSection('test-project', 'model-server');
cy.get('button').contains('Deploy model').click(); // TODO button has testid?
cy.get('button[data-testid=deploy-button]').click();
nimDeployModal.shouldBeOpen();
});

Expand Down Expand Up @@ -236,7 +233,7 @@ describe('NIM Model Serving', () => {
disableNIMModelServing: true,
});
projectDetails.visitSection('test-project', 'model-server');
cy.get('button').contains('Deploy model').should('not.exist'); // TODO button has testid?
cy.get('button[data-testid=deploy-button]').should('not.exist');
});

it("should NOT allow deploying NIM to a Project's Models tab when multiple platforms exist", () => {
Expand Down Expand Up @@ -289,8 +286,7 @@ describe('NIM Model Serving', () => {
true,
);
projectDetails.visitSection('test-project', 'model-server');
cy.get('button').contains('Deploy model').click(); // TODO button has testid?
nimDeployModal.shouldBeOpen(false);
cy.get('button[data-testid=deploy-button]').should('not.exist');
});

it("should NOT allow deploying NIM to a Project's Models tab when multiple platforms exist", () => {
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/__tests__/cypress/cypress/utils/nimUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ import {
import { mockAcceleratorProfile } from '~/__mocks__/mockAcceleratorProfile';
import type { InferenceServiceKind } from '~/k8sTypes';

export function findNimModelDeployButton(): Cypress.Chainable<JQuery> {
return findNimModelServingPlatformCard().findByTestId('nim-serving-deploy-button');
}

export function findNimModelServingPlatformCard(): Cypress.Chainable<JQuery> {
return cy.findByTestId('nvidia-nim-model-serving-platform-card');
}

export const modalDialogTitle = 'Deploy model with NVIDIA NIM';

/* ###################################################
###### Interception Initialization Utilities ######
################################################### */
Expand Down

0 comments on commit 06baa5e

Please sign in to comment.