@@ -139,6 +139,21 @@ async function waitForStartScreen(
139139 await findByText ( driver , 'Launch new session' , timeout )
140140}
141141
142+ // Wait for all backdrops to disappear
143+ async function waitForBackdropsToDisappear (
144+ driver : WebDriver ,
145+ timeout = 5000 ,
146+ ) : Promise < void > {
147+ const startTime = Date . now ( )
148+ while ( Date . now ( ) - startTime < timeout ) {
149+ const backdrops = await driver . findElements ( By . css ( '.MuiBackdrop-root' ) )
150+ if ( backdrops . length === 0 ) {
151+ return
152+ }
153+ await delay ( 200 )
154+ }
155+ }
156+
142157// Unified helper to clean up all UI overlays (dialogs, menus, backdrops)
143158async function cleanupUI ( driver : WebDriver ) : Promise < void > {
144159 // Close dialogs
@@ -553,6 +568,10 @@ async function testAddGff3TrackAndSearch(driver: WebDriver): Promise<void> {
553568
554569 // Add track via File > Open track menu
555570 await openMenuItem ( driver , 'File' , 'Open track' )
571+
572+ // Wait for menu backdrop to disappear before interacting with dialog
573+ console . log ( ' DEBUG: Waiting for menu backdrop to disappear...' )
574+ await waitForBackdropsToDisappear ( driver )
556575 await delay ( 500 )
557576
558577 // The "Add a track" dialog should appear
@@ -566,10 +585,10 @@ async function testAddGff3TrackAndSearch(driver: WebDriver): Promise<void> {
566585 )
567586 console . log ( ` DEBUG: Found ${ urlToggleButtons . length } URL toggle buttons` )
568587
569- // Click first URL toggle (for GFF file)
588+ // Click first URL toggle (for GFF file) - use JavaScript click to bypass any backdrop issues
570589 if ( urlToggleButtons . length >= 1 ) {
571590 console . log ( ' DEBUG: Clicking first URL toggle...' )
572- await urlToggleButtons [ 0 ] . click ( )
591+ await driver . executeScript ( 'arguments [0].click();' , urlToggleButtons [ 0 ] )
573592 await delay ( 500 )
574593 }
575594
@@ -583,10 +602,10 @@ async function testAddGff3TrackAndSearch(driver: WebDriver): Promise<void> {
583602 await urlInputs [ 0 ] . sendKeys ( gffPath )
584603 }
585604
586- // Click second URL toggle for index file if available
605+ // Click second URL toggle for index file if available - use JavaScript click
587606 if ( urlToggleButtons . length >= 2 ) {
588607 console . log ( ' DEBUG: Clicking second URL toggle...' )
589- await urlToggleButtons [ 1 ] . click ( )
608+ await driver . executeScript ( 'arguments[0 ].click();' , urlToggleButtons [ 1 ] )
590609 await delay ( 500 )
591610 }
592611
0 commit comments