mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #7480 from overleaf/ta-wait-for-test
Add waitFor to fix flaky test GitOrigin-RevId: 3b0f0423e7126248383ba7c68556c9ae937f3533
This commit is contained in:
parent
052ac3e6b1
commit
cef7adc711
1 changed files with 6 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
import { waitFor } from '@testing-library/react'
|
||||
import { act } from '@testing-library/react-hooks'
|
||||
import { expect } from 'chai'
|
||||
import sinon from 'sinon'
|
||||
|
@ -75,10 +76,11 @@ describe('useDetachLayout', function () {
|
|||
|
||||
// check that all message were re-broadcast for the new tab
|
||||
await nextTick() // necessary to ensure all event handler have run
|
||||
const reBroadcastMessagesCount =
|
||||
sysendTestHelper.getAllBroacastMessages().length
|
||||
expect(reBroadcastMessagesCount).to.equal(broadcastMessagesCount)
|
||||
|
||||
await waitFor(() => {
|
||||
const reBroadcastMessagesCount =
|
||||
sysendTestHelper.getAllBroacastMessages().length
|
||||
expect(reBroadcastMessagesCount).to.equal(broadcastMessagesCount)
|
||||
})
|
||||
// 3. simulate closed detached tab
|
||||
sysendTestHelper.spy.broadcast.resetHistory()
|
||||
sysendTestHelper.receiveMessage({
|
||||
|
|
Loading…
Reference in a new issue