@@ -194,21 +194,19 @@ export class AdminModelCardPage {
194194 // After clicking "+", either:
195195 // (a) a Popconfirm appears asking to "Change Project" first, or
196196 // (b) the FolderCreateModal opens directly (project is already model-store).
197- // Check for the Popconfirm button first (short timeout); if it doesn't appear,
198- // fall through to wait for the folder dialog directly. Using Promise.race was
199- // unreliable because the race could resolve on the folder dialog while the
200- // Popconfirm button was also appearing, causing the button click to be missed.
197+ // Wait for whichever appears first so the direct-open path doesn't always pay
198+ // the full Popconfirm timeout. If the Popconfirm branch appears, click it and
199+ // then continue waiting for the folder dialog.
201200 const folderDialog = this . getFolderCreateDialog ( ) ;
202201 const changeProjectButton = this . page . getByRole ( 'button' , {
203202 name : 'Change Project' ,
204203 } ) ;
205204
206- const changeProjectVisible = await changeProjectButton
207- . waitFor ( { state : 'visible' , timeout : 5000 } )
208- . then ( ( ) => true )
209- . catch ( ( ) => false ) ;
205+ await expect ( changeProjectButton . or ( folderDialog ) ) . toBeVisible ( {
206+ timeout : 5000 ,
207+ } ) ;
210208
211- if ( changeProjectVisible ) {
209+ if ( await changeProjectButton . isVisible ( ) ) {
212210 await changeProjectButton . click ( ) ;
213211 }
214212
@@ -229,6 +227,18 @@ export class AdminModelCardPage {
229227 . getByRole ( 'button' , { name : 'Create' , exact : true } )
230228 . click ( ) ;
231229 await expect ( folderDialog ) . toBeHidden ( { timeout : 15000 } ) ;
230+
231+ // onRequestClose asynchronously sets `vfolderId` in the Create Model Card form and
232+ // triggers a BAIVFolderSelect refetch. Assert the VFolder select reflects the
233+ // newly created folder name before proceeding so downstream submit steps don't
234+ // race the refetch.
235+ await expect (
236+ modal
237+ . locator ( '.ant-form-item' )
238+ . filter ( { hasText : 'Model Storage Folder' } )
239+ . locator ( '.ant-select-selection-item' )
240+ . filter ( { hasText : folderName } ) ,
241+ ) . toBeVisible ( { timeout : 15000 } ) ;
232242 }
233243
234244 async fillCreateModal ( fields : {
0 commit comments