@@ -34,7 +34,6 @@ const setupMocks = (sources: CatalogSource[] = [], sourceConfigs: CatalogSourceC
3434 items : sources ,
3535 } ) ,
3636 ) ;
37- // Intercept the catalog source configs endpoint
3837 cy . intercept (
3938 'GET' ,
4039 `/model-registry/api/${ MODEL_CATALOG_API_VERSION } /settings/model_catalog/source_configs*` ,
@@ -46,7 +45,7 @@ const setupMocks = (sources: CatalogSource[] = [], sourceConfigs: CatalogSourceC
4645 } ) ,
4746 } ,
4847 } ,
49- ) ;
48+ ) . as ( 'getCatalogSourceConfigs' ) ;
5049} ;
5150
5251function selectNamespaceIfPresent ( ) {
@@ -59,8 +58,14 @@ function selectNamespaceIfPresent() {
5958}
6059
6160describe ( 'Model Catalog Settings' , ( ) => {
61+ const defaultYamlSource = mockYamlCatalogSourceConfig ( {
62+ id : 'default-yaml' ,
63+ name : 'Default Catalog' ,
64+ isDefault : true ,
65+ } ) ;
66+
6267 beforeEach ( ( ) => {
63- setupMocks ( ) ;
68+ setupMocks ( [ ] , [ defaultYamlSource ] ) ;
6469 } ) ;
6570
6671 it ( 'should display the settings page' , ( ) => {
@@ -143,19 +148,20 @@ describe('Catalog Source Configs Table', () => {
143148
144149 it ( 'should render table column headers correctly' , ( ) => {
145150 modelCatalogSettings . visit ( ) ;
146- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Name' ) ;
147- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Organization' ) ;
148- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Model visibility' ) ;
149- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Source type' ) ;
150- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Enable' ) ;
151- modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Validation status' ) ;
151+ modelCatalogSettings . findTable ( ) . should ( 'be.visible' ) ;
152+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Name' ) . should ( 'be.visible' ) ;
153+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Organization' ) . should ( 'be.visible' ) ;
154+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Model visibility' ) . should ( 'be.visible' ) ;
155+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Source type' ) . should ( 'be.visible' ) ;
156+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Enable' ) . should ( 'be.visible' ) ;
157+ modelCatalogSettings . findTable ( ) . contains ( 'th' , 'Validation status' ) . should ( 'be.visible' ) ;
152158 } ) ;
153159
154160 describe ( 'Table row rendering' , ( ) => {
155161 it ( 'should render default YAML source correctly' , ( ) => {
156162 modelCatalogSettings . visit ( ) ;
157163 const row = modelCatalogSettings . getRow ( 'Default Catalog' ) ;
158- row . findName ( ) . should ( 'contain' , 'Default Catalog' ) ;
164+ row . findName ( ) . should ( 'be.visible' ) . and ( ' contain', 'Default Catalog' ) ;
159165 row . shouldHaveOrganization ( '-' ) ;
160166 row . shouldHaveModelVisibility ( 'Unfiltered' ) ;
161167 row . shouldHaveSourceType ( 'YAML file' ) ;
@@ -165,7 +171,7 @@ describe('Catalog Source Configs Table', () => {
165171 it ( 'should render Hugging Face source correctly' , ( ) => {
166172 modelCatalogSettings . visit ( ) ;
167173 const row = modelCatalogSettings . getRow ( 'HuggingFace Google' ) ;
168- row . findName ( ) . should ( 'contain' , 'HuggingFace Google' ) ;
174+ row . findName ( ) . should ( 'be.visible' ) . and ( ' contain', 'HuggingFace Google' ) ;
169175 row . shouldHaveOrganization ( 'Google' ) ;
170176 row . shouldHaveModelVisibility ( 'Filtered' ) ;
171177 row . shouldHaveSourceType ( 'Hugging Face' ) ;
@@ -176,7 +182,7 @@ describe('Catalog Source Configs Table', () => {
176182 it ( 'should render custom YAML source correctly' , ( ) => {
177183 modelCatalogSettings . visit ( ) ;
178184 const row = modelCatalogSettings . getRow ( 'Custom YAML' ) ;
179- row . findName ( ) . should ( 'contain' , 'Custom YAML' ) ;
185+ row . findName ( ) . should ( 'be.visible' ) . and ( ' contain', 'Custom YAML' ) ;
180186 row . shouldHaveOrganization ( '-' ) ;
181187 row . shouldHaveModelVisibility ( 'Filtered' ) ;
182188 row . shouldHaveSourceType ( 'YAML file' ) ;
@@ -189,15 +195,17 @@ describe('Catalog Source Configs Table', () => {
189195 it ( 'should show notification when enable toggle is clicked' , ( ) => {
190196 modelCatalogSettings . visit ( ) ;
191197 const row = modelCatalogSettings . getRow ( 'HuggingFace Google' ) ;
198+ row . findName ( ) . should ( 'be.visible' ) ;
199+ row . findEnableToggle ( ) . should ( 'exist' ) . and ( 'be.checked' ) ;
192200 row . toggleEnable ( ) ;
193- // Check for notification toast
194- cy . get ( '.pf-v5-c-alert-group' ) . should ( 'exist' ) ;
195- cy . get ( '.pf-v5-c-alert' ) . should ( 'contain' , 'Toggle disabled' ) ;
201+ cy . get ( '.pf-v6-c-alert-group' , { timeout : 5000 } ) . should ( 'be.visible' ) ;
202+ cy . get ( '.pf-v6-c-alert' ) . should ( 'be.visible' ) . and ( 'contain' , 'Toggle disabled' ) ;
196203 } ) ;
197204
198205 it ( 'should not show toggle for default sources' , ( ) => {
199206 modelCatalogSettings . visit ( ) ;
200207 const row = modelCatalogSettings . getRow ( 'Default Catalog' ) ;
208+ row . findName ( ) . should ( 'be.visible' ) ;
201209 row . shouldHaveEnableToggle ( false ) ;
202210 } ) ;
203211 } ) ;
@@ -206,15 +214,17 @@ describe('Catalog Source Configs Table', () => {
206214 it ( 'should navigate to manage source page when button is clicked' , ( ) => {
207215 modelCatalogSettings . visit ( ) ;
208216 const row = modelCatalogSettings . getRow ( 'HuggingFace Google' ) ;
209- row . findManageSourceButton ( ) . click ( ) ;
217+ row . findName ( ) . should ( 'be.visible' ) ;
218+ row . findManageSourceButton ( ) . should ( 'be.visible' ) . click ( ) ;
210219 cy . url ( ) . should ( 'include' , '/model-catalog-settings/manage-source/hf-google' ) ;
211220 manageSourcePage . findManageSourceTitle ( ) ;
212221 } ) ;
213222
214223 it ( 'should navigate to correct manage source page for each row' , ( ) => {
215224 modelCatalogSettings . visit ( ) ;
216225 const customRow = modelCatalogSettings . getRow ( 'Custom YAML' ) ;
217- customRow . findManageSourceButton ( ) . click ( ) ;
226+ customRow . findName ( ) . should ( 'be.visible' ) ;
227+ customRow . findManageSourceButton ( ) . should ( 'be.visible' ) . click ( ) ;
218228 cy . url ( ) . should ( 'include' , '/model-catalog-settings/manage-source/custom-yaml' ) ;
219229 } ) ;
220230 } ) ;
@@ -223,38 +233,50 @@ describe('Catalog Source Configs Table', () => {
223233 it ( 'should show delete action for non-default sources' , ( ) => {
224234 modelCatalogSettings . visit ( ) ;
225235 const row = modelCatalogSettings . getRow ( 'HuggingFace Google' ) ;
226- row . findKebab ( ) . click ( ) ;
227- cy . findByRole ( 'menuitem' , { name : 'Delete source' } ) . should ( 'exist' ) ;
228- cy . findByRole ( 'menuitem' , { name : 'Delete source' } ) . should ( 'not.be.disabled' ) ;
236+ row . findName ( ) . should ( 'be.visible' ) ;
237+ row . findKebab ( ) . should ( 'be.visible' ) . click ( ) ;
238+ cy . findByRole ( 'menuitem' , { name : 'Delete source' } )
239+ . should ( 'be.visible' )
240+ . and ( 'not.be.disabled' ) ;
229241 } ) ;
230242
231243 it ( 'should disable delete action for default sources' , ( ) => {
232244 modelCatalogSettings . visit ( ) ;
233245 const row = modelCatalogSettings . getRow ( 'Default Catalog' ) ;
234- row . findKebab ( ) . click ( ) ;
235- cy . findByRole ( 'menuitem' , { name : 'Delete source' } ) . should ( 'be.disabled' ) ;
246+ row . findName ( ) . should ( 'be.visible' ) ;
247+ row . findKebab ( ) . should ( 'be.visible' ) . click ( ) ;
248+ cy . findByRole ( 'menuitem' , { name : 'Delete source' } ) . should ( 'be.visible' ) . and ( 'be.disabled' ) ;
236249 } ) ;
237250 } ) ;
238251
239252 describe ( 'Model visibility badges' , ( ) => {
240253 it ( 'should show "Filtered" badge when source has included models' , ( ) => {
241254 modelCatalogSettings . visit ( ) ;
242255 const row = modelCatalogSettings . getRow ( 'HuggingFace Google' ) ;
243- row . findModelVisibility ( ) . should ( 'contain' , 'Filtered' ) ;
244- row . findModelVisibility ( ) . find ( '.pf-v5-c-label' ) . should ( 'have.class' , 'pf-m-blue' ) ;
256+ row . findName ( ) . should ( 'be.visible' ) ;
257+ row . findModelVisibility ( ) . should ( 'be.visible' ) . and ( 'contain' , 'Filtered' ) ;
258+ row
259+ . findModelVisibility ( )
260+ . find ( '[data-testid*="model-visibility-filtered"]' )
261+ . should ( 'be.visible' ) ;
245262 } ) ;
246263
247264 it ( 'should show "Filtered" badge when source has excluded models' , ( ) => {
248265 modelCatalogSettings . visit ( ) ;
249266 const row = modelCatalogSettings . getRow ( 'Custom YAML' ) ;
250- row . findModelVisibility ( ) . should ( 'contain' , 'Filtered' ) ;
267+ row . findName ( ) . should ( 'be.visible' ) ;
268+ row . findModelVisibility ( ) . should ( 'be.visible' ) . and ( 'contain' , 'Filtered' ) ;
251269 } ) ;
252270
253271 it ( 'should show "Unfiltered" badge when source has no filters' , ( ) => {
254272 modelCatalogSettings . visit ( ) ;
255273 const row = modelCatalogSettings . getRow ( 'Default Catalog' ) ;
256- row . findModelVisibility ( ) . should ( 'contain' , 'Unfiltered' ) ;
257- row . findModelVisibility ( ) . find ( '.pf-v5-c-label' ) . should ( 'have.class' , 'pf-m-grey' ) ;
274+ row . findName ( ) . should ( 'be.visible' ) ;
275+ row . findModelVisibility ( ) . should ( 'be.visible' ) . and ( 'contain' , 'Unfiltered' ) ;
276+ row
277+ . findModelVisibility ( )
278+ . find ( '[data-testid*="model-visibility-unfiltered"]' )
279+ . should ( 'be.visible' ) ;
258280 } ) ;
259281 } ) ;
260282} ) ;
0 commit comments