Merge pull request #8524 from overleaf/ae-detached-test

Attempt to fix flaky Cypress test

GitOrigin-RevId: c49ec0b763e5dd3dde8c207021f1cb1a504f426c
This commit is contained in:
Alf Eaton 2022-06-21 14:50:23 +01:00 committed by Copybot
parent 7837af0afd
commit 34f15ba016
2 changed files with 3 additions and 3 deletions

View file

@ -62,7 +62,7 @@ describe('<PdfPreviewDetachedRoot/>', function () {
cy.findByRole('button', { name: 'Clear cached files' })
.should('not.be.disabled')
.click()
.then(() => {
.should(() => {
expect(sysendTestHelper.getLastBroacastMessage()).to.deep.equal({
role: 'detached',
event: 'action-clearCache',

View file

@ -22,7 +22,7 @@ function getLastDetachCall(method) {
}
function getLastBroacastMessage() {
return getLastDetachCall('broadcast').args[1]
return getLastDetachCall('broadcast')?.args[1]
}
function getAllBroacastMessages() {
@ -32,7 +32,7 @@ function getAllBroacastMessages() {
// this fakes receiving a message by calling the handler add to `on`. A bit
// funky, but works for now
function receiveMessage(message) {
getLastDetachCall('on').args[1](message)
getLastDetachCall('on')?.args[1](message)
}
export default {