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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 1 11:04:51 UTC 2020


 cypress_test/integration_tests/common/helper.js                        |   16 +++++-
 cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js |   24 +++-------
 2 files changed, 22 insertions(+), 18 deletions(-)

New commits:
commit e362a86764ab13e4d5594f1fa15cd7ea11d87fba
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jun 1 12:04:15 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Jun 1 13:04:30 2020 +0200

    cypress: extract matchClipboardText() method.
    
    Change-Id: I15a5121a69b1295508c2ad96e414d5f804e5c397
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95271
    Tested-by: Jenkins
    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 39fc09875..fc20af278 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -122,8 +122,7 @@ function clearAllText() {
 		.should('not.exist');
 }
 
-// Expects getTextForClipboard return the given
-// plain-text, and asserts equality.
+// Check that the clipboard text matches with the specified text.
 function expectTextForClipboard(expectedPlainText) {
 	if (isWriter()) {
 		cy.get('#copy-paste-container p font')
@@ -134,6 +133,18 @@ function expectTextForClipboard(expectedPlainText) {
 	}
 }
 
+// Check that the clipboard text matches with the
+// passed regular expression.
+function matchClipboardText(regexp) {
+	if (isWriter()) {
+		cy.contains('#copy-paste-container p font', regexp)
+			.should('exist');
+	} else {
+		cy.contains('#copy-paste-container pre', regexp)
+			.should('exist');
+	}
+}
+
 function beforeAllDesktop(fileName, subFolder) {
 	var mobile = false;
 	loadTestDoc(fileName, subFolder, mobile);
@@ -228,6 +239,7 @@ module.exports.assertHaveKeyboardInput = assertHaveKeyboardInput;
 module.exports.selectAllText = selectAllText;
 module.exports.clearAllText = clearAllText;
 module.exports.expectTextForClipboard = expectTextForClipboard;
+module.exports.matchClipboardText = matchClipboardText;
 module.exports.afterAll = afterAll;
 module.exports.initAliasToNegative = initAliasToNegative;
 module.exports.initAliasToEmptyString = initAliasToEmptyString;
diff --git a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
index 01cb938fe..1f32f2a33 100644
--- a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
@@ -237,8 +237,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a date in MM/DD/YY format
 		var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert date field (variable).', function() {
@@ -258,8 +257,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a date in MM/DD/YY format
 		var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert time field (fixed).', function() {
@@ -279,8 +277,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a time in HH/MM/SS format
 		var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert time field (variable).', function() {
@@ -300,8 +297,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a time in HH/MM/SS format
 		var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert slide number.', function() {
@@ -406,8 +402,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a date in MM/DD/YY format
 		var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert date field (variable) inside existing text shape.', function() {
@@ -426,8 +421,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a date in MM/DD/YY format
 		var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert time field (fixed) inside existing text shape.', function() {
@@ -446,8 +440,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a time in HH/MM/SS format
 		var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert time field (variable) inside existing text shape.', function() {
@@ -466,8 +459,7 @@ describe('Impress insertion wizard.', function() {
 
 		// Check that we have a time in HH/MM/SS format
 		var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
-		cy.contains('#copy-paste-container pre', regex)
-			.should('exist');
+		helper.matchClipboardText(regex);
 	});
 
 	it('Insert slide number inside existing text shape.', function() {


More information about the Libreoffice-commits mailing list