@@ -181,10 +181,11 @@ test.describe('Organization Management', () => {
181181 await orgManagement . locator ( '#new-member-role' ) . selectOption ( 'admin' )
182182
183183 // Submit
184- await orgManagement . getByRole ( 'button' , { name : / ^ a d d $ / i } ) . click ( )
185- await page . waitForTimeout ( 500 )
184+ await Promise . all ( [
185+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations' ) && resp . ok ( ) ) ,
186+ orgManagement . getByRole ( 'button' , { name : / ^ a d d $ / i } ) . click ( ) ,
187+ ] )
186188
187- // Verify operation
188189 const operations = await mockConnector . getOperations ( )
189190 expect ( operations ) . toHaveLength ( 1 )
190191 expect ( operations [ 0 ] ?. type ) . toBe ( 'org:add-user' )
@@ -198,8 +199,10 @@ test.describe('Organization Management', () => {
198199 const orgManagement = page . getByRole ( 'region' , { name : / o r g a n i z a t i o n m a n a g e m e n t / i } )
199200 await expect ( orgManagement ) . toBeVisible ( { timeout : 10_000 } )
200201
201- await orgManagement . getByRole ( 'button' , { name : / r e m o v e m e m b e r 2 / i } ) . click ( )
202- await page . waitForTimeout ( 500 )
202+ await Promise . all ( [
203+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations' ) && resp . ok ( ) ) ,
204+ orgManagement . getByRole ( 'button' , { name : / r e m o v e m e m b e r 2 / i } ) . click ( ) ,
205+ ] )
203206
204207 const operations = await mockConnector . getOperations ( )
205208 expect ( operations ) . toHaveLength ( 1 )
@@ -219,8 +222,10 @@ test.describe('Organization Management', () => {
219222
220223 const roleSelect = orgManagement . locator ( '#role-member2' )
221224 await expect ( roleSelect ) . toBeVisible ( { timeout : 5000 } )
222- await roleSelect . selectOption ( 'admin' )
223- await page . waitForTimeout ( 500 )
225+ await Promise . all ( [
226+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations' ) && resp . ok ( ) ) ,
227+ roleSelect . selectOption ( 'admin' ) ,
228+ ] )
224229
225230 const operations = await mockConnector . getOperations ( )
226231 expect ( operations ) . toHaveLength ( 1 )
@@ -299,8 +304,10 @@ test.describe('Package Access Controls', () => {
299304
300305 await section . locator ( '#grant-permission-select' ) . selectOption ( 'read-write' )
301306
302- await section . getByRole ( 'button' , { name : / ^ g r a n t $ / i } ) . click ( )
303- await page . waitForTimeout ( 500 )
307+ await Promise . all ( [
308+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations' ) && resp . ok ( ) ) ,
309+ section . getByRole ( 'button' , { name : / ^ g r a n t $ / i } ) . click ( ) ,
310+ ] )
304311
305312 const operations = await mockConnector . getOperations ( )
306313 expect ( operations ) . toHaveLength ( 1 )
@@ -323,8 +330,10 @@ test.describe('Package Access Controls', () => {
323330 const teamList = page . getByRole ( 'list' , { name : / t e a m a c c e s s l i s t / i } )
324331 await expect ( teamList ) . toBeVisible ( { timeout : 10_000 } )
325332
326- await section . getByRole ( 'button' , { name : / r e v o k e d o c s a c c e s s / i } ) . click ( )
327- await page . waitForTimeout ( 500 )
333+ await Promise . all ( [
334+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations' ) && resp . ok ( ) ) ,
335+ section . getByRole ( 'button' , { name : / r e v o k e d o c s a c c e s s / i } ) . click ( ) ,
336+ ] )
328337
329338 const operations = await mockConnector . getOperations ( )
330339 expect ( operations ) . toHaveLength ( 1 )
@@ -392,17 +401,21 @@ test.describe('Operations Queue', () => {
392401 // Approve all
393402 const approveAllBtn = modal . getByRole ( 'button' , { name : / a p p r o v e a l l / i } )
394403 await expect ( approveAllBtn ) . toBeVisible ( { timeout : 5000 } )
395- await approveAllBtn . click ( )
396- await page . waitForTimeout ( 300 )
404+ await Promise . all ( [
405+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/approve-all' ) && resp . ok ( ) ) ,
406+ approveAllBtn . click ( ) ,
407+ ] )
397408
398409 let operations = await mockConnector . getOperations ( )
399410 expect ( operations [ 0 ] ?. status ) . toBe ( 'approved' )
400411
401412 // Execute
402413 const executeBtn = modal . getByRole ( 'button' , { name : / e x e c u t e / i } )
403414 await expect ( executeBtn ) . toBeVisible ( { timeout : 5000 } )
404- await executeBtn . click ( )
405- await page . waitForTimeout ( 500 )
415+ await Promise . all ( [
416+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/execute' ) && resp . ok ( ) ) ,
417+ executeBtn . click ( ) ,
418+ ] )
406419
407420 operations = await mockConnector . getOperations ( )
408421 expect ( operations [ 0 ] ?. status ) . toBe ( 'completed' )
@@ -422,7 +435,10 @@ test.describe('Operations Queue', () => {
422435 await openConnectorModal ( page )
423436
424437 const modal = page . getByRole ( 'dialog' )
425- await modal . getByRole ( 'button' , { name : / c l e a r / i } ) . click ( )
438+ await Promise . all ( [
439+ page . waitForResponse ( resp => resp . url ( ) . includes ( '/operations/all' ) && resp . ok ( ) ) ,
440+ modal . getByRole ( 'button' , { name : / c l e a r / i } ) . click ( ) ,
441+ ] )
426442
427443 const operations = await mockConnector . getOperations ( )
428444 expect ( operations ) . toHaveLength ( 0 )
0 commit comments