|
@@ -1,5 +1,7 @@
|
|
|
import type BaseTus from '@uppy/tus'
|
|
|
|
|
|
+import { interceptCompanionUrlRequest, interceptCompanionUnsplashRequest, runRemoteUrlImageUploadTest, runRemoteUnsplashUploadTest } from './reusable-tests'
|
|
|
+
|
|
|
type Tus = BaseTus & {
|
|
|
requests: { isPaused: boolean }
|
|
|
}
|
|
@@ -12,8 +14,8 @@ describe('Dashboard with Tus', () => {
|
|
|
cy.visit('/dashboard-tus')
|
|
|
cy.get('.uppy-Dashboard-input:first').as('file-input')
|
|
|
cy.intercept('/files/*').as('tus')
|
|
|
- cy.intercept('http://localhost:3020/url/*').as('url')
|
|
|
- cy.intercept('http://localhost:3020/search/unsplash/*').as('unsplash')
|
|
|
+ interceptCompanionUrlRequest()
|
|
|
+ interceptCompanionUnsplashRequest()
|
|
|
})
|
|
|
|
|
|
it('should upload cat image successfully', () => {
|
|
@@ -53,33 +55,10 @@ describe('Dashboard with Tus', () => {
|
|
|
)
|
|
|
|
|
|
it('should upload remote image with URL plugin', () => {
|
|
|
- cy.get('[data-cy="Url"]').click()
|
|
|
- cy.get('.uppy-Url-input').type('https://raw.githubusercontent.com/transloadit/uppy/main/e2e/cypress/fixtures/images/cat.jpg')
|
|
|
- cy.get('.uppy-Url-importButton').click()
|
|
|
- cy.get('.uppy-StatusBar-actionBtn--upload').click()
|
|
|
- cy.wait('@url')
|
|
|
- cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
|
|
|
+ runRemoteUrlImageUploadTest()
|
|
|
})
|
|
|
|
|
|
it('should upload remote image with Unsplash plugin', () => {
|
|
|
- cy.get('[data-cy="Unsplash"]').click()
|
|
|
- cy.get('.uppy-SearchProvider-input').type('book')
|
|
|
- cy.get('.uppy-SearchProvider-searchButton').click()
|
|
|
- cy.wait('@unsplash')
|
|
|
- // Test that the author link is visible
|
|
|
- cy.get('.uppy-ProviderBrowserItem')
|
|
|
- .first()
|
|
|
- .within(() => {
|
|
|
- cy.root().click()
|
|
|
- // We have hover states that show the author
|
|
|
- // but we don't have hover in e2e, so we focus after the click
|
|
|
- // to get the same effect. Also tests keyboard users this way.
|
|
|
- cy.get('input[type="checkbox"]').focus()
|
|
|
- cy.get('a').should('have.css', 'display', 'block')
|
|
|
- })
|
|
|
- cy.get('.uppy-c-btn-primary').click()
|
|
|
- cy.get('.uppy-StatusBar-actionBtn--upload').click()
|
|
|
- cy.wait('@unsplash')
|
|
|
- cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
|
|
|
+ runRemoteUnsplashUploadTest()
|
|
|
})
|
|
|
})
|