Skip to content

Commit

Permalink
fix(tests): Verify correct fields are sent
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody committed Aug 6, 2024
1 parent 792e5ee commit 1170877
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cypress/e2e/templates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,19 @@ describe('Create templates with fields', () => {

cy.get('@templateFiller').find('input[placeholder="Name"]').type('Nextcloud')
cy.get('@templateFiller').find('input[placeholder="Favorite app"]').type('richdocuments')

// Intercept the POST request to verify the correct fields are submitted
cy.intercept('POST', '**/templates/create', (req) => {
const templateFields = Object.values(req.body.templateFields)

templateFields[0].content = 'Nextcloud'
templateFields[1].content = 'richdocuments'

req.continue()
}).as('reqFillFields')

cy.get('@templateFillerButtons').find('button[aria-label="Submit button"]').click()
cy.wait('@reqFillFields')

// Test if the fields currently match the values we passed to the template
cy.checkTemplateFields(['Nextcloud', 'richdocuments'], templateId)
Expand Down

0 comments on commit 1170877

Please sign in to comment.