From 9b596f0463a35e3261b83326aeea8f8466a302f3 Mon Sep 17 00:00:00 2001 From: Elizabeth Danzberger Date: Tue, 16 Sep 2025 14:27:31 -0400 Subject: [PATCH] fix(test): adjust selectors for image inseration test Signed-off-by: Elizabeth Danzberger --- cypress/e2e/integration.spec.js | 31 ++++++++++++++++++++++++------- src/view/Office.vue | 21 +++++++++++---------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/integration.spec.js b/cypress/e2e/integration.spec.js index d85039fc3..d93766807 100644 --- a/cypress/e2e/integration.spec.js +++ b/cypress/e2e/integration.spec.js @@ -102,9 +102,13 @@ describe('Nextcloud integration', function() { it('Open locally', function() { cy.get('@loleafletframe').within(() => { cy.get('.notebookbar-shortcuts-bar', { timeout: 30_000 }) - .should('be.visible') + .as('shortcuts-bar') - cy.get('button[aria-label="Open in local editor"]').click() + cy.get('@shortcuts-bar').should('be.visible') + + cy.get('@shortcuts-bar') + .find('button[aria-label="Open in local editor"]') + .click() }) cy.get('.confirmation-dialog').should('be.visible') @@ -126,11 +130,24 @@ describe('Nextcloud integration', function() { cy.get('@open').its('firstCall.args.0').should('contain', 'nc://open/' + randUser.userId + '@' + nextcloudHost + '/document.odt') }) - it('Insert image', function() { + // TODO: Unskip once there is a viable nightly Docker container + // available to the workflows + it.skip('Insert image', function() { cy.get('@loleafletframe').within(() => { - cy.get('#Insert-tab-label').click() - cy.get('#insert-insert-graphic-button').click() - cy.get('#insert-insert-graphic-entries #insert-insert-graphic-entry-1').click() + cy.get('.notebookbar-tabs-container') + .get('button[aria-label="Insert"]') + .filter('[role="tab"]') + .click() + + cy.get('#overflow-button-insert-illustrations') + .find('button[aria-label="Open Illustrations"]') + .click() + + cy.get('#insert-insert-graphic') + .find('button[aria-label="Image"]') + .click() + + cy.get('#insert-insert-graphic-entry-1').click() }) cy.get('.modal-container__content').should('be.visible') }) @@ -180,4 +197,4 @@ describe('Nextcloud integration', function() { }) }) }) -}) \ No newline at end of file +}) diff --git a/src/view/Office.vue b/src/view/Office.vue index da89ab2a2..1a699392c 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -351,16 +351,6 @@ export default { this.loading = LOADING_STATE.DOCUMENT_READY clearTimeout(this.loadingTimeout) this.sendPostMessage('Host_PostmessageReady') - if (loadState('richdocuments', 'open_local_editor', true) && !this.isEmbedded) { - this.sendPostMessage('Insert_Button', { - id: 'Open_Local_Editor', - imgurl: window.location.protocol + '//' + getNextcloudUrl() + imagePath('richdocuments', 'launch.svg'), - mobile: false, - label: t('richdocuments', 'Open in local editor'), - hint: t('richdocuments', 'Open in local editor'), - insertBefore: 'print', - }) - } }, async share() { FilesAppIntegration.share() @@ -394,6 +384,17 @@ export default { FilesAppIntegration.initAfterReady() } else if (args.Status === 'Document_Loaded') { this.documentReady() + + if (loadState('richdocuments', 'open_local_editor', true) && !this.isEmbedded) { + this.sendPostMessage('Insert_Button', { + id: 'Open_Local_Editor', + imgurl: window.location.protocol + '//' + getNextcloudUrl() + imagePath('richdocuments', 'launch.svg'), + mobile: false, + label: t('richdocuments', 'Open in local editor'), + hint: t('richdocuments', 'Open in local editor'), + insertBefore: 'print', + }) + } } else if (args.Status === 'Failed') { this.loading = LOADING_STATE.FAILED this.$emit('update:loaded', true)