@@ -117,15 +117,15 @@ const checkAttachment = (documentId, fileName, fileId, index, isImage = true) =>
117117 * @param {number|undefined } index of the attachment
118118 * @param {boolean } isImage is the attachment an image or a media file?
119119 */
120- const waitForRequestAndCheckAttachment = ( requestAlias , index , isImage = true ) => {
120+ const waitForRequestAndCheckAttachment = ( requestAlias , index , isImage = true , check = checkAttachment ) => {
121121 return cy . wait ( '@' + requestAlias )
122122 . then ( ( req ) => {
123123 // the name of the created file on NC side is returned in the response
124124 const fileId = req . response . body . id
125125 const fileName = req . response . body . name
126126 const documentId = req . response . body . documentId
127127
128- return checkAttachment ( documentId , fileName , fileId , index , isImage )
128+ return check ( documentId , fileName , fileId , index , isImage )
129129 } )
130130}
131131
@@ -281,6 +281,13 @@ describe('Test all attachment insertion methods', () => {
281281 } )
282282
283283 it ( 'Create a new text file as an attachment' , ( ) => {
284+ const check = ( documentId , fileName ) => {
285+ cy . log ( 'Check the attachment is visible and well formed' , documentId , fileName )
286+ return cy . get ( `.text-editor [basename="${ fileName } "]` )
287+ . find ( '.text-editor__wrapper' )
288+ . should ( 'be.visible' )
289+ }
290+
284291 cy . visit ( '/apps/files' )
285292 cy . openFile ( 'test.md' )
286293
@@ -289,7 +296,7 @@ describe('Test all attachment insertion methods', () => {
289296 cy . intercept ( { method : 'POST' , url : '**/text/attachment/create' } ) . as ( requestAlias )
290297 clickOnAttachmentAction ( ACTION_CREATE_NEW_TEXT_FILE )
291298 . then ( ( ) => {
292- return waitForRequestAndCheckAttachment ( requestAlias , undefined , false )
299+ return waitForRequestAndCheckAttachment ( requestAlias , undefined , false , check )
293300 } )
294301 } )
295302
0 commit comments