Skip to content

Commit

Permalink
Add e2e test for manual pno form file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 17, 2024
1 parent 0592797 commit 481039f
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,48 @@ context('Side Window > Manual Prior Notification Form > Form', () => {
})
})

it('Should attach and remove a document to a manual prior notification', () => {
cy.intercept('GET', `/bff/v1/prior_notifications/00000000-0000-4000-0000-000000000002/uploads`).as('getUploads')
cy.intercept(
'POST',
`/bff/v1/prior_notifications/00000000-0000-4000-0000-000000000002/uploads?isManualPriorNotification=false&operationDate=*`
).as('uploadDocument')
cy.intercept('DELETE', `/bff/v1/prior_notifications/00000000-0000-4000-0000-000000000002/uploads/*`).as(
'deleteDocument'
)

editSideWindowPriorNotification(`DOS FIN`, '00000000-0000-4000-0000-000000000002')

cy.wait('@getUploads')

cy.fixture('sample.pdf').then(fileContent => {
cy.get('input[type=file]').selectFile(
{
contents: Cypress.Buffer.from(fileContent),
fileName: 'sample.pdf',
mimeType: 'application/pdf'
},
{
action: 'select',
force: true
}
)

cy.wait('@uploadDocument').then(() => {
cy.wait('@getUploads').wait(500)

cy.contains('.rs-uploader-file-item', 'sample.pdf')
.find('.rs-uploader-file-item-btn-remove .rs-icon')
.forceClick()

cy.wait('@deleteDocument')
cy.wait('@getUploads').wait(500)

cy.contains('sample.pdf').should('not.exist')
})
})
})

it('Should display the expected manual prior notification form validation errors', () => {
// -------------------------------------------------------------------------
// Base form validation errors
Expand Down

0 comments on commit 481039f

Please sign in to comment.