From bf246bdb21eb98097584685d86620c2d91546175 Mon Sep 17 00:00:00 2001 From: Cristina Stefan <50820854+cristinastefan90@users.noreply.github.com> Date: Wed, 17 Jul 2019 10:00:00 +0300 Subject: [PATCH] #145 use once instead of on for event handler happening only once #145 Purchase order from sales order --- cypress/support/commands/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/support/commands/test.js b/cypress/support/commands/test.js index e7320820..daf04023 100644 --- a/cypress/support/commands/test.js +++ b/cypress/support/commands/test.js @@ -15,8 +15,8 @@ Cypress.Commands.add('editAddress', (fieldName, addressFunction) => { Cypress.emit('emit:addressPatchResolved', requestId); }); - - cy.on('emit:addressPatchResolved', requestId => { + /**for each POST address request above, the event handler code needs to happen only once */ + cy.once('emit:addressPatchResolved', requestId => { cy.route('POST', `/rest/api/address/${requestId}/complete`).as('completeAddress'); const outerPatchUrl = `/rest/api/address/${requestId}`;