@@ -5,56 +5,60 @@ import { setupModelsTabIntercepts } from '~/__tests__/cypress/cypress/support/he
55
66const TEST_NAMESPACE = 'test-namespace' ;
77
8+ const AI_MODELS = [
9+ {
10+ model_name : 'Llama-3B-Internal' ,
11+ model_id : 'llama-3b-internal' ,
12+ display_name : 'Llama 3B Internal' ,
13+ description : 'Locally deployed Llama model' ,
14+ usecase : 'text-generation' ,
15+ status : 'Running' ,
16+ model_source_type : 'namespace' ,
17+ model_type : 'llm' ,
18+ endpoints : [ 'internal: http://llama-3b.test-namespace.svc.cluster.local:8080' ] ,
19+ } ,
20+ {
21+ model_name : 'GPT-4-External' ,
22+ model_id : 'gpt-4-external' ,
23+ display_name : 'GPT-4 External' ,
24+ description : 'External GPT-4 model' ,
25+ usecase : 'text-generation' ,
26+ status : 'Running' ,
27+ model_source_type : 'custom_endpoint' ,
28+ model_type : 'llm' ,
29+ endpoints : [ 'https://api.openai.com/v1/models/gpt-4' ] ,
30+ } ,
31+ {
32+ model_name : 'Embedding-Model' ,
33+ model_id : 'embedding-model' ,
34+ display_name : 'Embedding Model' ,
35+ description : 'Custom endpoint embedding model' ,
36+ usecase : 'embedding' ,
37+ status : 'Stop' ,
38+ model_source_type : 'custom_endpoint' ,
39+ model_type : 'embedding' ,
40+ endpoints : [ 'http://embedding.cluster.local:8080' ] ,
41+ } ,
42+ ] ;
43+
44+ const MAAS_MODELS = [
45+ {
46+ id : 'maas-llama-70b' ,
47+ display_name : 'Llama 70B MaaS' ,
48+ description : 'Llama 70B via Models as a Service' ,
49+ usecase : 'text-generation' ,
50+ ready : true ,
51+ url : 'https://maas.example.com/v1/models/llama-70b' ,
52+ model_type : 'llm' ,
53+ } ,
54+ ] ;
55+
856describe ( 'AI Assets - Models Tab' , ( ) => {
957 beforeEach ( ( ) => {
1058 setupModelsTabIntercepts ( {
1159 namespace : TEST_NAMESPACE ,
12- aiModels : [
13- {
14- model_name : 'Llama-3B-Internal' ,
15- model_id : 'llama-3b-internal' ,
16- display_name : 'Llama 3B Internal' ,
17- description : 'Locally deployed Llama model' ,
18- usecase : 'text-generation' ,
19- status : 'Running' ,
20- model_source_type : 'namespace' ,
21- model_type : 'llm' ,
22- endpoints : [ 'internal: http://llama-3b.test-namespace.svc.cluster.local:8080' ] ,
23- } ,
24- {
25- model_name : 'GPT-4-External' ,
26- model_id : 'gpt-4-external' ,
27- display_name : 'GPT-4 External' ,
28- description : 'External GPT-4 model' ,
29- usecase : 'text-generation' ,
30- status : 'Running' ,
31- model_source_type : 'custom_endpoint' ,
32- model_type : 'llm' ,
33- endpoints : [ 'https://api.openai.com/v1/models/gpt-4' ] ,
34- } ,
35- {
36- model_name : 'Embedding-Model' ,
37- model_id : 'embedding-model' ,
38- display_name : 'Embedding Model' ,
39- description : 'Custom endpoint embedding model' ,
40- usecase : 'embedding' ,
41- status : 'Stop' ,
42- model_source_type : 'custom_endpoint' ,
43- model_type : 'embedding' ,
44- endpoints : [ 'http://embedding.cluster.local:8080' ] ,
45- } ,
46- ] ,
47- maasModels : [
48- {
49- id : 'maas-llama-70b' ,
50- display_name : 'Llama 70B MaaS' ,
51- description : 'Llama 70B via Models as a Service' ,
52- usecase : 'text-generation' ,
53- ready : true ,
54- url : 'https://maas.example.com/v1/models/llama-70b' ,
55- model_type : 'llm' ,
56- } ,
57- ] ,
60+ aiModels : AI_MODELS ,
61+ maasModels : MAAS_MODELS ,
5862 } ) ;
5963
6064 aiAssetsPage . visit ( TEST_NAMESPACE ) ;
@@ -95,3 +99,84 @@ describe('AI Assets - Models Tab', () => {
9599 } ,
96100 ) ;
97101} ) ;
102+
103+ describe ( 'AI Assets - Models Tab (MaaS disabled)' , ( ) => {
104+ beforeEach ( ( ) => {
105+ setupModelsTabIntercepts ( {
106+ namespace : TEST_NAMESPACE ,
107+ aiModels : AI_MODELS ,
108+ maasModels : MAAS_MODELS ,
109+ } ) ;
110+ } ) ;
111+
112+ it (
113+ 'should only show AI models when modelAsService flag is disabled' ,
114+ { tags : [ '@GenAI' , '@ModelsTab' , '@AIAssets' , '@FeatureFlag' ] } ,
115+ ( ) => {
116+ cy . step ( 'Visit with modelAsService feature flag disabled' ) ;
117+ aiAssetsPage . visit ( TEST_NAMESPACE , { modelAsService : 'false' } ) ;
118+
119+ cy . step ( 'Verify the table shows only AI models (no MaaS)' ) ;
120+ modelsTabPage . findTable ( ) . should ( 'be.visible' ) ;
121+ modelsTabPage . findTableRows ( ) . should ( 'have.length' , 3 ) ;
122+
123+ cy . step ( 'Verify MaaS model is not present' ) ;
124+ modelsTabPage . findTable ( ) . should ( 'not.contain.text' , 'Llama 70B MaaS' ) ;
125+
126+ cy . step ( 'Verify AI models are still present' ) ;
127+ modelsTabPage . findTable ( ) . should ( 'contain.text' , 'Llama 3B Internal' ) ;
128+ modelsTabPage . findTable ( ) . should ( 'contain.text' , 'GPT-4 External' ) ;
129+ modelsTabPage . findTable ( ) . should ( 'contain.text' , 'Embedding Model' ) ;
130+
131+ cy . step ( 'Verify no warning alert is shown' ) ;
132+ modelsTabPage . findWarningAlert ( ) . should ( 'not.exist' ) ;
133+ } ,
134+ ) ;
135+ } ) ;
136+
137+ describe ( 'AI Assets - Models Tab (MaaS error)' , ( ) => {
138+ beforeEach ( ( ) => {
139+ setupModelsTabIntercepts ( {
140+ namespace : TEST_NAMESPACE ,
141+ aiModels : AI_MODELS ,
142+ maasError : true ,
143+ } ) ;
144+
145+ aiAssetsPage . visit ( TEST_NAMESPACE ) ;
146+ } ) ;
147+
148+ it (
149+ 'should show warning alert when MaaS models fail to load' ,
150+ { tags : [ '@GenAI' , '@ModelsTab' , '@AIAssets' ] } ,
151+ ( ) => {
152+ cy . step ( 'Verify warning alert is displayed' ) ;
153+ modelsTabPage . findWarningAlert ( ) . should ( 'be.visible' ) ;
154+ modelsTabPage
155+ . findWarningAlert ( )
156+ . should ( 'contain.text' , 'Models as a Service could not be loaded' ) ;
157+
158+ cy . step ( 'Verify AI models still display' ) ;
159+ modelsTabPage . findTable ( ) . should ( 'be.visible' ) ;
160+ modelsTabPage . findTableRows ( ) . should ( 'have.length' , 3 ) ;
161+ } ,
162+ ) ;
163+
164+ it (
165+ 'should allow dismissing the warning alert' ,
166+ { tags : [ '@GenAI' , '@ModelsTab' , '@AIAssets' ] } ,
167+ ( ) => {
168+ cy . step ( 'Verify warning alert is displayed' ) ;
169+ modelsTabPage . findWarningAlert ( ) . should ( 'be.visible' ) ;
170+
171+ cy . step ( 'Click the close button on the alert' ) ;
172+ modelsTabPage . findWarningAlert ( ) . find ( 'button[aria-label*="Close"]' ) . click ( ) ;
173+
174+ cy . step ( 'Verify the alert is dismissed' ) ;
175+ modelsTabPage . findWarningAlert ( ) . should ( 'not.exist' ) ;
176+
177+ cy . step ( 'Verify models table is still visible' ) ;
178+ modelsTabPage . findTable ( ) . should ( 'be.visible' ) ;
179+ modelsTabPage . findTableRows ( ) . should ( 'have.length' , 3 ) ;
180+ } ,
181+ ) ;
182+ } ) ;
0 commit comments