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

preparing test

parent 01d3107a
No related branches found
No related tags found
1 merge request!4Resolve "Add File Restrictions"
......@@ -17,3 +17,9 @@ for production builds. If you use the docker environment
this is customizable in the `docker-compose.yml` file.
If none of these are set it will default to `http://localhost:5000/`.
Make sure to have slash at the end ;)
## E2E Tests
Run the E2E tests: `quasar test --e2e cypress`.
We use the cypress.io framework for testing.
The responses from the backend are mocked so it's not
fully E2E.
some:
random:
yaml: 'testing'
......@@ -11,11 +11,17 @@ describe('Landing', () => {
describe('Upload page tests', () => {
beforeEach(() => {
cy.server()
cy.visit('/')
})
it('allows uploading a file', () => {
cy.server()
cy.route({
method: 'GET',
url: '/api/extension',
response: ['.png', '.jpg']
}).as('supportedExtensions')
cy.route({
method: 'POST',
url: '/api/upload',
......@@ -33,6 +39,8 @@ describe('Upload page tests', () => {
const fileName = 'test-image.png'
cy.wait('@supportedExtensions')
cy.fixture(fileName).then(fileContent => {
cy.get('.uppy-Dashboard-dropFilesTitle').upload(
{ fileContent, fileName, mimeType: 'image/png' },
......@@ -55,4 +63,17 @@ describe('Upload page tests', () => {
cy.get('.q-item__section a')
.should('have.attr', 'href').and('include', 'test-image.cleaned.png')
})
it('rejects not supported file extensions', () => {
const fileName = 'not-supported.yml'
cy.fixture(fileName).then(fileContent => {
cy.get('.uppy-Dashboard-dropFilesTitle').upload(
{ fileContent, fileName, mimeType: 'image/png' },
{ subjectType: 'drag-n-drop' }
)
})
cy.get(".uppy-Informer").contains("You can only upload: .asc, .avi")
})
})
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