From be3ffe827b2454e6655efc7084037786b8c5e7d2 Mon Sep 17 00:00:00 2001 From: Ole Martin Handeland Date: Fri, 3 Jul 2026 11:57:30 +0200 Subject: [PATCH] fix: avoid Cypress socket errors in layout intercepts --- test/e2e/support/custom.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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})`); });