[Libreoffice-commits] online.git: cypress_test/integration_tests loleaflet/src

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 17 14:56:31 UTC 2020


 cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js |   32 ++++++++++
 loleaflet/src/layer/tile/TileLayer.js                               |    2 
 2 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 5ae113c7bf7335633e8a0151d2a5d1c8d5f2b1b9
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jun 17 15:34:20 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jun 17 16:56:10 2020 +0200

    cypress: test save / print menu options (writer, mobile).
    
    Change-Id: If954192df8ff9eafde44b8e1a5a714f40ecbe42c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96539
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at 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 d70e11c60..249624174 100644
--- a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
@@ -39,6 +39,38 @@ describe('Trigger hamburger menu options.', function() {
 			.click();
 	}
 
+	it('Save', function() {
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'File')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Save')
+			.click();
+
+		// TODO: we have no visual indicator of save was done
+		// So just trigger saving to catch any exception / console error
+		cy.wait(500);
+	});
+
+	it('Print', function() {
+		// A new window should be opened with the PDF.
+		cy.window()
+			.then(function(win) {
+				cy.stub(win, 'open');
+			});
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'File')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Print')
+			.click();
+
+		cy.window().its('open').should('be.called');
+	});
+
 	it('Download as PDF', function() {
 		mobileHelper.openHamburgerMenu();
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 2275206a5..eb0a7b14a 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -917,7 +917,7 @@ L.TileLayer = L.GridLayer.extend({
 			this._map.fire('postMessage', {msgId: 'Download_As', args: {Type: command.id, URL: url}});
 		}
 		else if (command.id === 'print') {
-			if (L.Browser.gecko || L.Browser.edge || L.Browser.ie || this._map.options.print === false) {
+			if (L.Browser.gecko || L.Browser.edge || L.Browser.ie || this._map.options.print === false || L.Browser.cypressTest) {
 				// the print dialog doesn't work well on firefox
 				// due to a pdf.js issue - https://github.com/mozilla/pdf.js/issues/5397
 				// open the pdf file in a new tab so that that user can print it directly in the browser's


More information about the Libreoffice-commits mailing list