From 4f070840f7592b2592266513e5208c52eed7ac00 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Mon, 17 Mar 2025 22:35:29 +0100 Subject: [PATCH] tests(cypress): Wait for close before trying to assert that push throws Signed-off-by: Julius Knorr --- cypress/e2e/api/SessionApi.spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/api/SessionApi.spec.js b/cypress/e2e/api/SessionApi.spec.js index c459dc72f3f..5b8d3aaae07 100644 --- a/cypress/e2e/api/SessionApi.spec.js +++ b/cypress/e2e/api/SessionApi.spec.js @@ -296,12 +296,15 @@ describe('The session Api', function() { it('signals closing connection', function() { cy.then(() => { return new Promise((resolve, reject) => { + // Create a promise that resolves when close completes connection.close() - connection.push({ steps: [messages.update], version, awareness: '' }) - .then( - () => reject(new Error('Push should have thrown ConnectionClosed()')), - resolve, - ) + .then(() => { + connection.push({ steps: [messages.update], version, awareness: '' }) + .then( + () => reject(new Error('Push should have thrown ConnectionClosed()')), + resolve, + ) + }) }) }) })