@@ -39,13 +39,6 @@ import {
3939import { addOwner , waitForAllLoadersToDisappear } from './entity' ;
4040import { sidebarClick } from './sidebar' ;
4141
42- const waitForAssetModalInitialLoad = async ( page : Page ) => {
43- await page . waitForSelector ( '[data-testid="loader"]' , {
44- state : 'detached' ,
45- timeout : 10000 ,
46- } ) ;
47- } ;
48-
4942const waitForSearchDebounce = async ( page : Page ) => {
5043 // Wait for loader to appear and disappear after search
5144 // This ensures search debounce completed and results are stable
@@ -434,9 +427,9 @@ export const addAssetsToDomain = async (
434427 ) ;
435428
436429 await page . getByTestId ( 'domain-details-add-button' ) . click ( ) ;
430+ const assetRes = page . waitForResponse ( '/api/v1/search/query?q=&index=all&*' ) ;
437431 await page . getByRole ( 'menuitem' , { name : 'Assets' , exact : true } ) . click ( ) ;
438-
439- await waitForAssetModalInitialLoad ( page ) ;
432+ await assetRes ;
440433
441434 for ( const asset of assets ) {
442435 const name = get ( asset , 'entityResponseData.name' ) ;
@@ -496,9 +489,10 @@ export const addServicesToDomain = async (
496489 await goToAssetsTab ( page , domain ) ;
497490
498491 await page . getByTestId ( 'domain-details-add-button' ) . click ( ) ;
499- await page . getByRole ( 'menuitem' , { name : 'Assets' , exact : true } ) . click ( ) ;
500492
501- await waitForAssetModalInitialLoad ( page ) ;
493+ const assetRes = page . waitForResponse ( '/api/v1/search/query?q=&index=all&*' ) ;
494+ await page . getByRole ( 'menuitem' , { name : 'Assets' , exact : true } ) . click ( ) ;
495+ await assetRes ;
502496
503497 for ( const asset of assets ) {
504498 const name = get ( asset , 'name' ) ;
@@ -537,9 +531,9 @@ export const addAssetsToDataProduct = async (
537531 "Looks like you haven't added any data assets yet."
538532 ) ;
539533
534+ const assetRes = page . waitForResponse ( '/api/v1/search/query?q=&index=all&*' ) ;
540535 await page . getByTestId ( 'data-product-details-add-button' ) . click ( ) ;
541-
542- await waitForAssetModalInitialLoad ( page ) ;
536+ await assetRes ;
543537
544538 for ( const asset of assets ) {
545539 const name = get ( asset , 'entityResponseData.name' ) ;
0 commit comments