@@ -58,25 +58,21 @@ class ModelRegistry {
5858 this . waitLanding ( ) ;
5959 }
6060
61- visit ( ) {
62- this . visitWithRegistry ( 'modelregistry-sample' ) ;
63- }
64-
65- visitWithRegistry ( registryName : string ) {
66- cy . visitWithLogin ( `/ai-hub/models/registry/${ registryName } ` ) ;
67- this . wait ( ) ;
61+ visit ( registryName = 'modelregistry-sample' ) {
62+ cy . visitWithLogin ( `/ai-hub/registry/${ registryName } ` ) ;
63+ cy . findByTestId ( 'app-page-title' , { timeout : 60000 } ) . should ( 'exist' ) ;
6864 }
6965
7066 navigate ( ) {
71- appChrome . findNavItem ( { name : 'Models' , rootSection : 'AI hub' } ) . click ( ) ;
67+ appChrome
68+ . findNavItem ( { name : 'Registry' , rootSection : 'AI hub' , subSection : 'Models' } )
69+ . click ( ) ;
7270 this . wait ( ) ;
7371 }
7472
7573 private wait ( ) {
76- cy . findByTestId ( 'app-tab-page-title' ) . should ( 'exist' ) ;
77- cy . findByText ( 'Select a model registry to view and manage your registered models.' , {
78- exact : false ,
79- } ) . should ( 'exist' ) ;
74+ cy . findByTestId ( 'app-page-title' ) . should ( 'exist' ) ;
75+ cy . findByTestId ( 'app-page-title' ) . contains ( 'Registry' ) ;
8076 cy . testA11y ( ) ;
8177 }
8278
@@ -134,12 +130,16 @@ class ModelRegistry {
134130 }
135131
136132 tabEnabled ( ) {
137- appChrome . findNavItem ( { name : 'Models' , rootSection : 'AI hub' } ) . should ( 'exist' ) ;
133+ appChrome
134+ . findNavItem ( { name : 'Registry' , rootSection : 'AI hub' , subSection : 'Models' } )
135+ . should ( 'exist' ) ;
138136 return this ;
139137 }
140138
141139 tabDisabled ( ) {
142- appChrome . findNavItem ( { name : 'Models' , rootSection : 'AI hub' } ) . should ( 'not.exist' ) ;
140+ appChrome
141+ . findNavItem ( { name : 'Registry' , rootSection : 'AI hub' , subSection : 'Models' } )
142+ . should ( 'not.exist' ) ;
143143 return this ;
144144 }
145145
@@ -161,20 +161,16 @@ class ModelRegistry {
161161
162162 getRow ( name : string ) {
163163 return new ModelRegistryTableRow ( ( ) =>
164- this . findTable ( ) . find ( `[data-label="Model name"]` ) . contains ( name ) . closest ( 'tr' ) ,
164+ this . findTable ( ) . find ( `[data-label="Model name"]` ) . contains ( name ) . parents ( 'tr' ) ,
165165 ) ;
166166 }
167167
168- findModelByName ( name : string ) {
169- return this . getRow ( name ) . findName ( ) ;
170- }
171-
172168 getModelVersionRow ( name : string ) {
173169 return new ModelRegistryTableRow ( ( ) =>
174170 this . findModelVersionsTable ( )
175171 . find ( `[data-label="Version name"]` )
176172 . contains ( name )
177- . closest ( 'tr' ) ,
173+ . parents ( 'tr' ) ,
178174 ) ;
179175 }
180176
@@ -183,34 +179,21 @@ class ModelRegistry {
183179 }
184180
185181 findModelRegistry ( ) {
186- return cy . findAllByTestId ( 'model-registry-selector-dropdown' ) . filter ( ':visible' ) . first ( ) ;
182+ return cy . findByTestId ( 'model-registry-selector-dropdown' ) ;
187183 }
188184
189185 findSelectModelRegistry ( registryName : string ) {
190- cy . url ( { timeout : 30000 } ) . then ( ( url ) => {
191- if ( url . includes ( `/registry/${ registryName } ` ) ) {
192- return ;
186+ // Check if the registry is already selected
187+ this . findModelRegistry ( ) . then ( ( $dropdown ) => {
188+ if ( ! $dropdown . text ( ) . includes ( registryName ) ) {
189+ // Registry is not selected, perform click actions
190+ this . findModelRegistry ( ) . click ( ) ;
191+ cy . findByTestId ( registryName ) . click ( ) ;
193192 }
194- cy . findAllByTestId ( 'model-registry-selector-dropdown' ) . filter ( ':visible' ) . first ( ) . click ( ) ;
195- cy . findAllByTestId ( registryName ) . filter ( ':visible' ) . first ( ) . click ( ) ;
196193 } ) ;
197- cy . url ( { timeout : 30000 } ) . should ( 'include' , `/registry/${ registryName } ` ) ;
198194 return this ;
199195 }
200196
201- /** Link button in the Model name column (navigates to registered model / overview). */
202- findModelNameLinkButton ( name : string ) {
203- return this . getRow ( name ) . find ( ) . find ( '[data-testid="model-name"] button' ) . first ( ) ;
204- }
205-
206- findVersionDetailsBreadcrumbModel ( ) {
207- return cy . findByTestId ( 'breadcrumb-model-version' ) ;
208- }
209-
210- findVersionDetailsBreadcrumbVersion ( ) {
211- return cy . findByTestId ( 'breadcrumb-version-name' ) ;
212- }
213-
214197 findModelVersionsTableHeaderButton ( name : string ) {
215198 return this . findModelVersionsTable ( ) . find ( 'thead' ) . findByRole ( 'button' , { name } ) ;
216199 }
0 commit comments