Skip to content

Commit

Permalink
Add RemoteSources to React test
Browse files Browse the repository at this point in the history
  • Loading branch information
arturi committed Sep 22, 2023
1 parent aa61c4a commit 7d40214
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion e2e/clients/react/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import Uppy from '@uppy/core'
import React, { useState } from 'react'
import { Dashboard, DashboardModal, DragDrop } from '@uppy/react'
import ThumbnailGenerator from '@uppy/thumbnail-generator'
import RemoteSources from '@uppy/remote-sources'

import '@uppy/core/dist/style.css'
import '@uppy/dashboard/dist/style.css'
import '@uppy/drag-drop/dist/style.css'

export default function App () {
const uppyDashboard = new Uppy({ id: 'dashboard' })
const RemoteSourcesOptions = {
companionUrl: 'http://companion.uppy.io',
sources: ['GoogleDrive', 'OneDrive', 'Unsplash', 'Zoom', 'Url'],
}
const uppyDashboard = new Uppy({ id: 'dashboard' }).use(RemoteSources, { ...RemoteSourcesOptions })
const uppyModal = new Uppy({ id: 'modal' })
const uppyDragDrop = new Uppy({ id: 'drag-drop' }).use(ThumbnailGenerator)
const [open, setOpen] = useState(false)
Expand Down
10 changes: 10 additions & 0 deletions e2e/cypress/integration/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ describe('@uppy/react', () => {
.each((element) => expect(element).attr('src').to.include('blob:'))
})

it('should render Dashboard with Remote Sources plugin pack', () => {
const sources = ['My Device', 'Google Drive', 'OneDrive', 'Unsplash', 'Zoom', 'Link']
cy.get('#dashboard .uppy-DashboardTab-name')
.each((item, index, list) => {
expect(list).to.have.length(6)
// Returns the current element from the loop
expect(Cypress.$(item).text()).to.eq(sources[index])
})
})

it('should render Modal in React and show thumbnails', () => {
cy.get('#open').click()
cy.get('@modal-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true })
Expand Down

0 comments on commit 7d40214

Please sign in to comment.