@@ -230,13 +230,15 @@ export function moveFile(fileName: string, dirPath: string) {
230230 . findByRole ( 'button' , { name : 'All files' } )
231231 . should ( 'be.visible' )
232232 . click ( )
233+ // [picker-diag] log the exact button texts to see the root label
234+ cy . get ( 'button' ) . then ( ( $b ) => cy . task ( 'log' , '[picker-diag] move buttons=' + JSON . stringify ( Array . from ( $b ) . map ( ( x ) => ( x as HTMLElement ) . textContent ) ) , { log : false } ) )
233235 // Click move. Match the confirm button EXACTLY as "Move": the picker
234236 // labels it "Move to {folder}" while inside a folder and only "Move"
235237 // once it has navigated to the home root. A loose `contains('Move')`
236238 // would match the stale "Move to {folder}" button before the "All
237239 // files" navigation above has landed, moving the file into the wrong
238240 // folder. The exact match makes cypress wait for the root button.
239- cy . contains ( 'button' , / ^ M o v e $ / ) . should ( 'be.visible' ) . click ( )
241+ cy . contains ( 'button' , / ^ \s * M o v e \s * $ / ) . should ( 'be.visible' ) . click ( )
240242 } else if ( dirPath === '.' ) {
241243 // click move
242244 cy . contains ( 'button' , 'Copy' ) . should ( 'be.visible' ) . click ( )
@@ -274,14 +276,16 @@ export function copyFile(fileName: string, dirPath: string) {
274276 . findByRole ( 'button' , { name : 'All files' } )
275277 . should ( 'be.visible' )
276278 . click ( )
279+ // [picker-diag] log the exact button texts to see the root label
280+ cy . get ( 'button' ) . then ( ( $b ) => cy . task ( 'log' , '[picker-diag] copy buttons=' + JSON . stringify ( Array . from ( $b ) . map ( ( x ) => ( x as HTMLElement ) . textContent ) ) , { log : false } ) )
277281 // Click copy. Match the confirm button EXACTLY as "Copy": the picker
278282 // labels it "Copy to {folder}" while inside a folder and only "Copy"
279283 // once it has navigated to the home root. A loose `contains('Copy')`
280284 // would match the stale "Copy to {folder}" button before the "All
281285 // files" navigation above has landed, copying the file into the wrong
282286 // folder (deduplicated as "… (1)"). The exact match makes cypress
283287 // wait for the root button.
284- cy . contains ( 'button' , / ^ C o p y $ / ) . should ( 'be.visible' ) . click ( )
288+ cy . contains ( 'button' , / ^ \s * C o p y \s * $ / ) . should ( 'be.visible' ) . click ( )
285289 } else if ( dirPath === '.' ) {
286290 // click copy
287291 cy . contains ( 'button' , 'Copy' ) . should ( 'be.visible' ) . click ( )
0 commit comments