Skip to content

Commit 1340a21

Browse files
committed
tests(cypress): Wait for close before trying to assert that push throws
Signed-off-by: Julius Knorr <jus@bitgrid.net>
1 parent 4f45b8c commit 1340a21

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

cypress/e2e/Assistant.spec.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,11 @@ describe('Assistant', () => {
101101
.should('be.visible')
102102
.click()
103103

104-
cy.wait(1000)
105-
106104
cy.get('[data-cy="translate-input"]')
107-
.should('be.visible')
108-
.focus()
109-
110-
cy.wait(1000)
105+
.click()
111106

112107
cy.get('[data-cy="translate-input"]')
113108
.should('be.focused')
114-
cy.get('[data-cy="translate-input"]')
115-
.should('be.visible')
116109
.type('Hello World')
117110
})
118111
})

cypress/e2e/api/SessionApi.spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,15 @@ describe('The session Api', function() {
279279
it('signals closing connection', function() {
280280
cy.then(() => {
281281
return new Promise((resolve, reject) => {
282+
// Create a promise that resolves when close completes
282283
connection.close()
283-
connection.push({ steps: [messages.update], version, awareness: '' })
284-
.then(
285-
() => reject(new Error('Push should have thrown ConnectionClosed()')),
286-
resolve,
287-
)
284+
.then(() => {
285+
connection.push({ steps: [messages.update], version, awareness: '' })
286+
.then(
287+
() => reject(new Error('Push should have thrown ConnectionClosed()')),
288+
resolve,
289+
)
290+
})
288291
})
289292
})
290293
})

0 commit comments

Comments
 (0)