From c2f2c8f5cc8be134916e7b4f3f50907449d79a56 Mon Sep 17 00:00:00 2001 From: Murderlon Date: Tue, 4 Jan 2022 11:29:17 +0100 Subject: [PATCH] More wip --- .parcelrc | 9 +++++++++ cypress/app/dashboard/index.html | 13 ------------- cypress/app/dashboard/main.js | 4 ---- cypress/app/index.html | 13 ------------- cypress/app/main.js | 4 ---- cypress/{parcel => clients/dashboard}/app.js | 5 ++++- cypress/{parcel => clients/dashboard}/index.html | 0 cypress/clients/index.html | 12 ++++++++++++ cypress/cypress.json | 2 +- cypress/cypress/integration/test.spec.js | 6 ------ cypress/cypress/integration/tus.spec.js | 7 +++++++ cypress/generate-test.mjs | 6 ++++++ cypress/package.json | 9 ++++----- cypress/vite.config.js | 14 -------------- package.json | 3 +++ 15 files changed, 46 insertions(+), 61 deletions(-) create mode 100644 .parcelrc delete mode 100644 cypress/app/dashboard/index.html delete mode 100644 cypress/app/dashboard/main.js delete mode 100644 cypress/app/index.html delete mode 100644 cypress/app/main.js rename cypress/{parcel => clients/dashboard}/app.js (51%) rename cypress/{parcel => clients/dashboard}/index.html (100%) create mode 100644 cypress/clients/index.html delete mode 100644 cypress/cypress/integration/test.spec.js create mode 100644 cypress/cypress/integration/tus.spec.js create mode 100644 cypress/generate-test.mjs delete mode 100644 cypress/vite.config.js diff --git a/.parcelrc b/.parcelrc new file mode 100644 index 0000000000..236c7c7423 --- /dev/null +++ b/.parcelrc @@ -0,0 +1,9 @@ +{ + "extends": "@parcel/config-default", + "transformers": { + "*.{js,mjs,jsx,cjs,ts,tsx}": [ + "@parcel/transformer-js", + "@parcel/transformer-react-refresh-wrap" + ] + } +} diff --git a/cypress/app/dashboard/index.html b/cypress/app/dashboard/index.html deleted file mode 100644 index 718982f7a5..0000000000 --- a/cypress/app/dashboard/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Uppy dashboard - - -

yeah

-
- - - diff --git a/cypress/app/dashboard/main.js b/cypress/app/dashboard/main.js deleted file mode 100644 index cdf6efc657..0000000000 --- a/cypress/app/dashboard/main.js +++ /dev/null @@ -1,4 +0,0 @@ -import { Uppy } from '@uppy/core' -import Dashboard from '@uppy/dashboard' - -new Uppy().use(Dashboard, { target: '#app', inline: true }) diff --git a/cypress/app/index.html b/cypress/app/index.html deleted file mode 100644 index f1dedb52db..0000000000 --- a/cypress/app/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Vite App - - -
- - - diff --git a/cypress/app/main.js b/cypress/app/main.js deleted file mode 100644 index 052765e2e8..0000000000 --- a/cypress/app/main.js +++ /dev/null @@ -1,4 +0,0 @@ -document.querySelector('#app').innerHTML = ` -

Hello Vite!

- Documentation -` diff --git a/cypress/parcel/app.js b/cypress/clients/dashboard/app.js similarity index 51% rename from cypress/parcel/app.js rename to cypress/clients/dashboard/app.js index f2accf8026..362d536732 100644 --- a/cypress/parcel/app.js +++ b/cypress/clients/dashboard/app.js @@ -1,7 +1,10 @@ import { Uppy } from '@uppy/core' import Dashboard from '@uppy/dashboard' +import Tus from '@uppy/tus' import '@uppy/core/dist/style.css' import '@uppy/dashboard/dist/style.css' -new Uppy().use(Dashboard, { target: '#app', inline: true }) +new Uppy() + .use(Dashboard, { target: '#app', inline: true }) + .use(Tus, { endpoint: 'https://tusd.tusdemo.net' }) diff --git a/cypress/parcel/index.html b/cypress/clients/dashboard/index.html similarity index 100% rename from cypress/parcel/index.html rename to cypress/clients/dashboard/index.html diff --git a/cypress/clients/index.html b/cypress/clients/index.html new file mode 100644 index 0000000000..e801a2d31a --- /dev/null +++ b/cypress/clients/index.html @@ -0,0 +1,12 @@ + + + + + My First Parcel App + + +

