diff --git a/test/e2e/support/custom.ts b/test/e2e/support/custom.ts index f95cd2356f..275f26fb6a 100644 --- a/test/e2e/support/custom.ts +++ b/test/e2e/support/custom.ts @@ -521,8 +521,8 @@ Cypress.Commands.add('moveProcessNext', () => { Cypress.Commands.add('interceptLayout', (taskName, mutator, wholeLayoutMutator, _options) => { const options = _options ?? { times: 1 }; cy.intercept({ method: 'GET', url: `**/api/layouts/${taskName}`, ...options }, (req) => { - req.reply((res) => { - const set = JSON.parse(res.body); + req.on('before:response', (res) => { + const set = typeof res.body === 'string' ? JSON.parse(res.body) : res.body; if (mutator) { for (const layout of Object.values(set)) { (layout as ILayoutFile).data.layout.map(mutator); @@ -531,7 +531,7 @@ Cypress.Commands.add('interceptLayout', (taskName, mutator, wholeLayoutMutator, if (wholeLayoutMutator) { wholeLayoutMutator(set); } - res.send(JSON.stringify(set)); + res.body = JSON.stringify(set); }); }).as(`interceptLayout(${taskName})`); });