Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 38 additions & 34 deletions cypress/e2e/attachments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,40 +345,44 @@ describe('Test all attachment insertion methods', () => {
})
})

it('test if attachment folder is moved with the markdown file', () => {
const fileName = 'moveSource.md'
cy.createFolder('subFolder')
cy.createMarkdown(
fileName,
'![git](.attachments.123/github.png)',
false,
).then((fileId) => {
const attachmentsFolder = `.attachments.${fileId}`
cy.createFolder(attachmentsFolder)
cy.uploadFile(
'github.png',
'image/png',
`${attachmentsFolder}/github.png`,
)
cy.moveFile(fileName, 'subFolder/test.md')
})

cy.visit('/apps/files')
cy.openFolder('subFolder')
cy.getFile('test.md')
.should('exist')
.should('have.attr', 'data-cy-files-list-row-fileid')
.then((documentId) => {
const files = attachmentFileNameToId[documentId]
cy.openFolder('.attachments.' + documentId)
for (const name in files) {
cy.getFile(name)
.should('exist')
.should('have.attr', 'data-cy-files-list-row-fileid')
.should('eq', String(files[name]))
}
})
})
// retries fail to create the subFolder as it already exists.
it(
'test if attachment folder is moved with the markdown file',
{ retries: 0 },
() => {
const fileName = 'moveSource.md'
cy.createFolder('subFolder')
cy.createMarkdown(fileName, '![git](.attachments.123/github.png)', false)
.as('createdFileId')
.then((fileId) => {
const attachmentsFolder = `.attachments.${fileId}`
cy.createFolder(attachmentsFolder)
cy.uploadFile(
'github.png',
'image/png',
`${attachmentsFolder}/github.png`,
)
cy.moveFile(fileName, 'subFolder/test.md')
})

cy.visit('/apps/files')
cy.openFolder('subFolder')
cy.getFile('test.md')
.should('exist')
.should('have.attr', 'data-cy-files-list-row-fileid')
.then((documentId) => {
const files = attachmentFileNameToId[documentId]
cy.get('@createdFileId').should('eq', parseInt(documentId))
cy.openFolder('.attachments.' + documentId)
for (const name in files) {
cy.getFile(name)
.should('exist')
.should('have.attr', 'data-cy-files-list-row-fileid')
.should('eq', String(files[name]))
}
})
},
)

it('test if attachment folder is copied when copying a markdown file', () => {
const fileName = 'copySource.md'
Expand Down
Loading