Hello, World!

+ dashboard +
+ + diff --git a/cypress/cypress.json b/cypress/cypress.json index f152b0cf66..53a9bb5f6c 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,3 +1,3 @@ { - "baseUrl": "http://localhost:5000" + "baseUrl": "http://localhost:1234" } diff --git a/cypress/cypress/integration/test.spec.js b/cypress/cypress/integration/test.spec.js deleted file mode 100644 index 9922ccbd25..0000000000 --- a/cypress/cypress/integration/test.spec.js +++ /dev/null @@ -1,6 +0,0 @@ -describe('Dashboard', () => { - it('should work', () => { - cy.visit('/dashboard') - cy.get('h1').should('contain', 'yeah') - }) -}) diff --git a/cypress/cypress/integration/tus.spec.js b/cypress/cypress/integration/tus.spec.js new file mode 100644 index 0000000000..f7f0c94799 --- /dev/null +++ b/cypress/cypress/integration/tus.spec.js @@ -0,0 +1,7 @@ +describe('Dashboard', () => { + it('should work', async () => { + cy.visit('/dashboard') + const input = await cy.get('.uppy-Dashboard-input') + await input.setValue(path.join(__dirname, '../../resources/image.jpg')) + }) +}) diff --git a/cypress/generate-test.mjs b/cypress/generate-test.mjs new file mode 100644 index 0000000000..8a68aeddaf --- /dev/null +++ b/cypress/generate-test.mjs @@ -0,0 +1,6 @@ +// 1. name of the test +// 2. packages to test +// 3. generate: +// - test file with visit(name) +// - index.html +// - main.js with package imports diff --git a/cypress/package.json b/cypress/package.json index 2d385f2df1..81f10250ea 100644 --- a/cypress/package.json +++ b/cypress/package.json @@ -4,15 +4,14 @@ "author": "Merlijn Vos ", "description": "End-to-end test suite for Uppy", "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview" + "client:start": "parcel clients/index.html", + "cypress:open": "cypress open" }, "dependencies": { "@uppy/core": "workspace:^", "@uppy/dashboard": "workspace:^", + "@uppy/tus": "workspace:^", "cypress": "^9.0.0", - "parcel": "^2.0.1", - "vite": "^2.6.14" + "parcel": "^2.0.1" } } diff --git a/cypress/vite.config.js b/cypress/vite.config.js deleted file mode 100644 index 258088bc21..0000000000 --- a/cypress/vite.config.js +++ /dev/null @@ -1,14 +0,0 @@ -const { resolve } = require('path') -const { defineConfig } = require('vite') - -module.exports = defineConfig({ - root: './app', - build: { - rollupOptions: { - input: { - main: resolve(__dirname, 'app/index.html'), - dashboard: resolve(__dirname, 'app/dashboard/index.html'), - }, - }, - }, -}) diff --git a/package.json b/package.json index f444d9ac00..3fe4bd0afa 100644 --- a/package.json +++ b/package.json @@ -148,6 +148,9 @@ "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c", "start:companion": "bash ./bin/companion", "start": "npm-run-all --parallel watch start:companion web:start", + "e2e": "npm-run-all --parallel watch:js:lib e2e:client e2e:cypress", + "e2e:client": "yarn workspace cypress client:start", + "e2e:cypress": "yarn workspace cypress cypress:open", "test:companion": "yarn workspace @uppy/companion test", "test:endtoend:local": "yarn workspace @uppy-tests/end2end test:endtoend:local", "test:endtoend": "yarn workspace @uppy-tests/end2end test:endtoend",