cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js | 84 ++++++++++ loleaflet/src/layer/tile/TileLayer.js | 6 2 files changed, 89 insertions(+), 1 deletion(-)
New commits: commit 9102a8aaf51f49110a8c555fe4ab658873f47b03 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Jun 15 14:43:14 2020 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Jun 15 15:33:32 2020 +0200 cypress: test download as options (writer, mobile). We can't test the actual download: https://github.com/cypress-io/cypress/issues/949 What we test is that we get a proper URL, after triggered the download as menu item. This src attribute is set after the core exported the file and sent back the URL for it. We avoid download for test, because we can't control the download folder. It's better not to save files without clean up. Downloading is not working in headless mode anyway. Change-Id: I93664be7f55e4df863448adc734fa9cfc7b3638f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96352 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js index c024c286b..7ad042a2c 100644 --- a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js +++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js @@ -18,6 +18,90 @@ describe('Trigger hamburger menu options.', function() { helper.afterAll(testFileName); }); + it('Download as PDF', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'PDF Document (.pdf)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.pdf'); + }); + + it('Download as ODT', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'ODF text document (.odt)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.odt'); + }); + + it('Download as DOC', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'Word 2003 Document (.doc)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.doc'); + }); + + it('Download as DOCX', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'Word Document (.docx)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.docx'); + }); + + it('Download as RTF', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'Rich Text (.rtf)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.rtf'); + }); + + it('Download as EPUB', function() { + mobileHelper.openHamburgerMenu(); + + cy.contains('.menu-entry-with-icon', 'Download as') + .click(); + + cy.contains('.menu-entry-with-icon', 'EPUB (.epub)') + .click(); + + cy.get('iframe') + .should('have.attr', 'data-src') + .should('contain', 'document.epub'); + }); + it('Undo/redo.', function() { // Type a new character cy.get('textarea.clipboard') diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 7df2df248..2275206a5 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -934,7 +934,11 @@ L.TileLayer = L.GridLayer.extend({ this._map.fire('slidedownloadready', {url: url}); } else if (command.id === 'export') { - this._map._fileDownloader.src = url; + // Don't do a real download during testing + if (!L.Browser.cypressTest) + this._map._fileDownloader.src = url; + else + this._map._fileDownloader.setAttribute('data-src', url); } }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits