@@ -151,13 +151,7 @@ describe('Test all image insertion methods', () => {
151151 . should ( 'contain' , 'test.md' )
152152 cy . get ( '#fileList tr[data-file="github.png"]' , { timeout : 10000 } )
153153 . should ( 'contain' , 'github.png' )
154-
155- cy . get ( '#app-settings-header' , { timeout : 10000 } )
156- . click ( )
157- cy . intercept ( { method : 'POST' , url : '**/showhidden' } ) . as ( 'showHidden' )
158- cy . get ( '#app-settings-content label[for=showhiddenfilesToggle]' , { timeout : 10000 } )
159- . click ( )
160- cy . wait ( '@showHidden' )
154+ cy . showHiddenFiles ( )
161155 } )
162156
163157 it ( 'Insert an image from files' , ( ) => {
@@ -234,9 +228,7 @@ describe('Test all image insertion methods', () => {
234228 const files = attachmentFileNameToId [ documentId ]
235229
236230 cy . expect ( Object . keys ( files ) ) . to . have . lengthOf ( 2 )
237- cy . intercept ( { method : 'PROPFIND' , url : '**/.attachments.' + documentId } ) . as ( 'chdir' )
238- cy . openFile ( '.attachments.' + documentId )
239- cy . wait ( '@chdir' )
231+ cy . openFolder ( '.attachments.' + documentId )
240232 cy . screenshot ( )
241233 for ( const name in files ) {
242234 cy . get ( `#fileList tr[data-file="${ name } "]` , { timeout : 10000 } )
@@ -248,29 +240,16 @@ describe('Test all image insertion methods', () => {
248240 } )
249241
250242 it ( 'test if attachment folder is moved with the markdown file' , ( ) => {
251- cy . intercept ( { method : 'MKCOL' , url : '**/subFolder' } ) . as ( 'mkdir' )
252243 cy . createFolder ( 'subFolder' )
253- cy . wait ( '@mkdir' )
254-
255- cy . intercept ( { method : 'PROPFIND' , url : '**/' } ) . as ( 'reload' )
256244 cy . reloadFileList ( )
257- cy . wait ( '@reload' )
258-
259- cy . intercept ( { method : 'MOVE' , url : '**/test.md' } ) . as ( 'move' )
260245 cy . moveFile ( 'test.md' , 'subFolder/test.md' )
261- cy . wait ( '@move' )
262- cy . intercept ( { method : 'PROPFIND' , url : '**/subFolder' } ) . as ( 'chdir' )
263- cy . openFile ( 'subFolder' )
264- cy . wait ( '@chdir' )
265-
246+ cy . openFolder ( 'subFolder' )
266247 cy . get ( '#fileList tr[data-file="test.md"]' , { timeout : 10000 } )
267248 . should ( 'exist' )
268249 . should ( 'have.attr' , 'data-id' )
269250 . then ( ( documentId ) => {
270251 const files = attachmentFileNameToId [ documentId ]
271- cy . intercept ( { method : 'PROPFIND' , url : '**/.attachments.' + documentId } ) . as ( 'chdir' )
272- cy . openFile ( '.attachments.' + documentId )
273- cy . wait ( '@chdir' )
252+ cy . openFolder ( '.attachments.' + documentId )
274253 cy . screenshot ( )
275254 for ( const name in files ) {
276255 cy . get ( `#fileList tr[data-file="${ name } "]` , { timeout : 10000 } )
@@ -282,22 +261,16 @@ describe('Test all image insertion methods', () => {
282261 } )
283262
284263 it ( 'test if attachment folder is copied when copying a markdown file' , ( ) => {
285- cy . intercept ( { method : 'COPY' , url : '**/subFolder/test.md' } ) . as ( 'copyFile' )
286264 cy . copyFile ( 'subFolder/test.md' , 'testCopied.md' )
287- cy . wait ( '@copyFile' )
288- cy . intercept ( { method : 'PROPFIND' , url : '**/' } ) . as ( 'reload2' )
289265 cy . reloadFileList ( )
290- cy . wait ( '@reload2' )
291266
292267 cy . get ( '#fileList tr[data-file="testCopied.md"]' , { timeout : 10000 } )
293268 . should ( 'exist' )
294269 . should ( 'have.attr' , 'data-id' )
295270 . then ( ( documentId ) => {
296271 const files = attachmentFileNameToId [ documentId ]
297272
298- cy . intercept ( { method : 'PROPFIND' , url : '**/.attachments.' + documentId } ) . as ( 'chdir' )
299- cy . openFile ( '.attachments.' + documentId )
300- cy . wait ( '@chdir' )
273+ cy . openFolder ( '.attachments.' + documentId )
301274 cy . screenshot ( )
302275 for ( const name in files ) {
303276 cy . get ( `#fileList tr[data-file="${ name } "]` , { timeout : 10000 } )
@@ -315,15 +288,8 @@ describe('Test all image insertion methods', () => {
315288 . should ( 'exist' )
316289 . should ( 'have.attr' , 'data-id' )
317290 . then ( ( documentId ) => {
318- cy . intercept ( { method : 'DELETE' , url : '**/testCopied.md' } ) . as ( 'deleteFile' )
319291 cy . deleteFile ( 'testCopied.md' )
320- cy . wait ( '@deleteFile' )
321-
322- cy . intercept ( { method : 'PROPFIND' , url : '**/' } ) . as ( 'reload3' )
323292 cy . reloadFileList ( )
324- cy . wait ( '@reload3' )
325-
326- // cy.wait(2000)
327293 cy . get ( `#fileList tr[data-file=".attachments.${ documentId } "]` , { timeout : 10000 } )
328294 . should ( 'not.exist' )
329295 } )
@@ -336,14 +302,7 @@ describe('Test all image insertion methods', () => {
336302 cy . get ( '#fileList tr[data-file="test.md"]' , { timeout : 10000 } )
337303 . should ( 'contain' , 'test.md' )
338304 cy . get ( '#fileList tr[data-file="github.png"]' ) . should ( 'not.exist' )
339-
340- // show hidden files
341- cy . get ( '#app-settings-header' , { timeout : 10000 } )
342- . click ( )
343- cy . intercept ( { method : 'POST' , url : '**/showhidden' } ) . as ( 'showHidden' )
344- cy . get ( '#app-settings-content label[for=showhiddenfilesToggle]' , { timeout : 10000 } )
345- . click ( )
346- cy . wait ( '@showHidden' )
305+ cy . showHiddenFiles ( )
347306
348307 // check the attachment folder is not there
349308 cy . get ( '#fileList tr[data-file="test.md"]' , { timeout : 10000 } )
@@ -355,14 +314,8 @@ describe('Test all image insertion methods', () => {
355314 } )
356315
357316 // move the file and check the attachment folder is still not there
358- cy . intercept ( { method : 'MOVE' , url : '**/test.md' } ) . as ( 'move' )
359317 cy . moveFile ( 'test.md' , 'testMoved.md' )
360- cy . wait ( '@move' )
361-
362- cy . intercept ( { method : 'PROPFIND' , url : '**/' } ) . as ( 'reload' )
363318 cy . reloadFileList ( )
364- cy . wait ( '@reload' )
365-
366319 cy . get ( '#fileList tr[data-file="testMoved.md"]' , { timeout : 10000 } )
367320 . should ( 'exist' )
368321 . should ( 'have.attr' , 'data-id' )
@@ -372,22 +325,14 @@ describe('Test all image insertion methods', () => {
372325 } )
373326
374327 // copy the file and check the attachment folder was copied
375- cy . intercept ( { method : 'COPY' , url : '**/testMoved.md' } ) . as ( 'copyFile' )
376328 cy . copyFile ( 'testMoved.md' , 'testCopied.md' )
377- cy . wait ( '@copyFile' )
378- cy . intercept ( { method : 'PROPFIND' , url : '**/' } ) . as ( 'reload2' )
379329 cy . reloadFileList ( )
380- cy . wait ( '@reload2' )
381-
382330 cy . get ( '#fileList tr[data-file="testCopied.md"]' , { timeout : 10000 } )
383331 . should ( 'exist' )
384332 . should ( 'have.attr' , 'data-id' )
385333 . then ( ( documentId ) => {
386334 const files = attachmentFileNameToId [ documentId ]
387-
388- cy . intercept ( { method : 'PROPFIND' , url : '**/.attachments.' + documentId } ) . as ( 'chdir' )
389- cy . openFile ( '.attachments.' + documentId )
390- cy . wait ( '@chdir' )
335+ cy . openFolder ( '.attachments.' + documentId )
391336 cy . screenshot ( )
392337 for ( const name in files ) {
393338 cy . get ( `#fileList tr[data-file="${ name } "]` , { timeout : 10000 } )
0 commit comments