Skip to content

Commit

Permalink
fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ErykKul committed Jun 18, 2024
1 parent 3159a8b commit 5831706
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ describe('UploadDatasetFiles', () => {
)

cy.findByText('Select files to add').should('exist')
cy.findByText('Drag and drop files here.').should('exist')
cy.findByTestId('drag-and-drop').as('dnd')
cy.get('@dnd').should('exist')
})

it('renders the files being uploaded', () => {
Expand Down Expand Up @@ -111,10 +112,6 @@ describe('UploadDatasetFiles', () => {
cy.findAllByTitle('Cancel upload').should('exist')
cy.findAllByRole('progressbar').should('exist')
cy.findByText('Select files to add').should('exist')
cy.findByText('Drag and drop files here.').should('not.exist')
// wait for upload to finish
cy.findByText('users2.json').should('not.exist')
cy.findByText('users3.json').should('not.exist')
})

it('renders file upload by clicking add button', () => {
Expand Down Expand Up @@ -180,8 +177,8 @@ describe('UploadDatasetFiles', () => {
cy.findAllByRole('progressbar').should('have.length', 2)
cy.findByText('Select files to add').should('exist')
// wait for upload to finish
cy.findByText('users3.json').should('not.exist')
cy.findByText('users1.json').should('not.exist')
cy.findByText('Save').should('exist')
cy.findByText('Cancel').should('exist')
cy.get('@dnd').selectFile(
{ fileName: 'users1.json', contents: [{ name: 'John Doe the 1st' }] },
{ action: 'drag-drop' }
Expand All @@ -190,8 +187,8 @@ describe('UploadDatasetFiles', () => {
{ fileName: 'users3.json', contents: [{ name: 'John Doe the 3rd' }] },
{ action: 'drag-drop' }
)
cy.findByText('users3.json').should('not.exist')
cy.findByText('users1.json').should('not.exist')
cy.findByText('users3.json').should('have.length', 1)
cy.findByText('users1.json').should('have.length', 1)
})

it('prevents double uploads', () => {
Expand Down

0 comments on commit 5831706

Please sign in to comment.