How to test uppy?

Started by kmitov1 reply1,194 views
kmitovOriginal post
#1

Hi,
I am trying to figure out how to test uppy. We are running selenium with capybara and I would like to properly test that the file upload is working. Do you know of an example somewhere?

Thanks.

ajkachnic
#2

Assuming you mean integration tests, this should be doable. I’m not sure which language you’re using selenium with, so I can’t provide code for that, but I can provide client-side javascript to execute

// Adds the file to the uppy instance
uppy.addFile({
  name: 'my-file.jpg', // file name
  type: 'image/jpeg', // file type
  data: blob, // file blob
  isRemote: false // optional, set to true if actual file is not in the browser, but on some remote server, for example, when using companion in combination with Instagram
}

uppy.on('upload-success', () => {
// The upload succeeded
})

uppy.on('upload-error', (file, err) => {
// The upload failed
})

I know this is kind of broad, but hopefully this gets on you the right path for testing like this.
- Andrew