Skip to content

Commit b4ec83f

Browse files
juliusknorrbackportbot[bot]
authored andcommitted
tests(cypress): Wait for close before trying to assert that push throws
Signed-off-by: Julius Knorr <[email protected]> [skip ci]
1 parent ef3e979 commit b4ec83f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cypress/e2e/api/SessionApi.spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,15 @@ describe('The session Api', function() {
296296
it('signals closing connection', function() {
297297
cy.then(() => {
298298
return new Promise((resolve, reject) => {
299+
// Create a promise that resolves when close completes
299300
connection.close()
300-
connection.push({ steps: [messages.update], version, awareness: '' })
301-
.then(
302-
() => reject(new Error('Push should have thrown ConnectionClosed()')),
303-
resolve,
304-
)
301+
.then(() => {
302+
connection.push({ steps: [messages.update], version, awareness: '' })
303+
.then(
304+
() => reject(new Error('Push should have thrown ConnectionClosed()')),
305+
resolve,
306+
)
307+
})
305308
})
306309
})
307310
})

0 commit comments

Comments
 (0)