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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 22 16:04:14 UTC 2020


 cypress_test/integration_tests/common/helper.js                    |   24 +++++++++-
 cypress_test/integration_tests/mobile/writer/spellchecking_spec.js |    3 -
 2 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 2a047045b2092c56166b9d7522c60209ea026238
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Apr 22 17:40:35 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Apr 22 18:03:56 2020 +0200

    cypress: make expectTextForClipboard() work in Writer.
    
    Change-Id: I19d8961f64a23102f58d47a9893ddc318206c70a
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92716
    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 78f34fe07..6ebfcaccf 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -123,8 +123,13 @@ function clearAllText() {
 // Expects getTextForClipboard return the given
 // plain-text, and asserts equality.
 function expectTextForClipboard(expectedPlainText) {
-	cy.get('#copy-paste-container pre')
-		.should('have.text', expectedPlainText);
+	if (isWriter()) {
+		cy.get('#copy-paste-container p font')
+			.should('have.text', expectedPlainText);
+	} else {
+		cy.get('#copy-paste-container pre')
+			.should('have.text', expectedPlainText);
+	}
 }
 
 function afterAll(fileName) {
@@ -167,6 +172,18 @@ function initAliasToNegative(aliasName) {
 	cy.log('Initializing alias to a negative value - end.');
 }
 
+function isCalc() {
+	return Cypress.$('.spreadsheet-header-columns').length != 0;
+}
+
+function isImpress() {
+	return Cypress.$('#slide-sorter').length != 0;
+}
+
+function isWriter() {
+	return !isCalc() && !isImpress();
+}
+
 module.exports.loadTestDoc = loadTestDoc;
 module.exports.assertCursorAndFocus = assertCursorAndFocus;
 module.exports.assertNoKeyboardInput = assertNoKeyboardInput;
@@ -176,3 +193,6 @@ module.exports.clearAllText = clearAllText;
 module.exports.expectTextForClipboard = expectTextForClipboard;
 module.exports.afterAll = afterAll;
 module.exports.initAliasToNegative = initAliasToNegative;
+module.exports.isCalc = isCalc;
+module.exports.isImpress = isImpress;
+module.exports.isWriter = isWriter;
diff --git a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
index fb491219c..d2cf1ed4d 100644
--- a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
@@ -55,8 +55,7 @@ describe('Spell checking menu.', function() {
 
 		writerHelper.selectAllMobile();
 
-		cy.get('#copy-paste-container p')
-			.should('contain.text', 'hello');
+		helper.expectTextForClipboard('hello');
 	});
 
 	it('Ignore one.', function() {


More information about the Libreoffice-commits mailing list