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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 22 10:31:43 UTC 2020


 cypress_test/integration_tests/common/helper.js                     |   21 ----------
 cypress_test/integration_tests/common/impress.js                    |    4 -
 cypress_test/integration_tests/mobile/impress/impress_focus_spec.js |    8 +--
 loleaflet/src/map/Map.js                                            |    7 ---
 4 files changed, 6 insertions(+), 34 deletions(-)

New commits:
commit 9d9ea65529c9e224746dc10fac37cc58503dc8fe
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Apr 22 10:16:14 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Apr 22 12:31:22 2020 +0200

    cypress: introduce a better way to check the selected text.
    
    We can use cypress methods on #copy-paste-container and so
    we don't need to use explicit wait() method here. The added
    cypress call will do the waiting more effectively.
    
    Change-Id: Ib15ffb1d72e422ef303f9e0e17b29d740cd4e7f6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92678
    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 fcb99e53c..4c24ea327 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -113,27 +113,11 @@ function clearAllText() {
 		.type('{ctrl}a{del}').wait(300);
 }
 
-// Returns the text that should go to the
-// clipboard on Ctrl+C.
-// So this isn't equivalent to reading the
-// clipboard (which Cypress doesn't support).
-// Takes a closure f that takes the text
-// string as argument. Use as follows:
-// helper.getTextForClipboard((plainText) => {
-// 	expect(plainText, 'Selection Text').to.equal(testText);
-// });
-function getTextForClipboard(f) {
-	cy.window().then(win => {
-		f(win.getTextForClipboard());
-	});
-}
-
 // Expects getTextForClipboard return the given
 // plain-text, and asserts equality.
 function expectTextForClipboard(expectedPlainText) {
-	getTextForClipboard((plainText) => {
-		expect(plainText, 'Selection Text').to.equal(expectedPlainText);
-	});
+	cy.get('#copy-paste-container pre')
+		.should('have.text', expectedPlainText);
 }
 
 function afterAll(fileName) {
@@ -182,7 +166,6 @@ module.exports.assertNoKeyboardInput = assertNoKeyboardInput;
 module.exports.assertHaveKeyboardInput = assertHaveKeyboardInput;
 module.exports.selectAllText = selectAllText;
 module.exports.clearAllText = clearAllText;
-module.exports.getTextForClipboard = getTextForClipboard;
 module.exports.expectTextForClipboard = expectTextForClipboard;
 module.exports.afterAll = afterAll;
 module.exports.initAliasToNegative = initAliasToNegative;
diff --git a/cypress_test/integration_tests/common/impress.js b/cypress_test/integration_tests/common/impress.js
index 8031b9eca..dab641ac4 100644
--- a/cypress_test/integration_tests/common/impress.js
+++ b/cypress_test/integration_tests/common/impress.js
@@ -54,10 +54,6 @@ function typeTextAndVerify(text, expected) {
 
 	helper.selectAllText();
 
-	//FIXME: Should retry the next check instead of
-	// an unreliable sleep, but for now this will do.
-	cy.wait(600);
-
 	helper.expectTextForClipboard(expected);
 }
 module.exports.assertNotInTextEditMode = assertNotInTextEditMode;
diff --git a/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
index 75b5e9b64..0c1739bf7 100644
--- a/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
@@ -64,7 +64,7 @@ describe('Impress focus tests', function() {
 
 		// End editing.
 		cy.get('#document-container')
-			.type('{esc}').wait(500);
+			.type('{esc}');
 
 		impress.assertNotInTextEditMode();
 
@@ -101,7 +101,7 @@ describe('Impress focus tests', function() {
 
 				// End editing.
 				cy.get('#document-container')
-					.type('{esc}').wait(500);
+					.type('{esc}');
 
 				impress.assertNotInTextEditMode();
 
@@ -111,7 +111,7 @@ describe('Impress focus tests', function() {
 						expect(items).have.length(1);
 
 						cy.get('#document-container')
-							.click(posX, posY).wait(500);
+							.click(posX, posY);
 
 						impress.assertInTextEditMode();
 
@@ -122,7 +122,7 @@ describe('Impress focus tests', function() {
 
 						// End editing.
 						cy.get('#document-container')
-							.type('{esc}').wait(500);
+							.type('{esc}');
 
 						impress.assertNotInTextEditMode();
 					});
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 39dcf46d2..fafe54a87 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -322,13 +322,6 @@ L.Map = L.Evented.extend({
 			// programmatically, so the next best thing
 			// is to track what we intended to do.
 			window.canAcceptKeyboardInput = function() { return map.canAcceptKeyboardInput(); };
-
-			// This is used to extract the text we *intended*
-			// to put on the clipboard. There is currently
-			// no way to actually put data on the clipboard
-			// programmatically, so this is the way to test
-			// what we "copied".
-			window.getTextForClipboard = function() { return map._clip.stripHTML(map._clip._getHtmlForClipboard()); };
 		}
 	},
 


More information about the Libreoffice-commits mailing list