@@ -433,12 +433,13 @@ Then('the right pane should not be in the DOM', async ({ page }) => {
433433// Cooldown Steps
434434// ============================================
435435
436- When ( 'I wait for the pane to close' , async ( { page } ) => {
437- await page . waitForTimeout ( 400 )
438- // Verify pane is closed
436+ When ( 'I wait for the right pane to close' , async ( { page } ) => {
437+ // Wait for close timeout (100ms) + animation (200ms) + small buffer
438+ // This ensures the pane state has changed to 'closed' and the cooldown timestamp is set
439+ await page . waitForTimeout ( 350 )
440+ // Verify pane is actually closed (detached from DOM for hidden style)
439441 const rightPane = page . locator ( SELECTORS . rightPane )
440- const count = await rightPane . count ( )
441- expect ( count ) . toBe ( 0 )
442+ await rightPane . waitFor ( { state : 'detached' , timeout : 1000 } )
442443} )
443444
444445When ( 'I immediately hover over the right edge sensor area again' , async ( { page } ) => {
@@ -447,8 +448,12 @@ When('I immediately hover over the right edge sensor area again', async ({ page
447448 if ( box ) {
448449 // Hover in the trigger zone immediately (no wait)
449450 await page . mouse . move ( box . x + box . width - 10 , box . y + box . height / 2 )
450- // Short wait to allow potential trigger, but not full cooldown
451- await page . waitForTimeout ( 100 )
451+ // Wait a very short time - just enough for the hover event to trigger
452+ // We check immediately after to verify the pane hasn't opened due to cooldown
453+ // The cooldown is 500ms from when state changed to 'closed', but ~250ms
454+ // have already elapsed by the time we get here (waiting for DOM removal).
455+ // So we have ~250ms of remaining cooldown, and we wait only 50ms.
456+ await page . waitForTimeout ( 50 )
452457 }
453458} )
454459
0 commit comments