diff --git a/client/cypress/fixtures/logos/mcdonald.png b/client/cypress/fixtures/logos/mcdonald.png new file mode 100644 index 0000000..b205a7c Binary files /dev/null and b/client/cypress/fixtures/logos/mcdonald.png differ diff --git a/client/cypress/integration/upload.js b/client/cypress/integration/upload.js new file mode 100644 index 0000000..2bf3d17 --- /dev/null +++ b/client/cypress/integration/upload.js @@ -0,0 +1,19 @@ +/// + +describe("upload route should", () => { + it.only("handle one file upload", () => { + cy.visit("/") + cy.contains("Drop files") + + cy.fixture("logos/mcdonald.png", "base64").then(fileContent => { + cy.get('[cy="dropzone"]').upload( + { + fileContent, + fileName: "mcdonald.png", + mimeType: "image/png", + }, + { subjectType: "drag-n-drop" } + ) + }) + }) +}) diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js index c1f5a77..ebe3160 100644 --- a/client/cypress/support/commands.js +++ b/client/cypress/support/commands.js @@ -23,3 +23,4 @@ // // -- This is will overwrite an existing command -- // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) +import "cypress-file-upload" diff --git a/client/package-lock.json b/client/package-lock.json index ab82b74..71e3ef0 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1404,6 +1404,12 @@ } } }, + "cypress-file-upload": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-3.5.0.tgz", + "integrity": "sha512-MgrsP4C2pUMvHqixH33OtXHNKkwQZV6ny0fu+APDTEP9O/uuKFh3sYcnPNU6XGfuC85/RmqVNw21ZQyyT+S5IQ==", + "dev": true + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1442,6 +1448,11 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "dropzone": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/dropzone/-/dropzone-5.5.1.tgz", + "integrity": "sha512-3VduRWLxx9hbVr42QieQN25mx/I61/mRdUSuxAmDGdDqZIN8qtP7tcKMa3KfpJjuGjOJGYYUzzeq6eGDnkzesA==" + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", diff --git a/client/package.json b/client/package.json index 79413af..fa9ebcb 100644 --- a/client/package.json +++ b/client/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "compression": "^1.7.1", + "dropzone": "^5.5.1", "graphql-request": "^1.8.2", "polka": "^1.0.0-next.7", "sirv": "^0.4.0" @@ -25,6 +26,7 @@ "@babel/runtime": "^7.0.0", "@types/just-throttle": "^1.1.0", "cypress": "^3.6.1", + "cypress-file-upload": "^3.5.0", "npm-run-all": "^4.1.5", "rollup": "^1.12.0", "rollup-plugin-babel": "^4.0.2", diff --git a/client/src/routes/index.svelte b/client/src/routes/index.svelte index af21d22..e9e4d7b 100644 --- a/client/src/routes/index.svelte +++ b/client/src/routes/index.svelte @@ -1,20 +1,35 @@ - - Sapper project template - - -

- - Try editing this file (src/routes/index.svelte) to test live reloading. - -

- - + + +
+ +