Kaynağa Gözat

test: integration test for url plugin

Ifedapo Olarewaju 6 yıl önce
ebeveyn
işleme
44a8070377

+ 1 - 1
bin/endtoend-build-tests

@@ -12,7 +12,7 @@ __base="$(basename ${__file} .sh)"
 __root="$(cd "$(dirname "${__dir}")" && pwd)"
 __root="$(cd "$(dirname "${__dir}")" && pwd)"
 
 
 # Tests using a simple build setup.
 # Tests using a simple build setup.
-tests="tus-drag-drop tus-dashboard i18n-drag-drop xhr-limit providers thumbnails transloadit"
+tests="tus-drag-drop tus-dashboard i18n-drag-drop xhr-limit providers thumbnails transloadit url-plugin"
 
 
 for t in $tests; do
 for t in $tests; do
   mkdir -p "${__root}/test/endtoend/$t/dist"
   mkdir -p "${__root}/test/endtoend/$t/dist"

+ 28 - 0
test/endtoend/url-plugin/index.html

@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <title>Uppy test page</title>
+</head>
+
+<body>
+  <style>
+    main {
+      max-width: 700px;
+      margin: auto;
+    }
+  </style>
+  <main>
+    <h2>Uppy URL Plugin</h2>
+    <div>
+      <div id="uppyDashboard"></div>
+    </div>
+  </main>
+
+  <link href="uppy.min.css" rel="stylesheet">
+  <script src="bundle.js"></script>
+</body>
+
+</html>

+ 18 - 0
test/endtoend/url-plugin/main.js

@@ -0,0 +1,18 @@
+require('es6-promise/auto')
+require('whatwg-fetch')
+const Uppy = require('@uppy/core')
+const Dashboard = require('@uppy/dashboard')
+const Url = require('@uppy/url')
+const Tus = require('@uppy/tus')
+
+Uppy({
+  id: 'uppyProvider',
+  debug: true,
+  autoProceed: true
+})
+  .use(Dashboard, {
+    target: '#uppyDashboard',
+    inline: true
+  })
+  .use(Url, { target: Dashboard, serverUrl: 'http://localhost:3020' })
+  .use(Tus, { endpoint: 'https://master.tus.io/files/' })

+ 20 - 0
test/endtoend/url-plugin/test.js

@@ -0,0 +1,20 @@
+/* global browser, expect  */
+const testURL = 'http://localhost:4567/url-plugin'
+
+describe('File upload with URL plugin', () => {
+  beforeEach(() => {
+    browser.url(testURL)
+  })
+
+  it('should import  and upload a file completely with Url Plugin', () => {
+    // select url plugin
+    browser.click(`.uppy-DashboardTab-btn[aria-controls=uppy-DashboardContent-panel--Url]`)
+    // import set url value
+    browser.waitForVisible('input.uppy-Url-input', 3000)
+    browser.setValue('input.uppy-Url-input', 'https://github.com/transloadit/uppy/raw/master/assets/palette.png')
+    browser.click('button.uppy-Url-importButton')
+
+    // do the upload
+    browser.waitForVisible('.uppy-StatusBar-content[title="Complete"]', 20000)
+  })
+})

+ 1 - 0
test/endtoend/wdio.base.conf.js

@@ -94,6 +94,7 @@ exports.config = {
     { mount: '/providers', path: './test/endtoend/providers/dist' },
     { mount: '/providers', path: './test/endtoend/providers/dist' },
     { mount: '/thumbnails', path: './test/endtoend/thumbnails/dist' },
     { mount: '/thumbnails', path: './test/endtoend/thumbnails/dist' },
     { mount: '/transloadit', path: './test/endtoend/transloadit/dist' },
     { mount: '/transloadit', path: './test/endtoend/transloadit/dist' },
+    { mount: '/url-plugin', path: './test/endtoend/url-plugin/dist' },
     { mount: '/create-react-app', path: './test/endtoend/create-react-app/build' }
     { mount: '/create-react-app', path: './test/endtoend/create-react-app/build' }
   ],
   ],