From 1170877de3b7b677ab1415882eac8dc0bd3c5195 Mon Sep 17 00:00:00 2001 From: Elizabeth Danzberger Date: Tue, 6 Aug 2024 15:17:28 -0400 Subject: [PATCH] fix(tests): Verify correct fields are sent Signed-off-by: Elizabeth Danzberger --- cypress/e2e/templates.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cypress/e2e/templates.spec.js b/cypress/e2e/templates.spec.js index 426d674939..e88790fe9f 100644 --- a/cypress/e2e/templates.spec.js +++ b/cypress/e2e/templates.spec.js @@ -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)