Skip to content
Snippets Groups Projects
Verified Commit 8e8ae770 authored by jfriedli's avatar jfriedli
Browse files

updated upload tests to new cypress-upload plugin version

parent 26d6e05a
No related branches found
No related tags found
2 merge requests!231Develop,!210Update dependency cypress-file-upload to v4
Pipeline #36956 passed
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
the quieter you become the more you are able to hear
......@@ -38,18 +38,12 @@ describe('Upload page tests', () => {
})
it('allows uploading a file', () => {
const fileName = 'test-image.png'
cy.route({
method: 'POST',
url: '/api/upload'
}).as('fileUpload')
cy.fixture(fileName).then(fileContent => {
cy.get('.uppy-Dashboard-input').upload(
{ fileContent, fileName, mimeType: 'image/png' }
)
})
cy.get('.uppy-Dashboard-input').attachFile('test-image.png')
cy.get('.uppy-DashboardItem-name').contains('test-image')
cy.get('.uppy-StatusBar-actions > button').click()
......@@ -68,35 +62,24 @@ describe('Upload page tests', () => {
})
it('rejects not supported file extensions', () => {
const fileName = 'not-supported.json'
cy.fixture(fileName).then(fileContent => {
cy.get('.uppy-Dashboard-input').upload(
{ fileContent, fileName, mimeType: 'application/json' }
)
})
cy.get('.uppy-Dashboard-input').attachFile('not-supported.json')
cy.wait(300)
cy.get('.uppy-Informer').contains('You can only upload: .asc, .avi')
})
it('reject more than 10 files', () => {
cy.fixture('test-text-file.txt', 'base64').then(txtFile => {
const files = [
{ fileName: 'txt0.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt1.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt2.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt3.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt4.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt5.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt6.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt7.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt8.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt9.txt', fileContent: txtFile, mimeType: 'text/plain' },
{ fileName: 'txt10.txt', fileContent: txtFile, mimeType: 'text/plain' },
]
cy.get('.uppy-Dashboard-input').upload(files)
})
cy.get('.uppy-Dashboard-input')
.attachFile('txt0.txt')
.attachFile('txt1.txt')
.attachFile('txt2.txt')
.attachFile('txt3.txt')
.attachFile('txt4.txt')
.attachFile('txt5.txt')
.attachFile('txt6.txt')
.attachFile('txt7.txt')
.attachFile('txt8.txt')
.attachFile('txt9.txt')
.attachFile('txt10.txt')
cy.wait(300)
cy.get('.uppy-Informer').contains('You can only upload 10 files ')
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment