@@ -317,9 +317,11 @@ export async function navigateToNotebookWithFallback(page: Page, noteId: string,
317317 await page . waitForLoadState ( 'networkidle' , { timeout : 15000 } ) ;
318318 await page . waitForSelector ( 'zeppelin-node-list' , { timeout : 15000 } ) ;
319319
320- const notebookLink = page . locator ( `a[href*="/notebook/"]` ) . filter ( { hasText : notebookName } ) ;
321- await notebookLink . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
322- await notebookLink . click ( ) ;
320+ // The link text in the UI is the base name of the note, not the full path.
321+ const baseName = notebookName . split ( '/' ) . pop ( ) ;
322+ const notebookLink = page . locator ( `a[href*="/notebook/"]` ) . filter ( { hasText : baseName ! } ) ;
323+ // Use the click action's built-in wait.
324+ await notebookLink . click ( { timeout : 10000 } ) ;
323325
324326 await page . waitForURL ( / \/ n o t e b o o k \/ [ ^ \/ \? ] + / , { timeout : 20000 } ) ;
325327 navigationSuccessful = true ;
@@ -383,9 +385,10 @@ export async function createTestNotebook(
383385 await page . waitForLoadState ( 'networkidle' , { timeout : 15000 } ) ;
384386 await page . waitForSelector ( 'zeppelin-node-list' , { timeout : 15000 } ) ;
385387
386- const notebookLink = page . locator ( `a[href*="/notebook/"]` ) . filter ( { hasText : notebookName } ) ;
387- await notebookLink . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
388- await notebookLink . click ( ) ;
388+ // Use baseNotebookName for the filter, as the link text in the UI won't contain the full path.
389+ const notebookLink = page . locator ( `a[href*="/notebook/"]` ) . filter ( { hasText : baseNotebookName } ) ;
390+ // Use the click action's built-in wait.
391+ await notebookLink . click ( { timeout : 10000 } ) ;
389392 await page . waitForURL ( / \/ n o t e b o o k \/ [ ^ \/ \? ] + / , { timeout : 20000 } ) ;
390393
391394 // Extract noteId after successful navigation through home page
0 commit comments