diff --git a/.github/workflows/cypress-e2e.yml b/.github/workflows/cypress-e2e.yml index a2169cf1f5..eddff3e7fa 100644 --- a/.github/workflows/cypress-e2e.yml +++ b/.github/workflows/cypress-e2e.yml @@ -43,6 +43,7 @@ jobs: aliasgroup1: 'http://172.17.0.1' ports: - "9980:9980" + options: --cap-add SYS_ADMIN --cap-add SYS_CHROOT steps: - name: Checkout server diff --git a/cypress/e2e/direct.spec.js b/cypress/e2e/direct.spec.js index db7c0e0673..48a1880e8b 100644 --- a/cypress/e2e/direct.spec.js +++ b/cypress/e2e/direct.spec.js @@ -166,19 +166,29 @@ describe('Direct editing (legacy)', function() { it('Save as', function() { createDirectEditingLink(randUser, fileId) .then((token) => { - cy.nextcloudTestingAppConfigSet('richdocuments', 'uiDefaults-UIMode', 'tabbed') + cy.nextcloudTestingAppConfigSet('richdocuments', 'uiDefaults-UIMode', 'notebookbar') cy.logout() - cy.visit(token) + cy.visit(token, { + onBeforeLoad(win) { + cy.spy(win, 'postMessage').as('postMessage') + }, + }) cy.waitForCollabora(false) + cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' }) cy.get('@loleafletframe').within(() => { cy.get('.notebookbar-tabs-container', { timeout: 30_000 }) .should('be.visible') cy.get('button[aria-label="File"]').click() - cy.get('button[aria-label="Save As"]').click() + cy.get('button[aria-label="Save As"]') + .should('be.visible', { timeout: 10_000 }) + .click() - cy.get('#saveas-entries #saveas-entry-1').click() + cy.get('#saveas-entries > div', { timeout: 30_000 }) + .contains('Rich Text (.rtf)') + .should('be.visible') + .click() }) cy.get('.saveas-dialog') @@ -225,13 +235,18 @@ describe('Direct editing (legacy)', function() { .then((token) => { cy.nextcloudTestingAppConfigSet('richdocuments', 'uiDefaults-UIMode', 'classic') cy.logout() - cy.visit(token) + cy.visit(token, { + onBeforeLoad(win) { + cy.spy(win, 'postMessage').as('postMessage') + }, + }) cy.waitForCollabora(false) + cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' }) cy.get('[data-cy="coolframe"]').then($iframe => { const collaboraOrigin = $iframe[0].contentWindow.location.origin cy.spy($iframe[0].contentWindow, 'postMessage').as('postMessage') - cy.dispatchMessageFromOrigin(collaboraOrigin, { MessageId: 'App_LoadingStatus', Values: { Status: 'Document_Loaded' } }) - cy.waitForPostMessage('Host_PostmessageReady', undefined, { targetOrigin: collaboraOrigin }) + cy.dispatchMessageFromOrigin(collaboraOrigin, { MessageId: 'Action_Paste', Values: {} }) + cy.waitForPostMessage('Action_Paste', undefined, { targetOrigin: collaboraOrigin }) }) }) }) diff --git a/src/document.js b/src/document.js index 69e8d2861e..a0541f617f 100644 --- a/src/document.js +++ b/src/document.js @@ -620,9 +620,9 @@ const documentsMain = { $('footer,nav').show() documentsMain.UI.hideEditor() - documentsMain.openLocally() - - PostMessages.sendPostMessage('parent', 'close') + if (!isDirectEditing()) { + PostMessages.sendPostMessage('parent', 'close') + } }, onCloseViewer() {