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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 7 14:37:08 UTC 2020


 cypress_test/integration_tests/common/helper.js                 |   13 +++++
 cypress_test/integration_tests/common/mobile_helper.js          |   14 ++++++
 cypress_test/integration_tests/mobile/calc/calc_helper.js       |   18 +++++++
 cypress_test/integration_tests/mobile/impress/impress_helper.js |    4 +
 cypress_test/integration_tests/mobile/writer/writer_helper.js   |    8 +++
 loleaflet/src/control/Control.LokDialog.js                      |   23 +++++++++-
 6 files changed, 78 insertions(+), 2 deletions(-)

New commits:
commit af40fb36184b2c523ec7d927ed2127367ef19557
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Apr 7 16:13:23 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Apr 7 16:36:59 2020 +0200

    cypress: add some logging for helper functions.
    
    Change-Id: Ib8ff54208d47c7d921615f72b530e2404c26f3a6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91828
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index acaa71927..795973a55 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -1,6 +1,11 @@
 /* global cy Cypress expect*/
 
 function loadTestDoc(fileName, subFolder, mobile) {
+	cy.log('Loading test document - start.');
+	cy.log('Param - fileName: ' + fileName);
+	cy.log('Param - subFolder: ' + subFolder);
+	cy.log('Param - mobile: ' + mobile);
+
 	// Get a clean test document
 	if (subFolder === undefined) {
 		cy.task('copyFile', {
@@ -44,7 +49,10 @@ function loadTestDoc(fileName, subFolder, mobile) {
 		}});
 	// Wait for the document to fully load
 	cy.get('.leaflet-tile-loaded', {timeout : 10000});
+
+	cy.log('Loading test document - end.');
 }
+
 // Assert that NO keyboard input is accepted (i.e. keyboard should be HIDDEN).
 function assertNoKeyboardInput() {
 	cy.window().then(win => {
@@ -129,6 +137,9 @@ function expectTextForClipboard(expectedPlainText) {
 }
 
 function afterAll(fileName) {
+	cy.log('Waiting for closing the document - start.');
+	cy.log('Param - fileName: ' + fileName);
+
 	// Make sure that the document is closed
 	cy.visit('http://admin:admin@localhost:' +
 			Cypress.env('SERVER_PORT') +
@@ -139,6 +150,8 @@ function afterAll(fileName) {
 
 	cy.get('#doclist td:nth-child(2)')
 		.should('not.contain.text', fileName);
+
+	cy.log('Waiting for closing the document - end.');
 }
 
 module.exports.loadTestDoc = loadTestDoc;
diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js
index 787d7e428..3f9b4aa72 100644
--- a/cypress_test/integration_tests/common/mobile_helper.js
+++ b/cypress_test/integration_tests/common/mobile_helper.js
@@ -4,6 +4,8 @@ var helper = require('./helper');
 
 // Enable editing if we are in read-only mode.
 function enableEditingMobile() {
+	cy.log('Enabling editing mode - start.');
+
 	cy.get('#mobile-edit-button')
 		.then(function(button) {
 			if (button.css('display') !== 'none') {
@@ -14,6 +16,8 @@ function enableEditingMobile() {
 
 	cy.get('#tb_actionbar_item_mobile_wizard')
 		.should('not.have.class', 'disabled');
+
+	cy.log('Enabling editing mode - end.');
 }
 
 function beforeAllMobile(fileName, subFolder) {
@@ -23,6 +27,8 @@ function beforeAllMobile(fileName, subFolder) {
 }
 
 function detectLOCoreVersion() {
+	cy.log('Detecting core version - start.');
+
 	if (Cypress.env('LO_CORE_VERSION') === undefined) {
 		// Open hamburger menu
 		openHamburgerMenu();
@@ -54,9 +60,15 @@ function detectLOCoreVersion() {
 		cy.get('.vex-content')
 			.should('not.exist');
 	}
+
+	cy.log('Detecting core version - end.');
 }
 
 function longPressOnDocument(posX, posY) {
+	cy.log('Emulating a long press - start.');
+	cy.log('Param - posX: ' + posX);
+	cy.log('Param - posX: ' + posY);
+
 	cy.get('.leaflet-pane.leaflet-map-pane')
 		.then(function(items) {
 			expect(items).have.length(1);
@@ -79,6 +91,8 @@ function longPressOnDocument(posX, posY) {
 			cy.get('.leaflet-pane.leaflet-map-pane')
 				.trigger('pointerup', eventOptions);
 		});
+
+	cy.log('Emulating a long press - end.');
 }
 
 function openHamburgerMenu() {
diff --git a/cypress_test/integration_tests/mobile/calc/calc_helper.js b/cypress_test/integration_tests/mobile/calc/calc_helper.js
index 25155ec73..d3530f48c 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_helper.js
@@ -3,6 +3,10 @@
 var mobileHelper = require('../../common/mobile_helper');
 
 function clickOnFirstCell(firstClick = true, dblClick = false) {
+	cy.log('Clicking on first cell - start.');
+	cy.log('Param - firstClick: ' + firstClick);
+	cy.log('Param - dblClick: ' + dblClick);
+
 	// Enable editing if it's in read-only mode
 	mobileHelper.enableEditingMobile();
 
@@ -27,6 +31,8 @@ function clickOnFirstCell(firstClick = true, dblClick = false) {
 	else
 		cy.get('.leaflet-cursor.blinking-cursor')
 			.should('exist');
+
+	cy.log('Clicking on first cell - end.');
 }
 
 function dblClickOnFirstCell() {
@@ -34,6 +40,8 @@ function dblClickOnFirstCell() {
 }
 
 function copyContentToClipboard() {
+	cy.log('Copying content to clipboard - start.');
+
 	selectAllMobile();
 
 	cy.get('.leaflet-tile-container')
@@ -59,9 +67,13 @@ function copyContentToClipboard() {
 	// Wait until it's closed
 	cy.get('.vex-overlay')
 		.should('not.exist');
+
+	cy.log('Copying content to clipboard - end.');
 }
 
 function removeTextSelection() {
+	cy.log('Removing all text - start.');
+
 	// TODO: select all does not work with core/master
 	// if we have a column selected
 	if (Cypress.env('LO_CORE_VERSION') === 'master') {
@@ -77,9 +89,13 @@ function removeTextSelection() {
 		cy.get('.spreadsheet-cell-resize-marker')
 			.should('exist');
 	}
+
+	cy.log('Removing all text - end.');
 }
 
 function selectAllMobile() {
+	cy.log('Selecting all text - start.');
+
 	removeTextSelection();
 
 
@@ -88,6 +104,8 @@ function selectAllMobile() {
 
 	cy.get('.leaflet-marker-icon')
 		.should('exist');
+
+	cy.log('Selecting all text - end.');
 }
 
 module.exports.copyContentToClipboard = copyContentToClipboard;
diff --git a/cypress_test/integration_tests/mobile/impress/impress_helper.js b/cypress_test/integration_tests/mobile/impress/impress_helper.js
index ce0d54f88..a1678726e 100644
--- a/cypress_test/integration_tests/mobile/impress/impress_helper.js
+++ b/cypress_test/integration_tests/mobile/impress/impress_helper.js
@@ -4,6 +4,8 @@ var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
 
 function copyShapeContentToClipboard() {
+	cy.log('Copying shape content to clipboard - start.');
+
 	// TODO: this fails on assertHaveKeyboardInput()
 	// assertInTextEditMode();
 
@@ -33,6 +35,8 @@ function copyShapeContentToClipboard() {
 	// Wait until it's closed
 	cy.get('.vex-overlay')
 		.should('not.exist');
+
+	cy.log('Copying shape content to clipboard - end.');
 }
 
 
diff --git a/cypress_test/integration_tests/mobile/writer/writer_helper.js b/cypress_test/integration_tests/mobile/writer/writer_helper.js
index 15a0cc7be..c26d3ee24 100644
--- a/cypress_test/integration_tests/mobile/writer/writer_helper.js
+++ b/cypress_test/integration_tests/mobile/writer/writer_helper.js
@@ -3,6 +3,8 @@
 var mobileHelper = require('../../common/mobile_helper');
 
 function copyTextToClipboard() {
+	cy.log('Copying text to clipboard - start.');
+
 	// Do a new selection
 	selectAllMobile();
 
@@ -30,9 +32,13 @@ function copyTextToClipboard() {
 	// Wait until it's closed
 	cy.get('.vex-overlay')
 		.should('not.exist');
+
+	cy.log('Copying text to clipboard - end.');
 }
 
 function copyTableToClipboard() {
+	cy.log('Copying table to clipboard - start.');
+
 	// Do a new selection
 	selectAllMobile();
 
@@ -68,6 +74,8 @@ function copyTableToClipboard() {
 	// Wait until it's closed
 	cy.get('.vex-overlay')
 		.should('not.exist');
+
+	cy.log('Copying table to clipboard - end.');
 }
 
 function selectAllMobile() {
commit d5691b45e43761c2237eff0f98e4b74aa848df90
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Apr 7 14:56:26 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Apr 7 16:36:50 2020 +0200

    Avoid destroying other popups by tooltip.
    
    Change-Id: Ida77fba1716fd380fecbfefe3e0f99ac231afb31
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91824
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 84c541e6b..c4326dc41 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -254,7 +254,12 @@ L.Control.LokDialog = L.Control.extend({
 
 	_onDialogMsg: function(e) {
 		console.log('onDialogMsg: id: ' + e.id + ', winType: ' + e.winType + ', action: ' + e.action + ', size: ' + e.size + ', rectangle: ' + e.rectangle);
-		if (e.winType != undefined && e.winType !== 'dialog' && e.winType !== 'calc-input-win' && e.winType !== 'child' && e.winType !== 'deck') {
+		if (e.winType != undefined &&
+		    e.winType !== 'dialog' &&
+		    e.winType !== 'calc-input-win' &&
+		    e.winType !== 'child' &&
+		    e.winType !== 'deck' &&
+		    e.winType !== 'tooltip') {
 			return;
 		}
 
@@ -292,21 +297,33 @@ L.Control.LokDialog = L.Control.extend({
 					// In mobile we get jsdialog messages.
 					window.sidebarId = e.id;
 				}
-			} else if (e.winType === 'child') {
+			} else if (e.winType === 'child' || e.winType === 'tooltip') {
 				var parentId = parseInt(e.parentId);
 				if (!this._isOpen(parentId))
 					return;
 
+				// In case of tooltips, do not remove the previous popup
+				// only if that's also a tooltip.
+				if (e.winType === 'tooltip' &&
+				    this._dialogs[parentId].childid !== undefined &&
+				    this._dialogs[parentId].childistooltip !== true)
+					return;
+
 				if (!left)
 					left = 0;
 				if (!top)
 					top = 0;
 				this._removeDialogChild(parentId);
+
 				this._dialogs[parentId].childid = e.id;
 				this._dialogs[parentId].childwidth = width;
 				this._dialogs[parentId].childheight = height;
 				this._dialogs[parentId].childx = left;
 				this._dialogs[parentId].childy = top;
+				if (e.winType === 'tooltip')
+					this._dialogs[parentId].childistooltip = true;
+				else
+					this._dialogs[parentId].childistooltip = false;
 				this._createDialogChild(e.id, parentId, top, left);
 				this._sendPaintWindow(e.id, this._createRectStr(null, 0, 0, width, height));
 			}
@@ -1451,10 +1468,12 @@ L.Control.LokDialog = L.Control.extend({
 			var canvasHeight = canvas.height;
 			$('#' + dialogId).height(canvasHeight + 'px');
 		}
+		this._dialogs[dialogId].childid = undefined;
 	},
 
 	_removeDialogChild: function(id) {
 		$('#' + this._toStrId(id) + '-floating').remove();
+		this._dialogs[id].childid = undefined;
 	},
 
 	_createDialogChild: function(childId, parentId, top, left) {


More information about the Libreoffice-commits mailing list