@@ -129,14 +129,6 @@ export function triggerActionForFileId(fileid: number, actionId: string) {
129129 * @param actionId
130130 */
131131export function triggerActionForFile ( filename : string , actionId : string ) {
132- // [menu-diag] log the searched file vs. what the list actually shows, plus
133- // the current folder URL, so a "row-actions not found" failure reveals
134- // whether the view is in the wrong folder or the file is simply missing.
135- cy . url ( { log : false } ) . then ( ( url ) => {
136- const names = Array . from ( Cypress . $ ( '[data-cy-files-list-row-name]' ) )
137- . map ( ( e ) => ( e as HTMLElement ) . getAttribute ( 'data-cy-files-list-row-name' ) )
138- cy . task ( 'log' , `[menu-diag] triggerActionForFile target="${ filename } " action=${ actionId } url=${ url } rows=[${ names . join ( ' | ' ) } ]` , { log : false } )
139- } )
140132 getActionButtonForFile ( filename )
141133 . scrollIntoView ( )
142134 openActionsMenu ( ( ) => getActionButtonForFile ( filename ) )
@@ -238,8 +230,13 @@ export function moveFile(fileName: string, dirPath: string) {
238230 . findByRole ( 'button' , { name : 'All files' } )
239231 . should ( 'be.visible' )
240232 . click ( )
241- // click move
242- cy . contains ( 'button' , 'Move' ) . should ( 'be.visible' ) . click ( )
233+ // Click move. Match the confirm button EXACTLY as "Move": the picker
234+ // labels it "Move to {folder}" while inside a folder and only "Move"
235+ // once it has navigated to the home root. A loose `contains('Move')`
236+ // would match the stale "Move to {folder}" button before the "All
237+ // files" navigation above has landed, moving the file into the wrong
238+ // folder. The exact match makes cypress wait for the root button.
239+ cy . contains ( 'button' , / ^ M o v e $ / ) . should ( 'be.visible' ) . click ( )
243240 } else if ( dirPath === '.' ) {
244241 // click move
245242 cy . contains ( 'button' , 'Copy' ) . should ( 'be.visible' ) . click ( )
@@ -277,8 +274,14 @@ export function copyFile(fileName: string, dirPath: string) {
277274 . findByRole ( 'button' , { name : 'All files' } )
278275 . should ( 'be.visible' )
279276 . click ( )
280- // click copy
281- cy . contains ( 'button' , 'Copy' ) . should ( 'be.visible' ) . click ( )
277+ // Click copy. Match the confirm button EXACTLY as "Copy": the picker
278+ // labels it "Copy to {folder}" while inside a folder and only "Copy"
279+ // once it has navigated to the home root. A loose `contains('Copy')`
280+ // would match the stale "Copy to {folder}" button before the "All
281+ // files" navigation above has landed, copying the file into the wrong
282+ // folder (deduplicated as "… (1)"). The exact match makes cypress
283+ // wait for the root button.
284+ cy . contains ( 'button' , / ^ C o p y $ / ) . should ( 'be.visible' ) . click ( )
282285 } else if ( dirPath === '.' ) {
283286 // click copy
284287 cy . contains ( 'button' , 'Copy' ) . should ( 'be.visible' ) . click ( )
0 commit comments