@@ -23,7 +23,7 @@ import {
2323} from '@odh-dashboard/model-serving/components/deploymentWizard/types' ;
2424import { modelRegistry } from '../../../../pages/modelRegistry' ;
2525import { modelVersionDeployModal } from '../../../../pages/modelRegistry/modelVersionDeployModal' ;
26- import { SecretModel , ServiceModel } from '../../../../utils/models' ;
26+ import { ServiceModel } from '../../../../utils/models' ;
2727import { initDeployPrefilledModelIntercepts } from '../../../../utils/modelServingUtils' ;
2828import { modelDetails } from '../../../../pages/modelRegistry/modelDetails' ;
2929import { modelVersionDetails } from '../../../../pages/modelRegistry/modelVersionDetails' ;
@@ -38,6 +38,7 @@ type HandlersProps = {
3838 isEmpty ?: boolean ;
3939 disableKServe ?: boolean ;
4040 disableNIMModelServing ?: boolean ;
41+ secrets ?: ReturnType < typeof mockK8sResourceList > ;
4142} ;
4243
4344const registeredModelMocked = mockRegisteredModel ( { name : 'test-1' } ) ;
@@ -66,6 +67,7 @@ const initIntercepts = ({
6667 disableKServe = false ,
6768 disableNIMModelServing = true ,
6869 isEmpty = false ,
70+ secrets,
6971} : HandlersProps ) => {
7072 initDeployPrefilledModelIntercepts ( {
7173 disableProjectScoped,
@@ -74,6 +76,13 @@ const initIntercepts = ({
7476 isEmpty,
7577 } ) ;
7678
79+ // Intercept secrets for kserve-project namespace if provided
80+ if ( secrets ) {
81+ cy . intercept ( 'GET' , '/api/k8s/api/v1/namespaces/kserve-project/secrets*' , {
82+ body : secrets ,
83+ } ) ;
84+ }
85+
7786 // Additional intercepts needed for wizard to load properly
7887 cy . interceptOdh ( 'GET /api/components' , null , [ ] ) ;
7988
@@ -493,10 +502,8 @@ describe('Deploy model version', () => {
493502 } ) ;
494503
495504 it ( 'Prefills new connection in case of no matching connections' , ( ) => {
496- initIntercepts ( { } ) ;
497- cy . interceptK8sList (
498- SecretModel ,
499- mockK8sResourceList ( [
505+ initIntercepts ( {
506+ secrets : mockK8sResourceList ( [
500507 mockSecretK8sResource ( {
501508 name : 'test-secret-not-match' ,
502509 displayName : 'Test Secret Not Match' ,
@@ -506,7 +513,7 @@ describe('Deploy model version', () => {
506513 region : 'dGVzdC1yZWdpb24=' ,
507514 } ) ,
508515 ] ) ,
509- ) ;
516+ } ) ;
510517 modelVersionDetails . visit ( undefined , undefined , '2' ) ;
511518 modelVersionDetails . findDeployModelButton ( ) . click ( ) ;
512519 modelVersionDeployModal . selectProjectByName ( 'KServe project' ) ;
@@ -526,10 +533,8 @@ describe('Deploy model version', () => {
526533 } ) ;
527534
528535 it ( 'Prefills when there is one s3 matching connection' , ( ) => {
529- initIntercepts ( { } ) ;
530- cy . interceptK8sList (
531- SecretModel ,
532- mockK8sResourceList ( [
536+ initIntercepts ( {
537+ secrets : mockK8sResourceList ( [
533538 mockSecretK8sResource ( {
534539 namespace : 'kserve-project' ,
535540 s3Bucket : 'dGVzdC1idWNrZXQ=' ,
@@ -545,7 +550,7 @@ describe('Deploy model version', () => {
545550 region : 'dGVzdC1yZWdpb24=' ,
546551 } ) ,
547552 ] ) ,
548- ) ;
553+ } ) ;
549554
550555 modelVersionDetails . visit ( undefined , undefined , '1' ) ;
551556 modelVersionDetails . findDeployModelButton ( ) . click ( ) ;
@@ -566,10 +571,8 @@ describe('Deploy model version', () => {
566571 } ) ;
567572
568573 it ( 'Prefills when there is one URI matching connection' , ( ) => {
569- initIntercepts ( { } ) ;
570- cy . interceptK8sList (
571- SecretModel ,
572- mockK8sResourceList ( [
574+ initIntercepts ( {
575+ secrets : mockK8sResourceList ( [
573576 mockCustomSecretK8sResource ( {
574577 namespace : 'kserve-project' ,
575578 name : 'test-secret' ,
@@ -580,7 +583,7 @@ describe('Deploy model version', () => {
580583 data : { URI : 'aHR0cHM6Ly9kZW1vLW1vZGVscy9zb21lLXBhdGguemlw' } ,
581584 } ) ,
582585 ] ) ,
583- ) ;
586+ } ) ;
584587
585588 modelVersionDetails . visit ( undefined , undefined , '3' ) ;
586589 modelVersionDetails . findDeployModelButton ( ) . click ( ) ;
@@ -599,10 +602,8 @@ describe('Deploy model version', () => {
599602 } ) ;
600603
601604 it ( 'Prefills when there is one OCI matching connection' , ( ) => {
602- initIntercepts ( { } ) ;
603- cy . interceptK8sList (
604- SecretModel ,
605- mockK8sResourceList ( [
605+ initIntercepts ( {
606+ secrets : mockK8sResourceList ( [
606607 mockCustomSecretK8sResource ( {
607608 namespace : 'kserve-project' ,
608609 name : 'test-secret' ,
@@ -617,7 +618,7 @@ describe('Deploy model version', () => {
617618 } ,
618619 } ) ,
619620 ] ) ,
620- ) ;
621+ } ) ;
621622
622623 modelVersionDetails . visit ( undefined , undefined , '4' ) ;
623624 modelVersionDetails . findDeployModelButton ( ) . click ( ) ;
@@ -630,16 +631,14 @@ describe('Deploy model version', () => {
630631 // Step 1: Model source
631632 modelServingWizard . findModelSourceStep ( ) . should ( 'be.enabled' ) ;
632633
633- // Validate connection section - should use existing connection
634- cy . findByText ( 'test.io/test' ) . should ( 'exist' ) ;
635- modelServingWizard . findOCIModelURI ( ) . should ( 'have.value' , 'test.io/test/private:test ' ) ;
634+ // Validate connection section - should use existing connection (similar to URI test)
635+ modelServingWizard . findExistingConnectionSelect ( ) . should ( 'exist' ) ;
636+ modelServingWizard . findExistingConnectionValue ( ) . should ( 'have.value' , 'Test Secret ' ) ;
636637 } ) ;
637638
638639 it ( 'Selects existing connection when there are 2 matching connections' , ( ) => {
639- initIntercepts ( { } ) ;
640- cy . interceptK8sList (
641- SecretModel ,
642- mockK8sResourceList ( [
640+ initIntercepts ( {
641+ secrets : mockK8sResourceList ( [
643642 mockCustomSecretK8sResource ( {
644643 namespace : 'kserve-project' ,
645644 name : 'test-secret' ,
@@ -659,7 +658,7 @@ describe('Deploy model version', () => {
659658 data : { URI : 'aHR0cHM6Ly9kZW1vLW1vZGVscy9zb21lLXBhdGguemlw' } ,
660659 } ) ,
661660 ] ) ,
662- ) ;
661+ } ) ;
663662
664663 modelVersionDetails . visit ( undefined , undefined , '3' ) ;
665664 modelVersionDetails . findDeployModelButton ( ) . click ( ) ;
0 commit comments