From 69bae1473a95e6d0f40ad2c384eb3bdc9b6e5a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 18 Apr 2024 14:44:27 +0200 Subject: [PATCH] fix: Assert post message to wait for save to happen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/e2e/integration.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cypress/e2e/integration.spec.js b/cypress/e2e/integration.spec.js index fd4067ffcb..c734c931ad 100644 --- a/cypress/e2e/integration.spec.js +++ b/cypress/e2e/integration.spec.js @@ -90,6 +90,19 @@ describe('Nextcloud integration', function() { cy.get('.oc-dialog button.primary').click() + cy.get('@postMessage') + .should((spy) => { + const calls = spy.getCalls() + const findMatchingCall = calls.find(call => call.args[0].indexOf('"MessageId":"Action_Save_Resp"') !== -1) + if (!findMatchingCall) { + return expect(findMatchingCall).to.not.be.undefined + } + const object = JSON.parse(findMatchingCall.args[0]) + expect(object.Values).to.have.property('success', true) + expect(object.Values).to.have.property('fileName', 'document.rtf') + return expect(findMatchingCall).to.not.be.undefined + }) + cy.get('@loleafletframe').within(() => { cy.get('#closebutton').click() })