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, + ) + }) }) }) })