@@ -100,6 +100,37 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
100100 getRowForFile ( 'new-folder' ) . should ( 'not.exist' )
101101 } )
102102
103+ // This was a bug previously
104+ it ( 'Can move a file to folder with similar name' , ( ) => {
105+ cy . uploadContent ( currentUser , new Blob ( ) , 'text/plain' , '/original' )
106+ . mkdir ( currentUser , '/original folder' )
107+ cy . login ( currentUser )
108+ cy . visit ( '/apps/files' )
109+
110+ // intercept the copy so we can wait for it
111+ cy . intercept ( 'MOVE' , / \/ r e m o t e .p h p \/ d a v \/ f i l e s \/ / ) . as ( 'moveFile' )
112+
113+ getRowForFile ( 'original' ) . should ( 'be.visible' )
114+ triggerActionForFile ( 'original' , 'move-copy' )
115+
116+ // select new folder
117+ cy . get ( '.file-picker [data-filename="original folder"]' ) . should ( 'be.visible' ) . click ( )
118+ // click copy
119+ cy . get ( '.file-picker' ) . contains ( 'button' , 'Move to original folder' ) . should ( 'be.visible' ) . click ( )
120+
121+ cy . wait ( '@moveFile' )
122+ // wait until visible again
123+ getRowForFile ( 'original folder' ) . should ( 'be.visible' )
124+
125+ // original should be moved -> not exist anymore
126+ getRowForFile ( 'original' ) . should ( 'not.exist' )
127+ getRowForFile ( 'original folder' ) . should ( 'be.visible' ) . find ( '[data-cy-files-list-row-name-link]' ) . click ( )
128+
129+ cy . url ( ) . should ( 'contain' , 'dir=/original%20folder' )
130+ getRowForFile ( 'original' ) . should ( 'be.visible' )
131+ getRowForFile ( 'original folder' ) . should ( 'not.exist' )
132+ } )
133+
103134 it ( 'Can move a file to its parent folder' , ( ) => {
104135 cy . mkdir ( currentUser , '/new-folder' )
105136 cy . uploadContent ( currentUser , new Blob ( ) , 'text/plain' , '/new-folder/original.txt' )
0 commit comments