From 5e46b25e93944e3ec5babbb8d741db843d50d06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Tue, 23 Aug 2022 19:23:17 +0200 Subject: [PATCH] Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- cypress/e2e/download-share-disabled.cy.js | 2 +- cypress/e2e/download-share.cy.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/download-share-disabled.cy.js b/cypress/e2e/download-share-disabled.cy.js index 04e94c70f..a0fe773a4 100644 --- a/cypress/e2e/download-share-disabled.cy.js +++ b/cypress/e2e/download-share-disabled.cy.js @@ -92,7 +92,7 @@ describe(`Download ${fileName} in viewer`, function() { it('See the title on the viewer header but not the Download button', function() { cy.get('body > .viewer .modal-title').should('contain', 'image1.jpg') - cy.get('body > .viewer .modal-header button.action-item > .download-icon').should('not.exist') + cy.get('body > .viewer .modal-header a.action-item .download-icon').should('not.exist') cy.get('body > .viewer .modal-header button.header-close').should('be.visible') }) diff --git a/cypress/e2e/download-share.cy.js b/cypress/e2e/download-share.cy.js index f60a376d1..26f9321b4 100644 --- a/cypress/e2e/download-share.cy.js +++ b/cypress/e2e/download-share.cy.js @@ -27,6 +27,8 @@ const randUser = randHash() const fileName = 'image1.jpg' describe(`Download ${fileName} from viewer in link share`, function() { + let token = null + before(function() { // Init user cy.nextcloudCreateUser(randUser, 'password') @@ -60,7 +62,8 @@ describe(`Download ${fileName} from viewer in link share`, function() { }) it('Share the Photos folder with a share link and access the share link', function() { - cy.createLinkShare('/Photos').then(token => { + cy.createLinkShare('/Photos').then(newToken => { + token = newToken cy.logout() cy.visit(`/s/${token}`) }) @@ -80,13 +83,13 @@ describe(`Download ${fileName} from viewer in link share`, function() { it('See the download icon and title on the viewer header', function() { cy.get('body > .viewer .modal-title').should('contain', 'image1.jpg') - cy.get('body > .viewer .modal-header button.action-item > .download-icon').should('be.visible') + cy.get(`body > .viewer .modal-header a.action-item[href*='/s/${token}/download']`).should('be.visible') cy.get('body > .viewer .modal-header button.header-close').should('be.visible') }) it('Download the image', function() { // download the file - cy.get('body > .viewer .modal-header button.action-item > .download-icon').click() + cy.get('body > .viewer .modal-header a.action-item .download-icon').click() }) it('Compare downloaded file with asset by size', function() {